From c85bd30e1b01aa543f8a14a5b03de2a01f8fbcd7 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 16 Jul 2021 12:58:16 +0200 Subject: [PATCH] =?UTF-8?q?hound=20cleanup=20=F0=9F=90=B6=F0=9F=A7=BD?= =?UTF-8?q?=F0=9F=A7=BA=20I.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openpype/hosts/houdini/api/__init__.py | 23 +++++-------- openpype/hosts/houdini/api/usd.py | 3 +- .../plugins/create/create_redshift_rop.py | 2 +- .../plugins/create/create_usd_model.py | 1 - .../plugins/create/create_usd_workspaces.py | 1 - .../hosts/houdini/plugins/load/load_camera.py | 34 +++++++++---------- 6 files changed, 27 insertions(+), 37 deletions(-) diff --git a/openpype/hosts/houdini/api/__init__.py b/openpype/hosts/houdini/api/__init__.py index 8eda4aff26..bb43654fef 100644 --- a/openpype/hosts/houdini/api/__init__.py +++ b/openpype/hosts/houdini/api/__init__.py @@ -6,16 +6,13 @@ import contextlib import hou from pyblish import api as pyblish - from avalon import api as avalon -from avalon.houdini import pipeline as houdini import openpype.hosts.houdini from openpype.hosts.houdini.api import lib from openpype.lib import ( - any_outdated, - update_task_from_path + any_outdated ) from .lib import get_asset_fps @@ -29,6 +26,7 @@ LOAD_PATH = os.path.join(PLUGINS_DIR, "load") CREATE_PATH = os.path.join(PLUGINS_DIR, "create") INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory") + def install(): pyblish.register_plugin_path(PUBLISH_PATH) @@ -36,7 +34,7 @@ def install(): avalon.register_plugin_path(avalon.Creator, CREATE_PATH) log.info("Installing callbacks ... ") - avalon.on("init", on_init) + # avalon.on("init", on_init) avalon.before("save", before_save) avalon.on("save", on_save) avalon.on("open", on_open) @@ -50,11 +48,10 @@ def install(): "review" ] - # Expose Houdini husdoutputprocessors - hou_setup_pythonpath = os.path.join(os.path.dirname(PACKAGE_DIR), - "setup", "houdini", "pythonpath") - print("Adding PYTHONPATH: %s" % hou_setup_pythonpath) - sys.path.append(hou_setup_pythonpath) + # add houdini vendor packages + hou_pythonpath = os.path.join(os.path.dirname(HOST_DIR), "vendor") + + sys.path.append(hou_pythonpath) # Set asset FPS for the empty scene directly after launch of Houdini # so it initializes into the correct scene FPS @@ -69,8 +66,6 @@ def on_save(*args): avalon.logger.info("Running callback on save..") - update_task_from_path(hou.hipFile.path()) - nodes = lib.get_id_required_nodes() for node, new_id in lib.generate_ids(nodes): lib.set_id(node, new_id, overwrite=False) @@ -84,14 +79,12 @@ def on_open(*args): avalon.logger.info("Running callback on open..") - update_task_from_path(hou.hipFile.path()) - # Validate FPS after update_task_from_path to # ensure it is using correct FPS for the asset lib.validate_fps() if any_outdated(): - from ..widgets import popup + from openpype.widgets import popup log.warning("Scene has outdated content.") diff --git a/openpype/hosts/houdini/api/usd.py b/openpype/hosts/houdini/api/usd.py index 545cd3f7a5..48b97bb250 100644 --- a/openpype/hosts/houdini/api/usd.py +++ b/openpype/hosts/houdini/api/usd.py @@ -2,9 +2,8 @@ import contextlib -from avalon import io import logging -from avalon.vendor.Qt import QtCore, QtGui +from Qt import QtCore, QtGui from avalon.tools.widgets import AssetWidget from avalon import style diff --git a/openpype/hosts/houdini/plugins/create/create_redshift_rop.py b/openpype/hosts/houdini/plugins/create/create_redshift_rop.py index b944d592f2..f6e482954d 100644 --- a/openpype/hosts/houdini/plugins/create/create_redshift_rop.py +++ b/openpype/hosts/houdini/plugins/create/create_redshift_rop.py @@ -19,7 +19,7 @@ class CreateRedshiftROP(houdini.Creator): subset_no_prefix = subset[len(self.family):] subset_no_prefix = subset_no_prefix[0].lower() + subset_no_prefix[1:] self.data["subset"] = subset_no_prefix - + # Add chunk size attribute self.data["chunkSize"] = 10 diff --git a/openpype/hosts/houdini/plugins/create/create_usd_model.py b/openpype/hosts/houdini/plugins/create/create_usd_model.py index f4c377e0a8..e412a88c71 100644 --- a/openpype/hosts/houdini/plugins/create/create_usd_model.py +++ b/openpype/hosts/houdini/plugins/create/create_usd_model.py @@ -1,7 +1,6 @@ import re from avalon import api -from avalon.houdini import lib import hou diff --git a/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py b/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py index 87c54c9fb7..906a217c0f 100644 --- a/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py +++ b/openpype/hosts/houdini/plugins/create/create_usd_workspaces.py @@ -1,5 +1,4 @@ from avalon import api -from avalon.houdini import lib import hou diff --git a/openpype/hosts/houdini/plugins/load/load_camera.py b/openpype/hosts/houdini/plugins/load/load_camera.py index ac0e1f0436..0cb17dc7d6 100644 --- a/openpype/hosts/houdini/plugins/load/load_camera.py +++ b/openpype/hosts/houdini/plugins/load/load_camera.py @@ -23,40 +23,40 @@ def transfer_non_default_values(src, dest, ignore=None): """ import hou - src.updateParmStates() + src.updateParmStates() for parm in src.allParms(): - + if ignore and parm.name() in ignore: continue - + # If destination parm does not exist, ignore.. dest_parm = dest.parm(parm.name()) if not dest_parm: continue - + # Ignore values that are currently at default if parm.isAtDefault() and dest_parm.isAtDefault(): continue - + if not parm.isVisible(): # Ignore hidden parameters, assume they # are implementation details continue - + expression = None try: expression = parm.expression() except hou.OperationFailed: # No expression present pass - + if expression is not None and ARCHIVE_EXPRESSION in expression: - # Assume it's part of the automated connections that the Alembic Archive - # makes on loading of the camera and thus we do not want to transfer - # the expression + # Assume it's part of the automated connections that the + # Alembic Archive makes on loading of the camera and thus we do + # not want to transfer the expression continue - + # Ignore folders, separators, etc. ignore_types = { hou.parmTemplateType.Toggle, @@ -68,7 +68,7 @@ def transfer_non_default_values(src, dest, ignore=None): } if parm.parmTemplate().type() in ignore_types: continue - + print("Preserving attribute: %s" % parm.name()) dest_parm.setFromParm(parm) @@ -155,13 +155,13 @@ class CameraLoader(api.Loader): # Apply values to the new camera new_camera = self._get_camera(node) - transfer_non_default_values(temp_camera, + transfer_non_default_values(temp_camera, new_camera, - # The hidden uniform scale attribute - # gets a default connection to "icon_scale" - # just skip that completely + # The hidden uniform scale attribute + # gets a default connection to + # "icon_scale" just skip that completely ignore={"scale"}) - + temp_camera.destroy() def remove(self, container):