Skip to content
Permalink
Browse files

Various cleanup and Python 3 compatibility improvements.

  • Loading branch information...
captainhammy committed Jun 29, 2019
1 parent 417f51a commit c5a3ba9c178c07c3137917b097ab72a385a11f6a
Showing with 2,070 additions and 646 deletions.
  1. +1 −0 .coveragerc
  2. +4 −4 bin/houdini_wrapper
  3. +5 −0 bin/run_tests.py
  4. +13 −5 houdini/otls/Sop-cppwrangle.1.otl/com.houdinitoolbox_8_8Sop_1cppwrangle_8_81/PythonCook
  5. +7 −2 houdini/otls/Sop-cppwrangle.1.otl/com.houdinitoolbox_8_8Sop_1cppwrangle_8_81/PythonModule
  6. +18 −20 houdini/pyfilter/ht-pyfilter.py
  7. +2 −1 houdini/scripts/456.py
  8. +3 −2 houdini/scripts/OnCreated.py
  9. +3 −2 houdini/scripts/OnDeleted.py
  10. +3 −2 houdini/scripts/OnInputChanged.py
  11. +3 −2 houdini/scripts/OnInstall.py
  12. +3 −2 houdini/scripts/OnLoaded.py
  13. +3 −2 houdini/scripts/OnNameChanged.py
  14. +3 −2 houdini/scripts/OnUninstall.py
  15. +3 −2 houdini/scripts/OnUpdated.py
  16. +3 −2 houdini/scripts/PostLastDelete.py
  17. +3 −2 houdini/scripts/PreFirstCreate.py
  18. +3 −2 houdini/scripts/SyncNodeVersion.py
  19. +2 −2 houdini/scripts/afterscenesave.py
  20. +2 −1 houdini/scripts/beforescenesave.py
  21. +1 −0 houdini/scripts/externaldragdrop.py
  22. +9 −2 houdini/soho/IFDuserhooks.py
  23. +0 −1 python/ht/argument/__init__.py
  24. +18 −6 python/ht/events/event.py
  25. +13 −14 python/ht/events/events/rop_render.py
  26. +2 −2 python/ht/events/events/scene_load.py
  27. +6 −2 python/ht/events/group.py
  28. +28 −14 python/ht/events/item.py
  29. +13 −9 python/ht/events/manager.py
  30. +28 −20 python/ht/events/stats.py
  31. +0 −1 python/ht/events/types.py
  32. +6 −6 python/ht/geometry/pointcloud.py
  33. +119 −74 python/ht/houdini/package.py
  34. +27 −27 python/ht/inline/api.py
  35. +6 −6 python/ht/inline/utils.py
  36. +203 −0 python/ht/logging/adapters.py
  37. +16 −0 python/ht/logging/shellio.py
  38. +19 −2 python/ht/nodes/naming.py
  39. +3 −1 python/ht/nodes/styles/constants.py
  40. +3 −2 python/ht/nodes/styles/event.py
  41. +20 −20 python/ht/nodes/styles/manager.py
  42. +76 −40 python/ht/nodes/styles/styles.py
  43. +2 −2 python/ht/output/__init__.py
  44. +12 −12 python/ht/pyfilter/manager.py
  45. +25 −25 python/ht/pyfilter/operations/deepimage.py
  46. +16 −16 python/ht/pyfilter/operations/ipoverrides.py
  47. +8 −8 python/ht/pyfilter/operations/logoutput.py
  48. +11 −11 python/ht/pyfilter/operations/operation.py
  49. +9 −9 python/ht/pyfilter/operations/primaryimage.py
  50. +36 −36 python/ht/pyfilter/operations/setproperties.py
  51. +6 −6 python/ht/pyfilter/operations/settilecallback.py
  52. +6 −6 python/ht/pyfilter/operations/zdepth.py
  53. +2 −1 python/ht/pyfilter/property.py
  54. +2 −2 python/ht/pyfilter/utils.py
  55. +109 −48 python/ht/sohohooks/aovs/aov.py
  56. +16 −16 python/ht/sohohooks/aovs/manager.py
  57. +25 −8 python/ht/sohohooks/manager.py
  58. +20 −5 python/ht/ui/aovs/models.py
  59. +1 −0 python/ht/ui/menus/opmenu.py
  60. +2 −1 python/ht/ui/menus/parmmenu.py
  61. +38 −32 python/ht/ui/paste/sources.py
  62. +2 −2 python/ht/ui/paste/utils.py
  63. +1 −1 python/ht/ui/paste/widgets.py
  64. +27 −9 python/ht/utils.py
  65. +13 −12 tests/events/events/test_rop_render.py
  66. +15 −0 tests/events/test_item.py
  67. +2 −2 tests/events/test_manager.py
  68. +2 −2 tests/events/test_stats.py
  69. +341 −0 tests/logging/test_adapters.py
  70. +119 −12 tests/nodes/styles/test_styles.py
  71. +7 −7 tests/pyfilter/operations/test_deepimage.py
  72. +1 −1 tests/pyfilter/operations/test_ipoverrides.py
  73. +5 −4 tests/pyfilter/operations/test_logoutput.py
  74. +1 −1 tests/pyfilter/operations/test_operation.py
  75. +4 −4 tests/pyfilter/operations/test_primaryimage.py
  76. +8 −7 tests/pyfilter/operations/test_setproperties.py
  77. +1 −1 tests/pyfilter/operations/test_settilecallback.py
  78. +1 −1 tests/pyfilter/operations/test_zdepth.py
  79. +6 −6 tests/pyfilter/test_manager.py
  80. +1 −1 tests/pyfilter/test_utils.py
  81. +464 −23 tests/sohohooks/aovs/test_aov.py
