Skip to content

Commit

Permalink
removed blender pools addon preferences & added config.json load
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurence Trippen committed Mar 23, 2019
1 parent dde0650 commit 9a54a51
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 23 deletions.
8 changes: 4 additions & 4 deletions afanasy/python/af.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ def renderGetLocal(self):
class MongoDB():
POOLS_DATABSE = "afpools"
POOLS_COLLECTION = "pools"
status = None
connection = None
status = None
connection = None

# Establishs the connection to MongoDB database.
def connect(self, connection):
Expand All @@ -1198,9 +1198,9 @@ def findAllPools(self):

class PoolsAddinAPI():
@staticmethod
def getPools():
def getPools(config):
MongoDB.connection = MongoDB()
MongoDB.connection.connect("mongodb://192.168.1.107:27017")
MongoDB.connection.connect("mongodb://" + config["host"] + ":" + str(config["port"]))
pools = MongoDB.connection.findAllPools()
poolset = {("- No pool selected. -", "- No pool selected. -", "- No pool selected. -")}
for pool in pools:
Expand Down
5 changes: 2 additions & 3 deletions plugins/blender/addons/cgru_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from . import utils

import bpy

import af

def register():
bpy.utils.register_module(__package__)
Expand All @@ -46,11 +46,10 @@ def register():
else:
utils.add_cgru_module_to_syspath(prefs.cgru_location)


def unregister():
del bpy.types.Scene.cgru
bpy.utils.unregister_module(__name__)


if __name__ == "__main__":
register()
register()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified plugins/blender/addons/cgru_tools/__pycache__/utils.cpython-35.pyc
Binary file not shown.
12 changes: 1 addition & 11 deletions plugins/blender/addons/cgru_tools/addon_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,9 @@ class CGRUAddonPreferences(AddonPreferences):
name="CGRU version",
default="NOT FOUND")

cgru_pool_server_host = StringProperty(
name="Pools MongoDB Host",
default="localhost")

cgru_pool_server_port = StringProperty(
name="Pools MongoDB Port",
default="27017")

def draw(self, context):
layout = self.layout
col = layout.column()
col.label(text="Please, set CGRU install root location")
col.prop(self, "cgru_location")
col.label(text="CGRU version: %s" % self.cgru_version)
col.prop(self, "cgru_pool_server_host")
col.prop(self, "cgru_pool_server_port")
col.label(text="CGRU version: %s" % self.cgru_version)
2 changes: 1 addition & 1 deletion plugins/blender/addons/cgru_tools/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ class CGRUProperties(bpy.types.PropertyGroup):

pools = EnumProperty(
name="Render Pool",
items=af.PoolsAddinAPI.getPools())
items=af.PoolsAddinAPI.getPools(utils.get_afpools_config()))
15 changes: 12 additions & 3 deletions plugins/blender/addons/cgru_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import bpy
import af
import json

CGRU_NOT_FOUND = 'NOT FOUND'

Expand Down Expand Up @@ -49,6 +50,14 @@ def get_movie_codecs(self, context):

return codecs

def get_all_pool_names():

return ["Pool 1", "Pool 2"]
def get_afpools_config():
path = os.path.join(os.environ["CGRU_LOCATION"], "utilities", "poolsaddin", "config.json")
config = {
"host":"localhost",
"port":"27017"
}
with open(path) as json_file:
data = json.load(json_file)
config["host"] = data["mongodb_host"]
config["port"] = data["mongodb_port"]
return config
6 changes: 5 additions & 1 deletion setup_pymongo.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@echo off

rem -------- pymongo cgru ----------------------------------

echo %CGRU_LOCATION%

set PY_EXE=%CGRU_LOCATION%\python\python.exe
Expand All @@ -8,4 +10,6 @@ set PIP_INSTALL_PYMONGO=%PY_EXE% -m pip install pymongo

echo %PY_INSTALL_PIP%
call %PY_INSTALL_PIP%
call %PIP_INSTALL_PYMONGO%
call %PIP_INSTALL_PYMONGO%

rem ---------------------------------------------------------
Binary file modified utilities/poolsaddin/__pycache__/db.cpython-34.pyc
Binary file not shown.
Binary file modified utilities/poolsaddin/__pycache__/ui.cpython-34.pyc
Binary file not shown.

0 comments on commit 9a54a51

Please sign in to comment.