Skip to content

Commit

Permalink
Merge pull request #56 from BigRoy/enhancement/lop_load_shot
Browse files Browse the repository at this point in the history
Add Load Shot LOP and Mute Layers LOP
BigRoy authored Jul 30, 2024
2 parents 56591e9 + 3d22215 commit f44a054
Showing 43 changed files with 1,575 additions and 0 deletions.
52 changes: 52 additions & 0 deletions client/ayon_houdini/plugins/load/load_shot_lop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from ayon_core.pipeline import load
from ayon_houdini.api.lib import find_active_network

import hou


class LOPLoadShotLoader(load.LoaderPlugin):
"""Load sublayer into Solaris using AYON Load Shot LOP"""

product_types = {"*"}
label = "Load Shot (LOPs)"
representations = ["usd", "abc", "usda", "usdc"]
order = -10
icon = "code-fork"
color = "orange"

def load(self, context, name=None, namespace=None, data=None):

# Define node name
namespace = namespace if namespace else context["folder"]["name"]
node_name = "{}_{}".format(namespace, name) if namespace else name

# Create node
network = find_active_network(
category=hou.lopNodeTypeCategory(),
default="/stage"
)
node = network.createNode("ayon::load_shot", node_name=node_name)
node.moveToGoodPosition()

# Set representation id
parm = node.parm("representation")
parm.set(context["representation"]["id"])
parm.pressButton() # trigger callbacks

nodes = [node]
self[:] = nodes

def update(self, container, context):
node = container["node"]

# Set representation id
parm = node.parm("representation")
parm.set(context["representation"]["id"])
parm.pressButton() # trigger callbacks

def remove(self, container):
node = container["node"]
node.destroy()

