Skip to content

Commit

Permalink
Merge pull request #186 from masqu3rad3/hotfix
Browse files Browse the repository at this point in the history
[hotfix] - keeping the backward compatibility for cases where the thumbnail resolution key doesnt exist.
  • Loading branch information
masqu3rad3 authored Jan 3, 2025
2 parents d0ea463 + 22e1f2c commit 3d72256
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
10 changes: 8 additions & 2 deletions tik_manager4/dcc/houdini/hda/nodes/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import tik_manager4

class Callbacks:
# valid_elements = ["alembic", "usd", "usd_lop"]

def __init__(self):
self.valid_elements = ["alembic", "usd", "usd_lop"]
self.tik_m = tik_manager4.initialize("houdini")

def _collect_parameter_values(self, node):
Expand Down Expand Up @@ -359,8 +362,11 @@ def populate_elements(self, node, version_obj=None):
object.
"""
if version_obj:
valid_elements = ["alembic", "usd", "usd_lop"]
elements = [x for x in version_obj.element_types if x in valid_elements]
print("valid_elements")
print("----------------")
print(self.valid_elements)
print("----------------")
elements = [x for x in version_obj.element_types if x in self.valid_elements]
element_names = ";".join(elements)
pass_value = elements[0] if elements else None
else:
Expand Down
35 changes: 35 additions & 0 deletions tik_manager4/dcc/houdini/hda/nodes/lop_texture_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import hou
from tik_manager4.dcc.houdini.hda.nodes import callbacks

class LopTextureImportCallbacks(callbacks.Callbacks):
def __init__(self):
super(LopTextureImportCallbacks, self).__init__()
self.valid_elements = ["texture_bundle"]

def update_path(self, version_obj, element_type):
print("update_path")
print("----------------")
# print(version_obj)
# print(element_type)
# print("----------------")
# hda_node = hou.pwd()
# reference_node = hda_node.node("REFERENCE")
# sublayer_node = hda_node.node("SUBLAYER")
#
# reference_node.parm("filepath1").set("")
# sublayer_node.parm("filepath1").set("")
# # set the switch
#
# parm = hda_node.parm("resolvedPathDisplay")
# parm.lock(False)
# if not all([version_obj, element_type]):
# hda_node.parm("resolvedPathDisplay").set("")
# parm.lock(True)
# return
#
# abs_path = version_obj.get_element_path(element_type, relative=False)
#
# reference_node.parm("filepath1").set(abs_path)
# sublayer_node.parm("filepath1").set(abs_path)
# hda_node.parm("resolvedPathDisplay").set(abs_path)
# parm.lock(True)
7 changes: 4 additions & 3 deletions tik_manager4/objects/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def __init__(self, absolute_path, name=None, path=None, parent_task=None):
self._task_id = None
self._relative_path = path
self._software_version = None
self._thumbnail_resolution = self.guard.preview_settings.get("ThumbnailResolution")

# there are 3 states: working, published, omitted
self._parent_task = None
Expand Down Expand Up @@ -221,7 +220,8 @@ def new_version_from_path(self, file_path, notes=""):

# add it to the versions
extension = Path(output_path).suffix or "Folder"
self._standalone_handler.text_to_image(extension, thumbnail_path, *(self._thumbnail_resolution))
thumbnail_resolution = self.guard.preview_settings.get("ThumbnailResolution", (220, 124))
self._standalone_handler.text_to_image(extension, thumbnail_path, *(thumbnail_resolution))
version_dict = {
"version_number": version_number,
"workstation": socket.gethostname(),
Expand Down Expand Up @@ -300,7 +300,8 @@ def new_version(self, file_format=None, notes="", ignore_checks=True):
# generate thumbnail
# create the thumbnail folder if it doesn't exist
Path(thumbnail_path).parent.mkdir(parents=True, exist_ok=True)
self._dcc_handler.generate_thumbnail(thumbnail_path, *(self._thumbnail_resolution))
thumbnail_resolution = self.guard.preview_settings.get("ThumbnailResolution", (220, 124))
self._dcc_handler.generate_thumbnail(thumbnail_path, *(thumbnail_resolution))

# add it to the versions
is_localized = self.can_localize()
Expand Down

0 comments on commit 3d72256

Please sign in to comment.