Skip to content

Commit

Permalink
added qc library
Browse files Browse the repository at this point in the history
  • Loading branch information
leixingyu committed Feb 19, 2022
1 parent 42d4088 commit d28d9d1
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
Empty file added qc/__init__.py
Empty file.
41 changes: 41 additions & 0 deletions qc/ghosting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import maya.cmds as cmds
import maya.mel as mel


def inspect():
return get_ghosting_node()


def fix_selected(node):
unghost_node(node)


def fix_all(nodes):
unghost_all()


def get_ghosting_node():
"""
Get ghosting node in the scene
:return: list. list of ghosting node names
"""
return cmds.ls(ghost=1)


def unghost_node(node):
"""
Set ghosting to false on a node
:param node: str. node name to un-ghost
"""
cmds.setAttr('{}.ghosting'.format(node), 0)
cmds.setAttr('{}.ghostingControl'.format(node), 0)


def unghost_all():
"""
Set ghosting to false for all nodes
"""
mel.eval("unGhostAll;")

41 changes: 41 additions & 0 deletions qc/unknownNode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import maya.cmds as cmds


def inspect():
return get_unknown_node()


def fix_selected(node):
delete_unknown_node(node)


def fix_all(nodes):
delete_all_unknown()


def get_unknown_node():
"""
Get unknown node in the scene
:return: list. names of the unknown nodes
"""
return cmds.ls(type="unknown")


def delete_unknown_node(node):
"""
Delete given unknown node
:param node: str. name of the unknown node
"""
locked_state = cmds.lockNode(node, q=1, l=1)
if locked_state[0] == 1:
cmds.lockNode(node, l=0)
cmds.delete(node)


def delete_all_unknown():
"""
Delete all unknown node in scene
"""
cmds.delete(cmds.ls(type="unknown"))
33 changes: 33 additions & 0 deletions qc/unknownPlugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import maya.cmds as cmds


def inspect():
return get_unknown_plugin()


def fix_selected(node):
delete_unknown_plugin(node)


def fix_all(nodes):
for plugin in nodes:
delete_unknown_plugin(plugin)


def get_unknown_plugin():
"""
Get unknown plugin in the scene
:return: list. names of the unknown plugins
"""
return cmds.unknownPlugin(q=1, l=1)


def delete_unknown_plugin(plugin):
"""
Delete given unknown plugins
:param plugin: str. name of the unknown plugins
"""
cmds.unknownPlugin(plugin, remove=1)

0 comments on commit d28d9d1

Please sign in to comment.