update plugins for better demonstration

This commit is contained in:
Mustafa-Zarkash 2023-08-07 22:11:01 +03:00
parent 31f8c4cd13
commit b1ac707a68
5 changed files with 66 additions and 29 deletions

View file

@ -21,12 +21,15 @@ import hou
class CreateFilmboxFBX(plugin.HoudiniCreator):
"""Filmbox FBX Driver"""
"""Filmbox FBX Driver."""
# you should set
identifier = "io.openpype.creators.houdini.filmboxfbx"
label = "Filmbox FBX"
family = "filmboxfbx"
icon = "fa5s.cubes"
# optional to set
default_variant = "Main"
default_variants = ["Main", "Test"]
@ -36,7 +39,7 @@ class CreateFilmboxFBX(plugin.HoudiniCreator):
# set node type
instance_data.update({"node_type": "filmboxfbx"})
# create instance (calls super create method)
# create instance (calls HoudiniCreator.create())
instance = super(CreateFilmboxFBX, self).create(
subset_name,
instance_data,

View file

@ -22,9 +22,11 @@ class FbxLoader(load.LoaderPlugin):
label = "Load FBX"
families = ["filmboxfbx", "fbx"]
representations = ["fbx"]
order = -10 # you can use this by default.
icon = "code-fork" # you can use this by default.
color = "orange" # you can use this by default.
# Usually you will use these value as default
order = -10
icon = "code-fork"
color = "orange"
def load(self, context, name=None, namespace=None, data=None):

View file

@ -1,10 +1,11 @@
"""Collector for filmboxfbx types.
A Collector can act as a preprocessor for the validation stage.
Collectors act as a pre process for the validation stage.
It is used mainly to update instance.data
P.S.
There are some collectors that run by default for all types.
There are some collectors that run by default
for all types.
This plugin is part of publish process guide.
"""
@ -14,18 +15,21 @@ import pyblish.api
class CollectFilmboxfbxType(pyblish.api.InstancePlugin):
"""Collect data type for filmboxfbx instance."""
# Usually you will use this value as default
order = pyblish.api.CollectorOrder
hosts = ["houdini"]
families = ["filmboxfbx"]
label = "Collect type of filmboxfbx"
# Usually you will use this value as default
order = pyblish.api.CollectorOrder
# overrides InstancePlugin.process()
def process(self, instance):
if instance.data["creator_identifier"] == "io.openpype.creators.houdini.filmboxfbx": # noqa: E501
# such a condition can be used to differentiate between
# instances by identifier even if they have the same type.
# instances by identifier becuase sometimes instances
# may have the same family but different identifier
# e.g. bgeo and alembic
pass
# Update instance.data with ouptut_node
@ -36,15 +40,11 @@ class CollectFilmboxfbxType(pyblish.api.InstancePlugin):
# Disclaimer : As a convntin we use collect_output_node.py
# to Update instance.data with ouptut_node of different types
# however, we use this collector instead for demonstration
# however, this collector is used for demonstration
def get_output_node(self, instance):
"""Getting output_node Logic.
It's moved here so that it become easier to focus on
process method.
"""
"""Getting output_node Logic."""
import hou

View file

@ -1,3 +1,11 @@
"""Extract FilmBox FBX.
Extractors are used to generate output and
update representation dictionary.
This plugin is part of publish process guide.
"""
import os
import pyblish.api
@ -10,31 +18,51 @@ import hou
class ExtractRedshiftProxy(publish.Extractor):
# Usually you will use this value as default
order = pyblish.api.ExtractorOrder + 0.1
label = "Extract FilmBox FBX"
families = ["filmboxfbx"]
hosts = ["houdini"]
# Usually you will use this value as default
order = pyblish.api.ExtractorOrder + 0.1
# overrides Extractor.process()
def process(self, instance):
# get rop node
ropnode = hou.node(instance.data.get("instance_node"))
# Get the filename from the filename parameter
# `.evalParm(parameter)` will make sure all tokens are resolved
output = ropnode.evalParm("sopoutput")
staging_dir = os.path.normpath(os.path.dirname(output))
# render rop
render_rop(ropnode)
# get required data
file_name, staging_dir = self.get_paths_data(ropnode)
representation = self.get_representation(instance,
file_name,
staging_dir)
# set value type for 'representations' key to list
if "representations" not in instance.data:
instance.data["representations"] = []
# update instance data
instance.data["stagingDir"] = staging_dir
instance.data["representations"].append(representation)
def get_paths_data(self, ropnode):
# Get the filename from the filename parameter
output = ropnode.evalParm("sopoutput")
staging_dir = os.path.normpath(os.path.dirname(output))
file_name = os.path.basename(output)
self.log.info("Writing FBX '%s' to '%s'" % (file_name,
staging_dir))
render_rop(ropnode)
return file_name, staging_dir
if "representations" not in instance.data:
instance.data["representations"] = []
def get_representation(self, instance,
file_name, staging_dir):
representation = {
"name": "fbx",
@ -48,4 +76,4 @@ class ExtractRedshiftProxy(publish.Extractor):
representation["frameStart"] = instance.data["frameStart"]
representation["frameEnd"] = instance.data["frameEnd"]
instance.data["representations"].append(representation)
return representation

View file

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
"""Validate path attribute for all primitives.
Validators are used to verify the work of artists,
by running some checks which automates the approval process.
It's almost the same as
'validate_primitive_hierarchy_paths.py'
however this one includes extra comments for demonstration.
@ -44,12 +47,13 @@ class ValidatePrimitiveHierarchyPaths(pyblish.api.InstancePlugin):
by default.
"""
# Usually you will use this value as default
order = ValidateContentsOrder + 0.1
families = ["filmboxfbx"]
hosts = ["houdini"]
label = "Validate FBX Hierarchy Path"
# Usually you will use this value as default
order = ValidateContentsOrder + 0.1
# Validation can have as many actions as you want
# all of these actions are defined in a seperate place
# unlike the repair action
@ -69,7 +73,7 @@ class ValidatePrimitiveHierarchyPaths(pyblish.api.InstancePlugin):
# This method was named get_invalid as a convention
# it's also used by SelectInvalidAction to select
# the returned node
# the returned nodes
@classmethod
def get_invalid(cls, instance):