diff --git a/integration/houdini/Conduct.json b/integration/houdini/Conduct.json new file mode 100644 index 0000000..2da8fd8 --- /dev/null +++ b/integration/houdini/Conduct.json @@ -0,0 +1,3 @@ +{ + "hpath" : "$HFS/packages/Conduct" +} diff --git a/integration/houdini/MainMenuCommon.xml b/integration/houdini/MainMenuCommon.xml new file mode 100644 index 0000000..6f56779 --- /dev/null +++ b/integration/houdini/MainMenuCommon.xml @@ -0,0 +1,23 @@ + + + + + + + + + + 0 + + + + + + diff --git a/integration/houdini/README.md b/integration/houdini/README.md new file mode 100644 index 0000000..2dc73b0 --- /dev/null +++ b/integration/houdini/README.md @@ -0,0 +1,3 @@ +# Installation +Place the `Conduct.json` in `Houdini /packages` +Either adjust it's path or place the `MainMenuCommon.xml` file and `scripts` folder into `Houdini /packages/Conduct` diff --git a/integration/houdini/otls/LAGMACHINE.Conduct.hdalc b/integration/houdini/otls/LAGMACHINE.Conduct.hdalc new file mode 100644 index 0000000..fd188bf Binary files /dev/null and b/integration/houdini/otls/LAGMACHINE.Conduct.hdalc differ diff --git a/integration/houdini/scripts/python/ConductPlugin/__init__.py b/integration/houdini/scripts/python/ConductPlugin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/integration/houdini/scripts/python/ConductPlugin/load_asset.py b/integration/houdini/scripts/python/ConductPlugin/load_asset.py new file mode 100644 index 0000000..639ff27 --- /dev/null +++ b/integration/houdini/scripts/python/ConductPlugin/load_asset.py @@ -0,0 +1,2 @@ +def load(): + print("Hello, World!") diff --git a/integration/houdini/scripts/python/ConductPlugin/select_project.py b/integration/houdini/scripts/python/ConductPlugin/select_project.py new file mode 100644 index 0000000..70252a5 --- /dev/null +++ b/integration/houdini/scripts/python/ConductPlugin/select_project.py @@ -0,0 +1,46 @@ +import hou +from . import utils +import os + + +def create_setup(): + path = utils.select_project() + if path == "": + return {'FINISHED'} + path = hou.expandString(path) + + if hou.licenseCategory() != hou.licenseCategoryType.Commercial: + fileExtension = ".hiplc" if hou.licenseCategory( + ) == hou.licenseCategoryType.Indie else ".hipnc" + else: + fileExtension = ".hip" + + conduct = utils.get_conduct_object(path) + + result = conduct.setup(fileExtension) + if result['result'] != 'ok': + return {'FINISHED'} + + data_node = utils.get_conduct_data_node() + + pSelectedParm: hou.Parm = data_node.parm("project_selected") + pSelectedParm.set(True) + + projectParm: hou.Parm = data_node.parm("project") + projectParm.set(path) + + dialog_data = result['data'] + + deptParm: hou.Parm = data_node.parm("department") + deptParm.set(dialog_data['department']) + + assetParm: hou.Parm = data_node.parm("asset") + assetParm.set(dialog_data['asset']) + + shot = dialog_data['shot'] + if shot is not None: + shotParm: hou.Parm = data_node.parm("shot") + shotParm.set(shot) + + setattr(hou.session, "projectImported", True) + hou.hipFile.save(file_name=os.path.join(dialog_data['path'])) diff --git a/integration/houdini/scripts/python/ConductPlugin/utils.py b/integration/houdini/scripts/python/ConductPlugin/utils.py new file mode 100644 index 0000000..3b231b6 --- /dev/null +++ b/integration/houdini/scripts/python/ConductPlugin/utils.py @@ -0,0 +1,38 @@ +import hou +from . import conduct + + +# Not sure about the efficiency +def get_conduct_data_node() -> hou.Node: + all_nodes = hou.node("/obj").allNodes() + data_node = None + for node in all_nodes: + if node.type().name() == "LAGMACHINE::Conduct" and node.name() == "Conduct": + data_node = node + break + + if data_node is None: + data_node: hou.Node = hou.node( + "/obj").createNode("LAGMACHINE::Conduct") + data_node.setName("Conduct") + data_node.setPosition((0, 0)) + + return data_node + + +def get_conduct_object(manifest_path=None) -> conduct.Conduct: + if manifest_path != None: + return conduct.get_from_manifest_path(manifest_path, "houdini") + else: + return conduct.find_from_current_path(hou.hipFile.path(), "houdini") + + +def select_project(): + file_path = hou.ui.selectFile( + start_directory=hou.hipFile.path(), + title="Select a project", + pattern="*.yml,*.yaml", + chooser_mode=hou.fileChooserMode.Read + ) + + return file_path