Skip to content

Commit

Permalink
Merge pull request #9 from ynput/enhancement/houdini_load_asset_lop_e…
Browse files Browse the repository at this point in the history
…nhance_parms

Houdini: Update ayon_lop_import 1.0 (Expanded HDA)
  • Loading branch information
BigRoy authored Jun 10, 2024
2 parents 8e5e7d5 + 5bab335 commit 5529beb
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 22 deletions.
42 changes: 41 additions & 1 deletion server_addon/houdini/client/ayon_houdini/api/hda_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
get_representation_context,
get_representation_path_from_context
)
from ayon_core.pipeline.context_tools import get_current_project_name
from ayon_core.pipeline.context_tools import (
get_current_project_name,
get_current_folder_path
)

from ayon_houdini.api import lib

Expand Down Expand Up @@ -418,3 +421,40 @@ def keep_background_images_linked(node, old_name):

if changes:
set_background_images(parent, images)


def select_folder_path(node):
"""Show dialog to select folder path.
When triggered it opens a dialog that shows the available
folder paths within a given project.
Note:
This function should be refactored.
It currently shows the available
folder paths within the current project only.
Args:
node (hou.OpNode): The HDA node.
"""
from ayon_core.tools.publisher.widgets.folders_dialog import FoldersDialog
from ayon_core.tools.utils.host_tools import get_tool_by_name

main_window = lib.get_main_window()
publisher_window = get_tool_by_name( tool_name="publisher", parent=main_window)

# TODO: A dedicated Dialog should be implement using `SimpleFoldersWidget`.
# we should avoid using `FoldersDialog` because It's highly recommend to
# never use inner widgets of any tool...
# Note: The following dialog doesn't support changing `the project_name`
# But, having a semi-functional dialog is better than nothing.
dialog = FoldersDialog(publisher_window.controller, main_window)
dialog.exec_()

selected_folder_path = dialog.get_selected_folder_path()

if not selected_folder_path or \
selected_folder_path == get_current_folder_path():
selected_folder_path = '$AYON_FOLDER_PATH'

node.parm("folder_path").set(selected_folder_path)
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ Label: AYON Load Asset
Path: oplib:/ayon::Lop/lop_import::1.0?ayon::Lop/lop_import::1.0
Icon: opdef:/ayon::Lop/lop_import::1.0?IconImage
Table: Lop
License:
Extra:
User:
License:
Extra:
User:
Inputs: 0 to 1
Subnet: true
Python: false
Empty: false
Modified: Thu Jun 6 01:31:52 2024

Modified: Thu Jun 10 16:44:00 2024
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Content-Disposition: attachment; filename="hdaroot.def"
Content-Type: text/plain

comment ""
position -8.53722 4.22263
position -1.67827 1.26636
connectornextid 0
flags = lock off model off template off footprint off xray off bypass off display off render off highlight off unload off savedata off compress on colordefault on exposed on debug off
flags = lock off model off template off footprint off xray off bypass off display on render on highlight off unload off savedata off compress on colordefault on exposed on debug off
outputsNamed3
{
}
Expand All @@ -35,10 +35,10 @@ stat
{
create -1
modify -1
author User@HP-Z820-03
author Mustafa_Taher@Major-Kalawy
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end
Expand Down Expand Up @@ -98,7 +98,7 @@ stat
author Maqina-05@Maqina-05
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end
Expand Down Expand Up @@ -158,7 +158,7 @@ stat
author Maqina-05@Maqina-05
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end
Expand Down Expand Up @@ -324,7 +324,7 @@ stat
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
label "Folder Path"
type string
default { "$AYON_FOLDER_PATH" }
parmtag { "script_action" "from ayon_houdini.api.hda_utils import select_folder_path;select_folder_path(kwargs['node'])" }
parmtag { "script_action_icon" "BUTTONS_reselect" }
parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"OnDeleted/Cursor":{
"type":"intarray",
"value":[2,1]
"value":[1,15]
},
"OnDeleted/IsExpr":{
"type":"bool",
Expand Down Expand Up @@ -81,7 +81,7 @@
},
"OnNameChanged/Cursor":{
"type":"intarray",
"value":[4,1]
"value":[1,15]
},
"OnNameChanged/IsExpr":{
"type":"bool",
Expand All @@ -101,7 +101,7 @@
},
"PythonModule/Cursor":{
"type":"intarray",
"value":[1,18]
"value":[10,1]
},
"PythonModule/IsExpr":{
"type":"bool",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
warn_no_representation_set reference
warn_no_representation_set reference
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node = kwargs["node"]
hda_module = node.hdaModule()
hda_module.setup_flag_changed_callback(node)

node.parm("file").lock(True)
node.parm("file").lock(True)
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ from ayon_houdini.api.lib import remove_all_thumbnails

# Clear thumbnails
node = kwargs["node"]
remove_all_thumbnails(node)
remove_all_thumbnails(node)
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ def on_duplicate():

if not hou.hipFile.isLoadingHipFile():
on_duplicate()

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ from ayon_houdini.api.hda_utils import (

node = kwargs["node"]
old_name = kwargs["old_name"]
keep_background_images_linked(node, old_name)
keep_background_images_linked(node, old_name)
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ a single file. -->
loptoolutils.genericTool(kwargs, '$HDA_NAME')]]></script>
</tool>
</shelfDocument>

0 comments on commit 5529beb

Please sign in to comment.