@@ -12,6 +12,7 @@ source =
ht.events.events.scene_load
ht.inline.api
ht.inline.utils
ht.logging.adapters
ht.logging.shellio
ht.nodes.styles.event
ht.nodes.styles.styles
@@ -23,7 +23,7 @@ import ht.utils
# =============================================================================

# Signals we want to handle and their names.
SIGNALS = {
_SIGNALS = {
signal.SIGHUP: "HUP",
signal.SIGINT: "INT",
signal.SIGQUIT: "QUIT",
@@ -254,11 +254,11 @@ def _handler(signal_num, current_frame):
:return:
"""
signal_name = SIGNALS[signal_num]
signal_name = _SIGNALS[signal_num]
print "Houdini wrapper caught sig SIG{}".format(signal_name)

# Ignore further signals.
for sig in SIGNALS:
for sig in _SIGNALS:
signal.signal(sig, signal.SIG_DFL)

# Get the current process group id.
@@ -339,7 +339,7 @@ def main():
"""
# Handle specified signals.
for sig in SIGNALS:
for sig in _SIGNALS:
signal.signal(sig, _handler)

parser = _build_parser()
@@ -1,6 +1,8 @@
"""Discover and run unittests, with coverage."""

import coverage
import os
import six
import sys
import unittest

@@ -20,6 +22,9 @@
cov.html_report()
cov.xml_report()

html_path = os.path.join(os.path.realpath(os.path.curdir), "coverage_html_report/index.html")
six.print_("View coverage report at file://{}".format(html_path))

if not result.wasSuccessful():
sys.exit(1)

@@ -1,9 +1,18 @@
# pylint: disable=missing-docstring
"""Cook code for C++ Wrangle SOP."""

# =============================================================================
# IMPORTS
# =============================================================================

# Python Imports
import six

# Houdini Imports
import hou
import hutil.cppinline

# =============================================================================

node = hou.pwd()

# Initialize to None so there is an object name 'lib' around in the case that
@@ -25,10 +34,10 @@ if not node.evalParm("pause_compiling"):
hou.ui.setStatusMessage(msg, hou.severityType.Error)

else:
print msg
six.print_(msg)

if node.evalParm("print_compile_errors"):
print inst
six.print_(inst)

# If there are no function sources
except node.hm().NoFunctionSourcesError:
@@ -43,5 +52,4 @@ if not node.evalParm("pause_compiling"):

# Get and execute the Python code.
code = node.parm("code").unexpandedString()
exec(code) # pylint: disable=exec-used

six.exec_(code)
@@ -1,4 +1,9 @@
# pylint: disable=missing-docstring
"""PythonModule for C++ Wrangle SOP."""

# =============================================================================
# IMPORTS
# =============================================================================

# Python Imports
import ast
import os
@@ -13,7 +18,7 @@ import inlinecpp


# =============================================================================
# INLINECPP CONSTANTS
# GLOBALS
# =============================================================================

_COMMON_INCLUDES = {
@@ -19,11 +19,9 @@
ht.logging.init_config()

from ht.pyfilter.manager import PyFilterManager
from ht.pyfilter.property import get_property

# Houdini Imports
import mantra

logger = logging.getLogger("ht-pyfilter")
_logger = logging.getLogger("ht-pyfilter")


# =============================================================================
@@ -50,7 +48,7 @@ def filterCamera():
don't declare the property explicitly.
"""
logger.debug("filterCamera")
_logger.debug("filterCamera")

_PYFILTER_MANAGER.run_operations_for_stage("filterCamera")

@@ -62,14 +60,14 @@ def filterCameraSegment():
camera motion segment.
"""
logger.debug("filterCameraSegment")
_logger.debug("filterCameraSegment")

_PYFILTER_MANAGER.run_operations_for_stage("filterCameraSegment")


def filterEndRender():
"""Perform actions just after the image has been rendered."""
logger.debug("filterEndRender")
_logger.debug("filterEndRender")

_PYFILTER_MANAGER.run_operations_for_stage("filterEndRender")

@@ -92,7 +90,7 @@ def filterFog():
a fog object. The function can query fog: settings and possibly alter them.
"""
logger.debug("filterFog ({})".format(mantra.property("object:name")[0]))
_logger.debug("filterFog (%s)", get_property("object:name"))

_PYFILTER_MANAGER.run_operations_for_stage("filterFog")

@@ -105,7 +103,7 @@ def filterGeometry():
alter them.
"""
logger.debug("filterGeometry")
_logger.debug("filterGeometry")

_PYFILTER_MANAGER.run_operations_for_stage("filterGeometry")

@@ -118,7 +116,7 @@ def filterInstance():
alter them.
"""
logger.debug("filterInstance ({})".format(mantra.property("object:name")[0]))
_logger.debug("filterInstance (%s)", get_property("object:name"))
_PYFILTER_MANAGER.run_operations_for_stage("filterInstance")


@@ -130,7 +128,7 @@ def filterLight():
them.
"""
logger.debug("filterLight ({})".format(mantra.property("object:name")[0]))
_logger.debug("filterLight (%s)", get_property("object:name"))

_PYFILTER_MANAGER.run_operations_for_stage("filterLight")

@@ -143,39 +141,39 @@ def filterMaterial():
add or change properties on the material.
"""
logger.debug("filterMaterial")
_logger.debug("filterMaterial")

_PYFILTER_MANAGER.run_operations_for_stage("filterMaterial")


def filterOutputAssets(assets):
def filterOutputAssets(assets): # pylint: disable=unused-argument
"""Filter assets generated by Mantra.
Called after the render completes, and is passed a list of assets generated
during the render.
"""
logger.debug("filterOutputAssets")
_logger.debug("filterOutputAssets")

_PYFILTER_MANAGER.run_operations_for_stage("filterOutputAssets")


def filterPlane():
"""Change query and modify image plane properties."""
variable = mantra.property("plane:variable")[0]
channel = mantra.property("plane:channel")[0]
variable = get_property("plane:variable")
channel = get_property("plane:channel")

if variable == channel or channel == "":
logger.debug("filterPlane ({})".format(variable))
_logger.debug("filterPlane (%s)", variable)
else:
logger.debug("filterPlane ({} -> {})".format(variable, channel))
_logger.debug("filterPlane (%s -> %s)", variable, channel)

_PYFILTER_MANAGER.run_operations_for_stage("filterPlane")


def filterQuit():
"""Perform actions just before Mantra quits."""
logger.debug("filterQuit")
_logger.debug("filterQuit")

_PYFILTER_MANAGER.run_operations_for_stage("filterQuit")

@@ -188,7 +186,7 @@ def filterRender():
statistics or validation, it might be useful to have this method available.
"""
logger.debug("filterRender")
_logger.debug("filterRender")

_PYFILTER_MANAGER.run_operations_for_stage("filterRender")

@@ -7,6 +7,7 @@
# Houdini Toolbox Imports
from ht.events import SceneEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================
@@ -15,7 +16,7 @@ def main():
"""Main function."""
run_event(SceneEvents.Load)


# =============================================================================

main()

@@ -7,15 +7,16 @@
# Houdini Toolbox Imports
from ht.events import NodeEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================

def main():
"""Main function."""
run_event(NodeEvents.OnCreated, kwargs) # pylint: disable=undefined-variable
run_event(NodeEvents.OnCreated, kwargs) # pylint: disable=undefined-variable


# =============================================================================

main()

@@ -7,15 +7,16 @@
# Houdini Toolbox Imports
from ht.events import NodeEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================

def main():
"""Main function."""
run_event(NodeEvents.OnDeleted, kwargs) # pylint: disable=undefined-variable
run_event(NodeEvents.OnDeleted, kwargs) # pylint: disable=undefined-variable


# =============================================================================

main()

@@ -7,15 +7,16 @@
# Houdini Toolbox Imports
from ht.events import NodeEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================

def main():
"""Main function."""
run_event(NodeEvents.OnInputChanged, kwargs) # pylint: disable=undefined-variable
run_event(NodeEvents.OnInputChanged, kwargs) # pylint: disable=undefined-variable


# =============================================================================

main()

@@ -7,15 +7,16 @@
# Houdini Toolbox Imports
from ht.events import NodeEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================

def main():
"""Main function."""
run_event(NodeEvents.OnInstall, kwargs) # pylint: disable=undefined-variable
run_event(NodeEvents.OnInstall, kwargs) # pylint: disable=undefined-variable


# =============================================================================

main()

@@ -7,15 +7,16 @@
# Houdini Toolbox Imports
from ht.events import NodeEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================

def main():
"""Main function."""
run_event(NodeEvents.OnLoaded, kwargs) # pylint: disable=undefined-variable
run_event(NodeEvents.OnLoaded, kwargs) # pylint: disable=undefined-variable


# =============================================================================

main()

@@ -7,15 +7,16 @@
# Houdini Toolbox Imports
from ht.events import NodeEvents, run_event


# =============================================================================
# FUNCTIONS
# =============================================================================

def main():
"""Main function."""
run_event(NodeEvents.OnNameChanged, kwargs) # pylint: disable=undefined-variable
run_event(NodeEvents.OnNameChanged, kwargs) # pylint: disable=undefined-variable


# =============================================================================

main()

0 comments on commit c5a3ba9

Please sign in to comment.
You can’t perform that action at this time.