generated from ynput/ayon-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Generic ROP publish from ynput/ayon-core#542
- Loading branch information
Showing
10 changed files
with
883 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import hou | ||
|
||
from ayon_core.pipeline import registered_host | ||
from ayon_core.pipeline.create import CreateContext | ||
|
||
|
||
def make_publishable(node): | ||
# TODO: Can we make this imprinting much faster? Unfortunately | ||
# CreateContext initialization is very slow. | ||
host = registered_host() | ||
context = CreateContext(host) | ||
|
||
# Apply the instance creation to the node | ||
context.create( | ||
creator_identifier="io.ayon.creators.houdini.publish", | ||
variant="__use_node_name__", | ||
pre_create_data={ | ||
"node": node | ||
} | ||
) | ||
|
||
|
||
# TODO: Move this choice of automatic 'imprint' to settings so studio can | ||
# configure which nodes should get automatically imprinted on creation | ||
# TODO: Do not import and reload the creator plugin file | ||
from ayon_houdini.plugins.create import create_generic | ||
import importlib | ||
importlib.reload(create_generic) | ||
AUTO_CREATE_NODE_TYPES = set( | ||
create_generic.CreateHoudiniGeneric.node_type_product_types.keys() | ||
) | ||
|
||
|
||
def autocreate_publishable(node): | ||
# For now only consider RopNode | ||
if not isinstance(node, hou.RopNode): | ||
return | ||
|
||
node_type = node.type().name() | ||
if node_type in AUTO_CREATE_NODE_TYPES: | ||
make_publishable(node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.