mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
exposes asString as arguments for getting attributes for renderlayer & renderlayersetup
This commit is contained in:
parent
368444a7f2
commit
dc21231c29
3 changed files with 12 additions and 13 deletions
|
|
@ -3129,7 +3129,7 @@ def load_capture_preset(data):
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
def get_attr_in_layer(attr, layer):
|
def get_attr_in_layer(attr, layer, as_string=True):
|
||||||
"""Return attribute value in specified renderlayer.
|
"""Return attribute value in specified renderlayer.
|
||||||
|
|
||||||
Same as cmds.getAttr but this gets the attribute's value in a
|
Same as cmds.getAttr but this gets the attribute's value in a
|
||||||
|
|
@ -3156,7 +3156,8 @@ def get_attr_in_layer(attr, layer):
|
||||||
try:
|
try:
|
||||||
if cmds.mayaHasRenderSetup():
|
if cmds.mayaHasRenderSetup():
|
||||||
from . import lib_rendersetup
|
from . import lib_rendersetup
|
||||||
return lib_rendersetup.get_attr_in_layer(attr, layer)
|
return lib_rendersetup.get_attr_in_layer(
|
||||||
|
attr, layer, as_string=as_string)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -3173,7 +3174,7 @@ def get_attr_in_layer(attr, layer):
|
||||||
type="renderLayer") or []
|
type="renderLayer") or []
|
||||||
connections = filter(lambda x: x.endswith(".plug"), connections)
|
connections = filter(lambda x: x.endswith(".plug"), connections)
|
||||||
if not connections:
|
if not connections:
|
||||||
return cmds.getAttr(attr)
|
return cmds.getAttr(attr, asString=as_string)
|
||||||
|
|
||||||
# Some value types perform a conversion when assigning
|
# Some value types perform a conversion when assigning
|
||||||
# TODO: See if there's a maya method to allow this conversion
|
# TODO: See if there's a maya method to allow this conversion
|
||||||
|
|
@ -3215,7 +3216,7 @@ def get_attr_in_layer(attr, layer):
|
||||||
value *= conversion
|
value *= conversion
|
||||||
return value
|
return value
|
||||||
|
|
||||||
return cmds.getAttr(attr)
|
return cmds.getAttr(attr, asString=as_string)
|
||||||
|
|
||||||
|
|
||||||
def fix_incompatible_containers():
|
def fix_incompatible_containers():
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ class ARenderProducts:
|
||||||
"""
|
"""
|
||||||
return self._get_attr("defaultRenderGlobals", attribute)
|
return self._get_attr("defaultRenderGlobals", attribute)
|
||||||
|
|
||||||
def _get_attr(self, node_attr, attribute=None):
|
def _get_attr(self, node_attr, attribute=None, as_string=True):
|
||||||
"""Return the value of the attribute in the renderlayer
|
"""Return the value of the attribute in the renderlayer
|
||||||
|
|
||||||
For readability this allows passing in the attribute in two ways.
|
For readability this allows passing in the attribute in two ways.
|
||||||
|
|
@ -317,7 +317,7 @@ class ARenderProducts:
|
||||||
else:
|
else:
|
||||||
plug = "{}.{}".format(node_attr, attribute)
|
plug = "{}.{}".format(node_attr, attribute)
|
||||||
|
|
||||||
return lib.get_attr_in_layer(plug, layer=self.layer)
|
return lib.get_attr_in_layer(plug, layer=self.layer, as_string=as_string)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extract_separator(file_prefix):
|
def extract_separator(file_prefix):
|
||||||
|
|
@ -1133,11 +1133,9 @@ class RenderProductsRedshift(ARenderProducts):
|
||||||
aovs = list(set(aovs) - set(ref_aovs))
|
aovs = list(set(aovs) - set(ref_aovs))
|
||||||
|
|
||||||
products = []
|
products = []
|
||||||
# global_aov_enabled = bool(
|
|
||||||
# self._get_attr("redshiftOptions.aovGlobalEnableMode")
|
|
||||||
# )
|
|
||||||
global_aov_enabled = bool(
|
global_aov_enabled = bool(
|
||||||
cmds.getAttr("redshiftOptions.aovGlobalEnableMode"))
|
self._get_attr("redshiftOptions.aovGlobalEnableMode", as_string=False)
|
||||||
|
)
|
||||||
colorspace = lib.get_color_management_output_transform()
|
colorspace = lib.get_color_management_output_transform()
|
||||||
if not global_aov_enabled:
|
if not global_aov_enabled:
|
||||||
# only beauty output
|
# only beauty output
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ def get_rendersetup_layer(layer):
|
||||||
if conn.endswith(".legacyRenderLayer")), None)
|
if conn.endswith(".legacyRenderLayer")), None)
|
||||||
|
|
||||||
|
|
||||||
def get_attr_in_layer(node_attr, layer):
|
def get_attr_in_layer(node_attr, layer, as_string=True):
|
||||||
"""Return attribute value in Render Setup layer.
|
"""Return attribute value in Render Setup layer.
|
||||||
|
|
||||||
This will only work for attributes which can be
|
This will only work for attributes which can be
|
||||||
|
|
@ -124,7 +124,7 @@ def get_attr_in_layer(node_attr, layer):
|
||||||
node = history_overrides[-1] if history_overrides else override
|
node = history_overrides[-1] if history_overrides else override
|
||||||
node_attr_ = node + ".original"
|
node_attr_ = node + ".original"
|
||||||
|
|
||||||
return get_attribute(node_attr_, asString=True)
|
return get_attribute(node_attr_, asString=as_string)
|
||||||
|
|
||||||
layer = get_rendersetup_layer(layer)
|
layer = get_rendersetup_layer(layer)
|
||||||
rs = renderSetup.instance()
|
rs = renderSetup.instance()
|
||||||
|
|
@ -144,7 +144,7 @@ def get_attr_in_layer(node_attr, layer):
|
||||||
# we will let it error out.
|
# we will let it error out.
|
||||||
rs.switchToLayer(current_layer)
|
rs.switchToLayer(current_layer)
|
||||||
|
|
||||||
return get_attribute(node_attr, asString=True)
|
return get_attribute(node_attr, asString=as_string)
|
||||||
|
|
||||||
overrides = get_attr_overrides(node_attr, layer)
|
overrides = get_attr_overrides(node_attr, layer)
|
||||||
default_layer_value = get_default_layer_value(node_attr)
|
default_layer_value = get_default_layer_value(node_attr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue