mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
code tweaks on has_rgb_channel_in_texture_set function & add publish data into the imageinstance
This commit is contained in:
parent
6410f381f3
commit
00eb748b4b
3 changed files with 19 additions and 42 deletions
|
|
@ -653,45 +653,23 @@ def has_rgb_channel_in_texture_set(texture_set_name, map_identifier):
|
||||||
map_identifier (str): Map identifier
|
map_identifier (str): Map identifier
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
colorspace_dict: A dictionary which stores the boolean
|
bool: Whether the channel type identifier has RGB channel or not
|
||||||
value of textures having RGB channels
|
in the texture stack.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 2D_View is always True as it exports all texture maps
|
||||||
texture_stack = (
|
texture_stack = (
|
||||||
substance_painter.textureset.Stack.from_name(texture_set_name)
|
substance_painter.textureset.Stack.from_name(texture_set_name)
|
||||||
)
|
)
|
||||||
# 2D_View is always True as it exports all texture maps
|
# 2D_View is always True as it exports all texture maps
|
||||||
colorspace_dict = {"2D_View": True}
|
if map_identifier == "2D_View":
|
||||||
colorspace_dict["BaseColor"] = texture_stack.get_channel(
|
return True
|
||||||
substance_painter.textureset.ChannelType.BaseColor).is_color()
|
|
||||||
colorspace_dict["Roughness"] = texture_stack.get_channel(
|
|
||||||
substance_painter.textureset.ChannelType.Roughness).is_color()
|
|
||||||
colorspace_dict["Metallic"] = texture_stack.get_channel(
|
|
||||||
substance_painter.textureset.ChannelType.Metallic).is_color()
|
|
||||||
colorspace_dict["Height"] = texture_stack.get_channel(
|
|
||||||
substance_painter.textureset.ChannelType.Height).is_color()
|
|
||||||
colorspace_dict["Normal"] = texture_stack.get_channel(
|
|
||||||
substance_painter.textureset.ChannelType.Normal).is_color()
|
|
||||||
return colorspace_dict.get(map_identifier, False)
|
|
||||||
|
|
||||||
|
channel_type = getattr(
|
||||||
|
substance_painter.textureset.ChannelType, map_identifier, None)
|
||||||
|
if channel_type is None:
|
||||||
|
return False
|
||||||
|
if not texture_stack.has_channel(channel_type):
|
||||||
|
return False
|
||||||
|
|
||||||
def texture_set_filtering(texture_set_same, template):
|
return texture_stack.get_channel(channel_type).is_color()
|
||||||
"""Function to check whether some specific textures(e.g. Emissive)
|
|
||||||
are parts of the texture stack in Substance Painter
|
|
||||||
|
|
||||||
Args:
|
|
||||||
texture_set_same (str): Name of Texture Set
|
|
||||||
template (str): texture template name
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
texture_filter: A dictionary which stores the boolean
|
|
||||||
value of whether the texture exist in the channel.
|
|
||||||
"""
|
|
||||||
texture_filter = {}
|
|
||||||
channel_stack = substance_painter.textureset.Stack.from_name(
|
|
||||||
texture_set_same)
|
|
||||||
has_emissive = channel_stack.has_channel(
|
|
||||||
substance_painter.textureset.ChannelType.Emissive)
|
|
||||||
map_identifier = strip_template(template)
|
|
||||||
if map_identifier == "Emissive":
|
|
||||||
texture_filter[map_identifier] = has_emissive
|
|
||||||
return texture_filter.get(map_identifier, True)
|
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,11 @@ class CollectTextureSet(pyblish.api.InstancePlugin):
|
||||||
for (texture_set_name, stack_name), template_maps in maps.items():
|
for (texture_set_name, stack_name), template_maps in maps.items():
|
||||||
self.log.info(f"Processing {texture_set_name}/{stack_name}")
|
self.log.info(f"Processing {texture_set_name}/{stack_name}")
|
||||||
for template, outputs in template_maps.items():
|
for template, outputs in template_maps.items():
|
||||||
if texture_set_filtering(texture_set_name, template):
|
self.log.info(f"Processing {template}")
|
||||||
self.log.info(f"Processing {template}")
|
self.create_image_instance(instance, template, outputs,
|
||||||
self.create_image_instance(
|
asset_doc=asset_doc,
|
||||||
instance, template, outputs,
|
texture_set_name=texture_set_name,
|
||||||
asset_doc=asset_doc,
|
stack_name=stack_name)
|
||||||
texture_set_name=texture_set_name,
|
|
||||||
stack_name=stack_name)
|
|
||||||
|
|
||||||
def create_image_instance(self, instance, template, outputs,
|
def create_image_instance(self, instance, template, outputs,
|
||||||
asset_doc, texture_set_name, stack_name):
|
asset_doc, texture_set_name, stack_name):
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ class ValidateOutputMaps(pyblish.api.InstancePlugin):
|
||||||
self.log.warning(f"Disabling texture instance: "
|
self.log.warning(f"Disabling texture instance: "
|
||||||
f"{image_instance}")
|
f"{image_instance}")
|
||||||
image_instance.data["active"] = False
|
image_instance.data["active"] = False
|
||||||
|
image_instance.data["publish"] = False
|
||||||
image_instance.data["integrate"] = False
|
image_instance.data["integrate"] = False
|
||||||
representation.setdefault("tags", []).append("delete")
|
representation.setdefault("tags", []).append("delete")
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue