Merge pull request #4529 from tokejepsen/bugfix/maya_fix_lib

Maya: Fix broken lib.
This commit is contained in:
Petr Kalis 2023-02-24 19:03:00 +01:00 committed by GitHub
commit 21090fffcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -403,9 +403,9 @@ def lsattrs(attrs):
"""
dep_fn = om.MFnDependencyNode()
dag_fn = om.MFnDagNode()
selection_list = om.MSelectionList()
dep_fn = OpenMaya.MFnDependencyNode()
dag_fn = OpenMaya.MFnDagNode()
selection_list = OpenMaya.MSelectionList()
first_attr = next(iter(attrs))
@ -419,7 +419,7 @@ def lsattrs(attrs):
matches = set()
for i in range(selection_list.length()):
node = selection_list.getDependNode(i)
if node.hasFn(om.MFn.kDagNode):
if node.hasFn(OpenMaya.MFn.kDagNode):
fn_node = dag_fn.setObject(node)
full_path_names = [path.fullPathName()
for path in fn_node.getAllPaths()]
@ -868,11 +868,11 @@ def maintained_selection_api():
Warning: This is *not* added to the undo stack.
"""
original = om.MGlobal.getActiveSelectionList()
original = OpenMaya.MGlobal.getActiveSelectionList()
try:
yield
finally:
om.MGlobal.setActiveSelectionList(original)
OpenMaya.MGlobal.setActiveSelectionList(original)
@contextlib.contextmanager
@ -1282,11 +1282,11 @@ def get_id(node):
if node is None:
return
sel = om.MSelectionList()
sel = OpenMaya.MSelectionList()
sel.add(node)
api_node = sel.getDependNode(0)
fn = om.MFnDependencyNode(api_node)
fn = OpenMaya.MFnDependencyNode(api_node)
if not fn.hasAttribute("cbId"):
return
@ -3341,15 +3341,15 @@ def iter_visible_nodes_in_range(nodes, start, end):
@memodict
def get_visibility_mplug(node):
"""Return api 2.0 MPlug with cached memoize decorator"""
sel = om.MSelectionList()
sel = OpenMaya.MSelectionList()
sel.add(node)
dag = sel.getDagPath(0)
return om.MFnDagNode(dag).findPlug("visibility", True)
return OpenMaya.MFnDagNode(dag).findPlug("visibility", True)
@contextlib.contextmanager
def dgcontext(mtime):
"""MDGContext context manager"""
context = om.MDGContext(mtime)
context = OpenMaya.MDGContext(mtime)
try:
previous = context.makeCurrent()
yield context
@ -3358,9 +3358,9 @@ def iter_visible_nodes_in_range(nodes, start, end):
# We skip the first frame as we already used that frame to check for
# overall visibilities. And end+1 to include the end frame.
scene_units = om.MTime.uiUnit()
scene_units = OpenMaya.MTime.uiUnit()
for frame in range(start + 1, end + 1):
mtime = om.MTime(frame, unit=scene_units)
mtime = OpenMaya.MTime(frame, unit=scene_units)
# Build little cache so we don't query the same MPlug's value
# again if it was checked on this frame and also is a dependency