Clean up redundant lib code.

This commit is contained in:
Toke Stuart Jepsen 2023-01-19 09:12:33 +00:00
parent e0b0b51d62
commit cf4df006bd
3 changed files with 8 additions and 37 deletions

View file

@ -254,11 +254,6 @@ def read(node):
return data
def _get_mel_global(name):
"""Return the value of a mel global variable"""
return mel.eval("$%s = $%s;" % (name, name))
def matrix_equals(a, b, tolerance=1e-10):
"""
Compares two matrices with an imperfection tolerance
@ -691,11 +686,6 @@ class delete_after(object):
cmds.delete(self._nodes)
def get_renderer(layer):
with renderlayer(layer):
return cmds.getAttr("defaultRenderGlobals.currentRenderer")
def get_current_renderlayer():
return cmds.editRenderLayerGlobals(query=True, currentRenderLayer=True)
@ -1440,27 +1430,6 @@ def set_id(node, unique_id, overwrite=False):
cmds.setAttr(attr, unique_id, type="string")
# endregion ID
def get_reference_node(path):
"""
Get the reference node when the path is found being used in a reference
Args:
path (str): the file path to check
Returns:
node (str): name of the reference node in question
"""
try:
node = cmds.file(path, query=True, referenceNode=True)
except RuntimeError:
log.debug('File is not referenced : "{}"'.format(path))
return
reference_path = cmds.referenceQuery(path, filename=True)
if os.path.normpath(path) == os.path.normpath(reference_path):
return node
def set_attribute(attribute, value, node):
"""Adjust attributes based on the value from the attribute data

View file

@ -52,6 +52,11 @@ def _get_script():
return module_path
def get_renderer(layer):
with lib.renderlayer(layer):
return cmds.getAttr("defaultRenderGlobals.currentRenderer")
def get_renderer_variables(renderlayer=None):
"""Retrieve the extension which has been set in the VRay settings
@ -66,7 +71,7 @@ def get_renderer_variables(renderlayer=None):
dict
"""
renderer = lib.get_renderer(renderlayer or lib.get_current_renderlayer())
renderer = get_renderer(renderlayer or lib.get_current_renderlayer())
render_attrs = lib.RENDER_ATTRS.get(renderer, lib.RENDER_ATTRS["default"])
padding = cmds.getAttr("{}.{}".format(render_attrs["node"],

View file

@ -11,10 +11,6 @@ from openpype.pipeline.publish import (
)
def float_round(num, places=0, direction=ceil):
return direction(num * (10**places)) / float(10**places)
class ValidateMayaUnits(pyblish.api.ContextPlugin):
"""Check if the Maya units are set correct"""
@ -36,6 +32,7 @@ class ValidateMayaUnits(pyblish.api.ContextPlugin):
# Collected units
linearunits = context.data.get('linearUnits')
angularunits = context.data.get('angularUnits')
# TODO(antirotor): This is hack as for framerates having multiple
# decimal places. FTrack is ceiling decimal values on
# fps to two decimal places but Maya 2019+ is reporting those fps
@ -43,7 +40,7 @@ class ValidateMayaUnits(pyblish.api.ContextPlugin):
# rounding, we have to round those numbers coming from Maya.
# NOTE: this must be revisited yet again as it seems that Ftrack is
# now flooring the value?
fps = float_round(context.data.get('fps'), 2, ceil)
fps = mayalib.float_round(context.data.get('fps'), 2, ceil)
# TODO repace query with using 'context.data["assetEntity"]'
asset_doc = get_current_project_asset()