def switch(self, container, context):
self.update(container, context)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Operator: ayon::load_shot::1.0
Label: AYON Load Shot
Path: oplib:/ayon::Lop/load_shot::1.0?ayon::Lop/load_shot::1.0
Icon: opdef:/ayon::Lop/load_shot::1.0?IconImage
Table: Lop
License:
Extra:
User:
Inputs: 0 to 1
Subnet: true
Python: false
Empty: false
Modified: Thu Jul 4 00:43:25 2024

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
""
INDEX__SECTION INDEX_SECTION
houdini.hdalibrary houdini.hdalibrary
ayon_8_8Lop_1load__shot_8_81.0 ayon::Lop/load_shot::1.0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hdaroot/sublayer.def":1720045839,
"hdaroot/warn_no_representation_set.def":1708980551,
"hdaroot/output0.def":1698215383,
"hdaroot.def":1720046536
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"values":["20.0.724"
],
"indexes":{
"hdaroot/sublayer.userdata":0,
"hdaroot/warn_no_representation_set.userdata":0,
"hdaroot/output0.userdata":0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY"

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="node_type"
Content-Type: text/plain

Lop

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.init"
Content-Type: text/plain

type = ayon::load_shot::1.0
matchesdef = 0

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.def"
Content-Type: text/plain

comment ""
position -3.46569 1.07549
connectornextid 1
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
outputsNamed3
{
0 "output1"
}
inputsNamed3
{
}
inputs
{
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":""
},
"nodeshape":{
"type":"string",
"value":"bulge_down"
},
"wirestyle":{
"type":"string",
"value":"rounded"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.inp"
Content-Type: text/plain

1
0 -1.3044269152357999 6.2635205889365251 2 0 __NO_OWNER_NETWORK_BOX__ "FROMOUTPUT"

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.init"
Content-Type: text/plain

type = output
matchesdef = 1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.def"
Content-Type: text/plain

comment ""
position -1.13898e-08 2.03328
connectornextid 1
flags = lock off model off template off footprint off xray off bypass off display off render on highlight off unload off savedata off compress on colordefault on exposed on debug off
outputsNamed3
{
}
inputsNamed3
{
0 sublayer 1 1 "input1"
}
inputs
{
0 sublayer 0 1
}
stat
{
create -1
modify -1
author Maqina-05@Maqina-05
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.parm"
Content-Type: text/plain

{
version 0.8
outputidx [ 0 locks=0 ] ( 0 )
modifiedprims [ 0 locks=0 ] ( "`lopinputprims(\".\", 0)`" )
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":"___EXTERNAL___"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/warn_no_representation_set.init"
Content-Type: text/plain

type = error
matchesdef = 1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/warn_no_representation_set.def"
Content-Type: text/plain

comment ""
position -1.13898e-08 5.20999
connectornextid 2
flags = lock off model off template off footprint off xray off bypass off display on render off highlight off unload off savedata off compress on colordefault on exposed on debug off
outputsNamed3
{
1 "output1"
}
inputsNamed3
{
0 (0) "" 1 "input1"
}
inputs
{
0 (0) 0 1
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/warn_no_representation_set.chn"
Content-Type: text/plain

{
channel enable1 {
lefttype = extend
righttype = extend
flags = 0
start = 39.800000000000004
segment { length = 0 expr = "if(ch(\"../representation\"), 0, 1)" }
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/warn_no_representation_set.parm"
Content-Type: text/plain

{
version 0.8
numerror [ 0 locks=0 ] ( 1 )
errormsg1 [ 0 locks=0 ] ( `chs(\"../load_message\")` )
severity1 [ 0 locks=0 ] ( "warn" )
enable1 [ 0 locks=0 ] ( [ enable1 0 ] )
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/warn_no_representation_set.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":"___EXTERNAL___"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/sublayer.init"
Content-Type: text/plain

type = sublayer
matchesdef = 1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/sublayer.def"
Content-Type: text/plain

comment ""
position -0.00125004 4.03316
connectornextid 2
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
outputsNamed3
{
1 "output1"
}
inputsNamed3
{
0 warn_no_representation_set 1 1 "input1"
}
inputs
{
0 warn_no_representation_set 0 1
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/sublayer.chn"
Content-Type: text/plain

{
channel reload {
lefttype = extend
righttype = extend
flags = 0
start = 40
segment { length = 0 expr = ch(\"../reload\") }
}
channel mute1 {
lefttype = extend
righttype = extend
flags = 0
start = 40
segment { length = 0 expr = ch(\"../mute1\") }
}
channel timeoffset1 {
lefttype = extend
righttype = extend
flags = 0
start = 40
segment { length = 0 expr = ch(\"../timeoffset1\") }
}
channel timescale1 {
lefttype = extend
righttype = extend
default = 1
flags = 0
start = 40
segment { length = 0 value = 1 1 expr = ch(\"../timescale1\") }
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/sublayer.parm"
Content-Type: text/plain

{
version 0.8
parentlayer_group [ 0 locks=0 ] ( 0 )
loadpayloads [ 0 locks=0 ] ( "on" )
setstagemetadata [ 0 locks=0 ] ( auto )
editrootlayer [ 0 locks=0 ] ( "on" )
findsublayers [ 0 locks=0 ] ( "" )
removefoundsublayers [ 0 locks=0 ] ( "on" )
composition_group [ 0 locks=0 ] ( 0 )
sublayertype [ 0 locks=0 ] ( filesandinputs )
handlemissingfiles [ 0 locks=0 ] ( error )
positiontype [ 0 locks=0 ] ( strongest )
positionindex [ 0 locks=0 ] ( 0 )
files_separator [ 0 locks=0 ] ( )
num_files [ 0 locks=0 ] ( 1 )
reload [ 0 locks=0 ] ( [ reload 0 ] )
inputs_separator [ 0 locks=0 ] ( )
enable [ 0 locks=0 ] ( "on" )
sublayerfile_group1 [ 0 locks=0 ] ( 1 )
enable1 [ 0 locks=0 ] ( "on" )
filepath1 [ 0 locks=0 ] ( `chs(\"../file\")` )
mute1 [ 0 locks=0 ] ( [ mute1 0 ] )
timeoffset1 [ 0 locks=0 ] ( [ timeoffset1 0 ] )
timescale1 [ 0 locks=0 ] ( [ timescale1 1 ] )
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/sublayer.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":"___EXTERNAL___"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.order"
Content-Type: text/plain

3
output0
warn_no_representation_set
sublayer

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.net"
Content-Type: text/plain

1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY--
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hdaroot/sublayer.def":1720045978,
"hdaroot/warn_no_representation_set.def":1720045871,
"hdaroot/output0.def":1720045871,
"hdaroot.def":1720046571
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
""
Contents.mime Contents.mime
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Automatically generated script
\set noalias = 1
#
# Creation script for ayon::load_shot::1.0 operator
#

if ( "$arg1" == "" ) then
echo This script is intended as a creation script
exit
endif

# Node $arg1 (ayon::Lop/load_shot::1.0)
opexprlanguage -s hscript $arg1
opuserdata -n '___Version___' -v '' $arg1
opuserdata -n 'nodeshape' -v 'bulge_down' $arg1
opuserdata -n 'wirestyle' -v 'rounded' $arg1
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
# Dialog script for ayon::load_shot::1.0 automatically generated

{
name ayon::load_shot::1.0
script load_asset::1.0
label "AYON Load Shot"

help {
""
}

inputlabel 1 "Input Stage"
inputlabel 2 "Input 2"
inputlabel 3 "Input 3"
inputlabel 4 "Input 4"

groupsimple {
name "info2"
label "Info"
parmtag { "script_callback" "hou.phm().refresh_available_versions(kwargs['node'])" }
parmtag { "script_callback_language" "python" }

parm {
name "assetinfo_labelparm"
label "Heading"
type label
default { "Choose Product" }
parmtag { "sidefx::look" "heading" }
}
parm {
name "project_name"
label "Project"
type string
default { "$AYON_PROJECT_NAME" }
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" }
}
parm {
name "folder_path"
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" }
}
parm {
name "product_name"
label "Product"
type string
default { "usdShot" }
parmtag { "script_action" "from ayon_houdini.api.hda_utils import select_product_name;select_product_name(kwargs['node'])" }
parmtag { "script_action_icon" "BUTTONS_reselect" }
parmtag { "script_callback" "hou.phm().set_to_latest_version(kwargs['node'])\nhou.phm().on_representation_parms_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "version"
label "Version"
type string
default { "" }
disablewhen "{ representation_old == \"\" }"
menureplace {
[ "versions = hou.phm().get_available_versions(kwargs['node'])" ]
[ "" ]
[ "result = []" ]
[ "for version in versions:" ]
[ " result.append(str(version))" ]
[ " result.append(f\"v{version:03d}\")" ]
[ " " ]
[ "return result" ]
language python
}
parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "representation_name"
label "Representation"
type string
default { "usd" }
parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "load_refresh"
label "Refresh"
type button
joinnext
default { "0" }
help "Click to refresh and retry applying the product load parameters to load the correct file"
parmtag { "button_icon" "" }
parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "load_message"
label "Message"
type label
default { "" }
hidewhen "{ load_message == \"\" }"
parmtag { "sidefx::look" "block" }
}
parm {
name "sepparm"
label "Separator"
type separator
default { "" }
}
parm {
name "reload"
label "Reload Files"
type button
default { "0" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
parm {
name "file"
label "File"
type string
default { "" }
parmtag { "script_callback_language" "python" }
}
groupcollapsible {
name "extra_options"
label "Load Options"

parm {
name "mute1"
label "Mute Layer"
type toggle
default { "off" }
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
parm {
name "timeoffset1"
label "Time Offset (in Frames)"
type float
default { "0" }
range { -100 100 }
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
parm {
name "timescale1"
label "Time Scale"
type float
default { "1" }
range { 0 5 }
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
}

}

groupcollapsible {
name "info_display2"
label "Info Display"

parm {
name "show_thumbnail"
label "Show Entity Thumbnail"
type toggle
joinnext
default { "0" }
parmtag { "script_callback" "hou.phm().on_thumbnail_show_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "thumbnail_size"
label "Size"
type float
joinnext
default { "2" }
hidewhen "{ show_thumbnail == 0 }"
range { 0 10 }
parmtag { "script_callback" "hou.phm().on_thumbnail_size_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "thumbnail_cache_dir"
label "Thumbnail Cache Dir"
type directory
invisible
default { "$JOB/.houdini_loader_thumbnails" }
parmtag { "script_callback_language" "python" }
}
parm {
name "thumbnail_padding"
label "Padding"
type float
invisible
default { "1" }
range { 0 10 }
parmtag { "script_callback_language" "python" }
}
parm {
name "thumbnail_offset"
label "Offset"
type vector2
size 2
default { "0" "0.35" }
hidewhen "{ show_thumbnail == 0 }"
range { -1 1 }
parmtag { "script_callback" "hou.phm().on_thumbnail_size_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "show_pipeline_parms"
label "Show Pipeline Parms"
type toggle
default { "0" }
parmtag { "script_callback" "hou.phm().on_thumbnail_show_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
}

group {
name "ayon_folder0"
label "Ayon"
hidewhen "{ show_pipeline_parms == 0 }"

parm {
name "name"
label "Name"
type label
default { "$OS" }
}
parm {
name "namespace"
label "Namespace"
type label
default { "`opfullpath(\".\")`" }
}
parm {
name "loader"
label "Loader"
type label
default { "LOPLoadShotLoader" }
}
parm {
name "id"
label "ID"
type label
default { "pyblish.avalon.container" }
}
parm {
name "representation"
label "Representation ID"
type string
default { "" }
parmtag { "script_callback" "hou.phm().on_representation_id_changed(kwargs['node'])" }
parmtag { "script_callback_language" "python" }
}
parm {
name "version_name"
label "Current Version Label"
type label
invisible
default { "" }
}
parm {
name "subset_name"
label "Subset (backwards compatibility)"
type label
invisible
default { "`chs(\"product_name\")`" }
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"AYON_icon.png/Cursor":{
"type":"intarray",
"value":[0,0]
},
"AYON_icon.png/IsExpr":{
"type":"bool",
"value":false
},
"AYON_icon.png/IsPython":{
"type":"bool",
"value":false
},
"AYON_icon.png/IsScript":{
"type":"bool",
"value":false
},
"AYON_icon.png/Source":{
"type":"string",
"value":"AYON_icon.png"
},
"OnCreated/Cursor":{
"type":"intarray",
"value":[5,29]
},
"OnCreated/IsExpr":{
"type":"bool",
"value":false
},
"OnCreated/IsPython":{
"type":"bool",
"value":true
},
"OnCreated/IsScript":{
"type":"bool",
"value":true
},
"OnCreated/Source":{
"type":"string",
"value":""
},
"OnDeleted/Cursor":{
"type":"intarray",
"value":[1,15]
},
"OnDeleted/IsExpr":{
"type":"bool",
"value":false
},
"OnDeleted/IsPython":{
"type":"bool",
"value":true
},
"OnDeleted/IsScript":{
"type":"bool",
"value":true
},
"OnDeleted/Source":{
"type":"string",
"value":""
},
"OnLoaded/Cursor":{
"type":"intarray",
"value":[9,76]
},
"OnLoaded/IsExpr":{
"type":"bool",
"value":false
},
"OnLoaded/IsPython":{
"type":"bool",
"value":true
},
"OnLoaded/IsScript":{
"type":"bool",
"value":true
},
"OnLoaded/Source":{
"type":"string",
"value":""
},
"OnNameChanged/Cursor":{
"type":"intarray",
"value":[1,15]
},
"OnNameChanged/IsExpr":{
"type":"bool",
"value":false
},
"OnNameChanged/IsPython":{
"type":"bool",
"value":true
},
"OnNameChanged/IsScript":{
"type":"bool",
"value":true
},
"OnNameChanged/Source":{
"type":"string",
"value":""
},
"PythonModule/Cursor":{
"type":"intarray",
"value":[10,1]
},
"PythonModule/IsExpr":{
"type":"bool",
"value":false
},
"PythonModule/IsPython":{
"type":"bool",
"value":true
},
"PythonModule/IsScript":{
"type":"bool",
"value":true
},
"PythonModule/Source":{
"type":"string",
"value":""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
= AYON Load Shot =

#icon: opdef:/ayon::Lop/load_shot::1.0?AYON_icon.png

"""Sublayers a USD file, usually a shot."""

== Overview ==

*Sublayers* a USD file into the current stage, by default targeting the root layer stack.

@related

* [Node:lop/sublayer]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"nodeconntype":{
"type":"bool",
"value":false
},
"nodeparmtype":{
"type":"bool",
"value":false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
warn_no_representation_set sublayer
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node = kwargs["node"]
hda_module = node.hdaModule()
hda_module.setup_flag_changed_callback(node)

node.parm("file").lock(True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ayon_houdini.api.lib import remove_all_thumbnails


# Clear thumbnails
node = kwargs["node"]
remove_all_thumbnails(node)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node = kwargs["node"]
hda_module = node.hdaModule()
hda_module.setup_flag_changed_callback(node)


# Duplicate callback
def on_duplicate():
"""Duplicate thumbnail on node duplicate"""
if node.evalParm("show_thumbnail") and node.evalParm("representation"):
hda_module.on_representation_id_changed(node)


if not hou.hipFile.isLoadingHipFile():
on_duplicate()
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from ayon_houdini.api.hda_utils import (
keep_background_images_linked
)


node = kwargs["node"]
old_name = kwargs["old_name"]
keep_background_images_linked(node, old_name)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from ayon_houdini.api.hda_utils import (
on_thumbnail_show_changed,
on_thumbnail_size_changed,
on_representation_id_changed,
on_representation_parms_changed,
setup_flag_changed_callback,
get_available_versions,
select_product_name,
set_to_latest_version
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
""
DialogScript DialogScript
CreateScript CreateScript
InternalFileOptions InternalFileOptions
Contents.gz Contents.gz
TypePropertiesOptions TypePropertiesOptions
Tools.shelf Tools.shelf
Help Help
IconImage IconImage
MessageNodes MessageNodes
PythonModule PythonModule
OnDeleted OnDeleted
OnNameChanged OnNameChanged
OnLoaded OnLoaded
OnCreated OnCreated
ExtraFileOptions ExtraFileOptions
AYON__icon.png AYON_icon.png
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<shelfDocument>
<!-- This file contains definitions of shelves, toolbars, and tools.
It should not be hand-edited when it is being used by the application.
Note, that two definitions of the same element are not allowed in
a single file. -->
<tool name="$HDA_DEFAULT_TOOL" label="$HDA_LABEL" icon="$HDA_ICON">
<toolMenuContext name="viewer">
<contextNetType>LOP</contextNetType>
</toolMenuContext>
<toolMenuContext name="network">
<contextOpType>$HDA_TABLE_AND_NAME</contextOpType>
</toolMenuContext>
<toolSubmenu>AYON</toolSubmenu>
<script scriptType="python"><![CDATA[import loptoolutils
loptoolutils.genericTool(kwargs, '$HDA_NAME')]]></script>
</tool>
</shelfDocument>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CheckExternal := 1;
ContentsCompressionType := 1;
ForbidOutsideParms := 1;
GzipContents := 1;
LockContents := 1;
MakeDefault := 1;
ParmsFromVfl := 0;
PrefixDroppedParmLabel := 0;
PrefixDroppedParmName := 0;
SaveCachedCode := 0;
SaveIcon := 1;
SaveSpareParms := 0;
UnlockOnCreate := 0;
UseDSParms := 1;
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Operator: ayon::mute_layers::1.0
Label: AYON Mute Layers
Path: oplib:/ayon::Lop/mute_layers::1.0?ayon::Lop/mute_layers::1.0
Icon: opdef:/ayon::Lop/mute_layers::1.0?IconImage
Table: Lop
License:
Extra:
User:
Inputs: 1 to 1
Subnet: true
Python: false
Empty: false
Modified: Mon Jul 29 22:47:28 2024

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
""
INDEX__SECTION INDEX_SECTION
houdini.hdalibrary houdini.hdalibrary
ayon_8_8Lop_1mute__layers_8_81.0 ayon::Lop/mute_layers::1.0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hdaroot/mute_layers.def":1708351767,
"hdaroot/get_layers.def":1708351772,
"hdaroot/output0.def":1708352522,
"hdaroot.def":1722285625
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"values":["20.0.724"
],
"indexes":{
"hdaroot/mute_layers.userdata":0,
"hdaroot/get_layers.userdata":0,
"hdaroot/output0.userdata":0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,352 @@
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY"

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="node_type"
Content-Type: text/plain

Lop

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.init"
Content-Type: text/plain

type = ayon::mute_layers::1.0
matchesdef = 0

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.def"
Content-Type: text/plain

comment ""
position -3.1669 0.213108
connectornextid 1
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
{
}
inputsNamed3
{
0 mute_layers1 1 1 "input1"
}
inputs
{
0 mute_layers1 0 1
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":""
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.inp"
Content-Type: text/plain

1
0 0 6 2 0 __NO_OWNER_NETWORK_BOX__ "FROMOUTPUT"

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.init"
Content-Type: text/plain

type = output
matchesdef = 1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.def"
Content-Type: text/plain

comment ""
position -1.11759e-08 1.39456
connectornextid 1
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
{
}
inputsNamed3
{
0 mute_layers 1 1 "input1"
}
inputs
{
0 mute_layers 0 1
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.parm"
Content-Type: text/plain

{
version 0.8
outputidx [ 0 locks=0 ] ( 0 )
modifiedprims [ 0 locks=0 ] ( "`lopinputprims(\".\", 0)`" )
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/output0.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":"___EXTERNAL___"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/get_layers.init"
Content-Type: text/plain

type = pythonscript
matchesdef = 1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/get_layers.def"
Content-Type: text/plain

comment ""
position -1.11759e-08 4.9334
connectornextid 2
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
outputsNamed3
{
1 "output1"
}
inputsNamed3
{
0 (0) "" 1 "input1"
}
inputs
{
0 (0) 0 1
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/get_layers.parm"
Content-Type: text/plain

{
version 0.8
python [ 0 locks=0 ] ( "import os
from typing import List


def get_paths(
layers: List[str],
pattern: str,
case_sensitive: bool) -> list[str]:
\"\"\"Return matching filepaths used by composed Usd.Stage that match the `pattern`.\"\"\"

if not pattern or not layers:
return []

paths = []
for layer_identifier in layers:
identifier = layer_identifier

# Ignore identifiers that are not a file
path = identifier.split(\":SDF_FORMAT_ARGS:\")[0]

if not os.path.exists(path):
continue

if not hou.text.patternMatch(
pattern,
path,
ignore_case=not case_sensitive,
path_match=True):
continue

paths.append(identifier)

return paths

node = hou.pwd()
parent_node = node.parent()
stage = node.editableStage()
layers = [layer.identifier for layer in stage.GetUsedLayers()]
pattern = parent_node.evalParm(\"mute_pattern\")
case_sensitive = parent_node.evalParm(\"casesensitive\")

# Get mute paths
mute_paths = get_paths(layers, pattern, case_sensitive)

# Get unmute paths (only if needed)
unmute_paths = []
if parent_node.evalParm(\"editmute\") == \"addremove\":
muted_layers = stage.GetMutedLayers()
unmute_pattern = parent_node.evalParm(\"unmute_pattern\")
unmute_paths = get_paths(muted_layers, unmute_pattern, case_sensitive)

for parm_name, parm_paths in {
\"mutepaths\": mute_paths,
\"unmutepaths\": unmute_paths
}.items():

# Update mute layers value on next node
parm = parent_node.parm(parm_name)
parm.lock(False)
parm.set(\"\\n\".join(parm_paths))
parm.lock(True)" )
maintainstate [ 0 locks=0 ] ( "off" )
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/get_layers.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":"___EXTERNAL___"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/mute_layers.init"
Content-Type: text/plain

type = configurestage
matchesdef = 1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/mute_layers.def"
Content-Type: text/plain

comment ""
position -1.11759e-08 2.47375
connectornextid 2
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
outputsNamed3
{
1 "output1"
}
inputsNamed3
{
0 get_layers 1 1 "input1"
}
inputs
{
0 get_layers 0 1
}
stat
{
create -1
modify -1
author User@HP-Z820-03
access 0777
}
color UT_Color RGB 0.8 0.8 0.8
delscript ""
exprlanguage hscript
end

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/mute_layers.chn"
Content-Type: text/plain

{
channel editmute {
lefttype = extend
righttype = extend
defaultString = \"set\"
flags = 0
start = 40
segment { length = 0 expr = chs(\"../editmute\") }
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/mute_layers.parm"
Content-Type: text/plain

{
version 0.8
editpopulate [ 0 locks=0 ] ( nochange )
populatepattern [ 0 locks=0 ] ( "" )
unpopulatepattern [ 0 locks=0 ] ( "" )
populatepaths [ 0 locks=0 ] ( "" )
unpopulatepaths [ 0 locks=0 ] ( "" )
separator_load [ 0 locks=0 ] ( )
editload [ 0 locks=0 ] ( nochange )
loadpattern [ 0 locks=0 ] ( "" )
unloadpattern [ 0 locks=0 ] ( "" )
loadpaths [ 0 locks=0 ] ( "" )
unloadpaths [ 0 locks=0 ] ( "" )
separator_mute [ 0 locks=0 ] ( )
editmute [ 0 locks=0 ] ( [ editmute nochange ] )
mutepaths [ 8 locks=0 ] ( `chs(\"../mutepaths\")` )
unmutepaths [ 0 locks=0 ] ( `chs(\"../unmutepaths\")` )
separator_resolver [ 0 locks=0 ] ( )
resolvercontextassetpath [ 0 locks=0 ] ( "" )
resolvercontextstringcount [ 0 locks=0 ] ( 0 )
variantselectioncount [ 0 locks=0 ] ( 0 )
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot/mute_layers.userdata"
Content-Type: text/plain

{
"___Version___":{
"type":"string",
"value":"___EXTERNAL___"
}
}

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.order"
Content-Type: text/plain

3
output0
get_layers
mute_layers

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY
Content-Disposition: attachment; filename="hdaroot.net"
Content-Type: text/plain

1

--HOUDINIMIMEBOUNDARY0xD3ADD339-0x00000F49-0x56B122C9-0x00000001HOUDINIMIMEBOUNDARY--
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hdaroot/mute_layers.def":1722285992,
"hdaroot/get_layers.def":1722286006,
"hdaroot/output0.def":1722285928,
"hdaroot.def":1722286039
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
""
Contents.mime Contents.mime
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Automatically generated script
\set noalias = 1
#
# Creation script for ayon::mute_layers::1.0 operator
#

if ( "$arg1" == "" ) then
echo This script is intended as a creation script
exit
endif

# Node $arg1 (ayon::Lop/mute_layers::1.0)
opexprlanguage -s hscript $arg1
opuserdata -n '___Version___' -v '' $arg1
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Dialog script for ayon::mute_layers::1.0 automatically generated

{
name ayon::mute_layers::1.0
script cb::mute_layers::1.0
label "AYON Mute Layers"

help {
""
}

inputlabel 1 "Input Stage"
inputlabel 2 "Input 2"
inputlabel 3 "Input 3"
inputlabel 4 "Input 4"

parm {
name "editmute"
label "Mute Layers"
type string
default { "set" }
menu {
"addremove" "Add and remove layers to mute"
"set" "Set layers to mute"
"setnone" "Unmute all layers"
}
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_action" "from scenegraphlayers import panelutils\npanelutils.openPanelForConfigureStageNode(kwargs['node'])" }
parmtag { "script_action_help" "Select layers to mute." }
parmtag { "script_action_icon" "BUTTONS_reselect" }
parmtag { "sidefx::usdpathtype" "primlist" }
}
parm {
name "mute_pattern"
label "Mute Pattern"
type string
default { "" }
help "Match any pattern within a filepath using wildcards to mute for."
hidewhen "{ editmute == setnone }"
menutoggle {
"*usdAsset_model*" "Asset Model Layer"
"*usdAsset_look*" "Asset Look Layer"
"*usdAsset_groom*" "Asset Groom Layer"
"*usdShot_animation*" "Shot Animation Layer"
"*usdShot_fx*" "Shot FX Layer"
"*usdShot_lighting*" "Shot Lighting Layer"
}
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
parm {
name "unmute_pattern"
label "Unmute Pattern"
type string
default { "" }
help "Match any pattern within a filepath using wildcards to mute for."
hidewhen "{ editmute != addremove }"
menutoggle {
"*usdAsset_model*" "Asset Model Layer"
"*usdAsset_look*" "Asset Look Layer"
"*usdAsset_groom*" "Asset Groom Layer"
"*usdShot_animation*" "Shot Animation Layer"
"*usdShot_fx*" "Shot FX Layer"
"*usdShot_lighting*" "Shot Lighting Layer"
}
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
parm {
name "casesensitive"
label "Case Sensitive"
type toggle
default { "off" }
help "Whether the pattern should match case-sensitive or not"
hidewhen "{ editmute == setnone }"
parmtag { "autoscope" "0000000000000000" }
parmtag { "script_callback_language" "python" }
}
groupcollapsible {
name "muted_results"
label "Muted Results"
hidewhen "{ editmute == setnone }"

parm {
name "mutepaths"
label "Muted Paths"
type string
default { "" }
help "The filepaths/layers that were targeted by the pattern"
hidewhen "{ editmute == setnone }"
parmtag { "editor" "1" }
parmtag { "editorlines" "5-10" }
parmtag { "script_callback_language" "python" }
}
parm {
name "unmutepaths"
label "Unmuted Paths"
type string
default { "" }
help "The filepaths/layers that were targeted by the pattern"
hidewhen "{ editmute != addremove }"
parmtag { "editor" "1" }
parmtag { "editorlines" "5-10" }
parmtag { "script_callback_language" "python" }
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"AYON_icon.png/Cursor":{
"type":"intarray",
"value":[0,0]
},
"AYON_icon.png/IsExpr":{
"type":"bool",
"value":false
},
"AYON_icon.png/IsPython":{
"type":"bool",
"value":false
},
"AYON_icon.png/IsScript":{
"type":"bool",
"value":false
},
"AYON_icon.png/Source":{
"type":"string",
"value":"AYON_icon.png"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
= AYON Mute Layers =

#icon: opdef:/ayon::Lop/mute_layers::1.0?AYON_icon.png

"""Mute USD layers by wildcard path matching."""

== Overview ==

Sets used USD layers in the stage to be Muted downstream.

For example using `*usdAsset_look*` this can ensure to mute all look related layers, or `*usdShot_lighting*` to do the same for lighting.

The `pattern` parameter has a drop-down to easily set or disable often used presets.

@parameters


@related

* [Node:lop/configurestage]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"nodeconntype":{
"type":"bool",
"value":false
},
"nodeparmtype":{
"type":"bool",
"value":false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
""
DialogScript DialogScript
CreateScript CreateScript
InternalFileOptions InternalFileOptions
Contents.gz Contents.gz
TypePropertiesOptions TypePropertiesOptions
Help Help
Tools.shelf Tools.shelf
IconImage IconImage
ExtraFileOptions ExtraFileOptions
AYON__icon.png AYON_icon.png
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<shelfDocument>
<!-- This file contains definitions of shelves, toolbars, and tools.
It should not be hand-edited when it is being used by the application.
Note, that two definitions of the same element are not allowed in
a single file. -->

<tool name="$HDA_DEFAULT_TOOL" label="$HDA_LABEL" icon="$HDA_ICON">
<toolMenuContext name="viewer">
<contextNetType>LOP</contextNetType>
</toolMenuContext>
<toolMenuContext name="network">
<contextOpType>$HDA_TABLE_AND_NAME</contextOpType>
</toolMenuContext>
<toolSubmenu>AYON</toolSubmenu>
<script scriptType="python"><![CDATA[import loptoolutils
loptoolutils.genericTool(kwargs, '$HDA_NAME')]]></script>
</tool>
</shelfDocument>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CheckExternal := 1;
ContentsCompressionType := 1;
ForbidOutsideParms := 1;
GzipContents := 1;
LockContents := 1;
MakeDefault := 1;
ParmsFromVfl := 0;
PrefixDroppedParmLabel := 0;
PrefixDroppedParmName := 0;
SaveCachedCode := 0;
SaveIcon := 1;
SaveSpareParms := 0;
UnlockOnCreate := 0;
UseDSParms := 1;
Empty file.

0 comments on commit f44a054

Please sign in to comment.