Merged 0016 into master

This commit is contained in:
Wijnand Koreman 2017-09-12 17:01:31 +02:00
commit 4fbe03c75d
30 changed files with 290 additions and 404 deletions

View file

@ -604,6 +604,13 @@ def get_id_required_nodes(referenced_nodes=False):
nodes (set): list of filtered nodes
"""
def _node_type_exists(node_type):
try:
cmds.nodeType(node_type, isTypeName=True)
return True
except RuntimeError:
return False
# `readOnly` flag is obsolete as of Maya 2016 therefor we explicitly remove
# default nodes and reference nodes
camera_shapes = ["frontShape", "sideShape", "topShape", "perspShape"]
@ -616,6 +623,11 @@ def get_id_required_nodes(referenced_nodes=False):
ignore |= set(cmds.ls(long=True, defaultNodes=True))
ignore |= set(cmds.ls(camera_shapes, long=True))
# Remove Turtle from the result of `cmds.ls` if Turtle is loaded
# TODO: This should be a less specific check for a single plug-in.
if _node_type_exists("ilrBakeLayer"):
ignore |= set(cmds.ls(type="ilrBakeLayer", long=True))
# establish set of nodes to ignore
types = ["objectSet", "file", "mesh", "nurbsCurve", "nurbsSurface"]
@ -623,9 +635,6 @@ def get_id_required_nodes(referenced_nodes=False):
# directly
nodes = cmds.ls(type=types, long=True, noIntermediate=True)
# Remove Turtle from the result of `cmds.ls`
nodes = [n for n in nodes if n not in cmds.ls(type="ilrBakeLayer")]
# The items which need to pass the id to their parent
# Add the collected transform to the nodes
dag = cmds.ls(nodes, type="dagNode", long=True) # query only dag nodes

View file

@ -1,7 +1,7 @@
[
{
"type": "action",
"command": "$COLORBLEED_SCRIPTS\\others\\_save_scene_incremental.py",
"command": "$COLORBLEED_SCRIPTS\\others\\save_scene_incremental.py",
"sourcetype": "file",
"title": "Version Up",
"tooltip": "Incremental save with a specific format"
@ -797,7 +797,7 @@
"auto"
],
"title": "Assign lookDefault Shader",
"tooltip": "Assign the latest 'lookDefault' to assets without any lookdev in the scene"
"tooltip": "Assign the latest `lookDefault` to assets without any lookdev in the scene"
},
{
"type": "action",
@ -1030,37 +1030,103 @@
]
},
{
"type": "action",
"command": "$COLORBLEED_SCRIPTS\\animation\\zvParentMaster.py",
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\bakeSelectedToWorldSpace.py",
"tags": ["animation", "bake","selection", "worldspace.py"],
"title": "Bake Selected To Worldspace",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\timeStepper.py",
"tags": ["animation", "time","stepper"],
"title": "Time Stepper",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\capture_ui.py",
"tags": ["animation", "capture", "ui", "screen", "movie", "image"],
"title": "Capture UI",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\simplePlayblastUI.py",
"tags": ["animation", "simple", "playblast", "ui"],
"title": "Simple Playblast UI",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\tweenMachineUI.py",
"tags": ["animation", "tween", "machine"],
"title": "Tween Machine UI",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\selectAllAnimationCurves.py",
"tags": ["animation", "select", "curves"],
"title": "Select All Animation Curves",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\pathAnimation.py",
"tags": ["animation", "path", "along"],
"title": "Path Animation",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\offsetSelectedObjectsUI.py",
"tags": [
"animation",
"zvParentMaster"
"offsetSelectedObjectsUI.py"
],
"title": "Offset Selected Objects UI",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\key_amplifier_ui.py",
"tags": [
"animation",
"key", "amplifier"
],
"title": "Key Amplifier UI",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\anim_scene_optimizer.py",
"tags": [
"animation",
"anim_scene_optimizer.py"
],
"title": "Anim_Scene_Optimizer",
"type": "action"
},
{
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\zvParentMaster.py",
"tags": [
"animation",
"zvParentMaster.py"
],
"title": "ZV Parent Master",
"tooltip": "Open ZV Parent M UI"
"type": "action"
},
{
"type": "action",
"command": "$COLORBLEED_SCRIPTS\\animation\\pathAnimation.py",
"sourcetype": "file",
"command": "$COLORBLEED_SCRIPTS\\animation\\poseLibrary.py",
"tags": [
"animation",
"path"
"poseLibrary.py"
],
"title": "Path Animation",
"tooltip": ""
},
{
"type": "action",
"command": "$COLORBLEED_SCRIPTS\\animation\\timeStepper.py",
"sourcetype": "file",
"tags": [
"animation",
"timeStepper"
],
"title": "TimeStepper",
"tooltip": ""
"title": "Pose Library",
"type": "action"
}
]
},
@ -1554,100 +1620,6 @@
}
]
},
{
"type": "menu",
"title": "Projects",
"items": [
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"fifa"
],
"title": "fifa",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"beakbuds"
],
"title": "beakbuds",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"redeemer"
],
"title": "redeemer",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"bjorn"
],
"title": "bjorn",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"aldi"
],
"title": "aldi",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"eneco"
],
"title": "eneco",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"duurzame_verpakking"
],
"title": "duurzame_verpakking",
"tooltip": ""
},
{
"type": "action",
"command": "",
"sourcetype": "file",
"tags": [
"projects",
"bunch"
],
"title": "bunch",
"tooltip": ""
}
]
},
{
"type": "menu",
"title": "Others",

View file

@ -2,7 +2,7 @@ import sys
import os
import logging
from avalon.vendor.Qt import QtWidgets, QtCore
from avalon.vendor.Qt import QtWidgets, QtCore, QtGui
import maya.cmds as cmds
@ -12,6 +12,15 @@ self._menu = "colorbleed"
log = logging.getLogger(__name__)
def _get_menu():
"""Return the menu instance if it currently exists in Maya"""
app = QtWidgets.QApplication.instance()
widgets = dict((w.objectName(), w) for w in app.allWidgets())
menu = widgets.get(self._menu)
return menu
def deferred():
import scriptsmenu.launchformaya as launchformaya
@ -37,12 +46,11 @@ def deferred():
def uninstall():
log.info("Attempting to uninstall ..")
app = QtWidgets.QApplication.instance()
widgets = dict((w.objectName(), w) for w in app.allWidgets())
menu = widgets.get(self._menu)
menu = _get_menu()
if menu:
log.info("Attempting to uninstall ..")
try:
menu.deleteLater()
del menu
@ -55,3 +63,12 @@ def install():
uninstall()
# Allow time for uninstallation to finish.
cmds.evalDeferred(deferred)
def popup():
"""Pop-up the existing menu near the mouse cursor"""
menu = _get_menu()
cursor = QtGui.QCursor()
point = cursor.pos()
menu.exec_(point)

View file

@ -84,7 +84,7 @@ class CollectLook(pyblish.api.InstancePlugin):
# Discover related object sets
self.log.info("Gathering sets..")
sets = self.gather_sets(instance)
sets = self.gather_sets(cmds.ls(instance, shapes=True))
# Lookup with absolute names (from root namespace)
instance_lookup = set([str(x) for x in cmds.ls(instance, long=True)])
@ -148,21 +148,16 @@ class CollectLook(pyblish.api.InstancePlugin):
"""
sets = dict()
for node in instance:
related_sets = lib.get_related_sets(node)
if not related_sets:
continue
self.log.info("Found sets %s for %s", related_sets, node)
for objset in related_sets:
if objset in sets:
continue
sets[objset] = {"uuid": lib.get_id(objset),
"members": list()}
sets[objset] = {"uuid": lib.get_id(objset), "members": list()}
return sets
@ -178,8 +173,8 @@ class CollectLook(pyblish.api.InstancePlugin):
for objset, data in sets.items():
if not data['members']:
self.log.debug("Removing redundant set information: "
"%s" % objset)
self.log.info("Removing redundant set information: "
"%s" % objset)
sets.pop(objset)
return sets
@ -213,8 +208,7 @@ class CollectLook(pyblish.api.InstancePlugin):
self.log.error("Node '{}' has no attribute 'cbId'".format(node))
return
member_data = {"name": node,
"uuid": cmds.getAttr("{}.cbId".format(node))}
member_data = {"name": node, "uuid": lib.get_id(node)}
# Include components information when components are assigned
if components:
@ -242,6 +236,9 @@ class CollectLook(pyblish.api.InstancePlugin):
attributes = []
for node in instance:
# get history to ignore original shapes
cmds.listHistory(node)
# Collect changes to "custom" attributes
node_attrs = get_look_attrs(node)
@ -251,11 +248,13 @@ class CollectLook(pyblish.api.InstancePlugin):
node_attributes = {}
for attr in node_attrs:
if not cmds.attributeQuery(attr, node=node, exists=True):
continue
attribute = "{}.{}".format(node, attr)
node_attributes[attr] = cmds.getAttr(attribute)
attributes.append({"name": node,
"uuid": cmds.getAttr("{}.cbId".format(node)),
"uuid": lib.get_id(node),
"attributes": node_attributes})
return attributes

View file

@ -12,6 +12,7 @@ class CollectMindbenderMayaRenderlayers(pyblish.api.ContextPlugin):
order = pyblish.api.CollectorOrder
hosts = ["maya"]
label = "Render Layers"
optional = True
def process(self, context):

View file

@ -16,8 +16,8 @@ class ExtractColorbleedAlembic(colorbleed.api.Extractor):
"""
label = "Alembic"
families = ["colorbleed.model", "colorbleed.pointcache"]
optional = True
families = ["colorbleed.model",
"colorbleed.pointcache"]
def process(self, instance):

View file

@ -58,7 +58,11 @@ class ExtractColorbleedAnimation(colorbleed.api.Extractor):
startFrame=start,
endFrame=end,
**{"step": instance.data.get("step", 1.0),
"attr": ["cbId"]})
"attr": ["cbId"],
"writeVisibility": True,
"writeCreases": True,
"uvWrite": True,
"selection": True})
if "files" not in instance.data:
instance.data["files"] = list()

View file

@ -26,7 +26,6 @@ class ExtractModel(colorbleed.api.Extractor):
label = "Model (Maya ASCII)"
hosts = ["maya"]
families = ["colorbleed.model"]
optional = True
def process(self, instance):

View file

@ -26,26 +26,16 @@ class ValidateFrameRange(pyblish.api.InstancePlugin):
end = instance.data.get("endFrame", None)
handles = instance.data.get("handles", None)
# Check if any of the values are present. If not we'll assume the
# current instance does not require any time values.
if all(value is None for value in [start, end, handles]):
self.log.debug("No time values for this instance. "
"(Missing `startFrame`, `endFrame` or `handles`)")
return
# Check if any of the values are present
if any(value is None for value in [start, end]):
raise ValueError("No time values for this instance. "
"(Missing `startFrame` or `endFrame`)")
# If only one of the two raise an error, it will require both.
has_start = int(start is not None)
has_end = int(end is not None)
if has_start + has_end == 1:
raise RuntimeError("Only a start frame or an end frame is provided"
" instead of both.")
if has_start and has_end:
self.log.info("Comparing start (%s) and end (%s)" % (start, end))
if start > end:
raise RuntimeError("The start frame is a higher value "
"than the end frame: "
"{0}>{1}".format(start, end))
self.log.info("Comparing start (%s) and end (%s)" % (start, end))
if start > end:
raise RuntimeError("The start frame is a higher value "
"than the end frame: "
"{0}>{1}".format(start, end))
if handles is not None:
if handles < 0.0:

View file

@ -1,7 +1,6 @@
import pyblish.api
import colorbleed.api
import cbra.utils.maya.node_uuid as id_utils
import colorbleed.maya.lib as lib
class ValidateLayoutNodeIds(pyblish.api.InstancePlugin):
@ -29,7 +28,7 @@ class ValidateLayoutNodeIds(pyblish.api.InstancePlugin):
invalid = []
for node in non_referenced:
if not id_utils.get_id(node):
if not lib.get_id(node):
invalid.append(node)
return invalid

View file

@ -2,8 +2,7 @@ from maya import cmds
import pyblish.api
import colorbleed.api
import cbra.utils.maya.node_uuid as id_utils
import colorbleed.maya.lib as lib
def get_id_from_history(node):
@ -22,7 +21,7 @@ def get_id_from_history(node):
similar = cmds.ls(history, exactType=nodeType, long=True)
for node in similar:
id = id_utils.get_id(node)
id = lib.get_id(node)
if id:
return id
@ -76,7 +75,7 @@ class CopyUUIDsFromHistoryAction(pyblish.api.Action):
mapping[shape] = id
# Add the ids to the nodes
id_utils.add_ids(mapping)
# id_utils.add_ids(mapping)
self.log.info("Generated ids on nodes: {0}".format(mapping.values()))
@ -136,7 +135,7 @@ class ValidateLayoutShapeNodeIds(pyblish.api.InstancePlugin):
invalid = []
for node in non_referenced:
if not id_utils.get_id(node):
if not lib.get_id(node):
invalid.append(node)
return invalid

View file

@ -1,7 +1,6 @@
import pyblish.api
import colorbleed.api
import cbra.utils.maya.node_uuid as id_utils
import colorbleed.maya.lib as lib
class ValidateLayoutUniqueNodeIds(pyblish.api.InstancePlugin):
@ -28,7 +27,7 @@ class ValidateLayoutUniqueNodeIds(pyblish.api.InstancePlugin):
from collections import defaultdict
ids = defaultdict(list)
for member in members:
id = id_utils.get_id(member)
id = lib.get_id(member)
ids[id].append(member)
# Skip those without IDs (if everything should have an ID that should

View file

@ -2,8 +2,9 @@ from maya import cmds
import pyblish.api
import colorbleed.api
import colorbleed.maya.lib as lib
from cbra.utils.maya.node_uuid import get_id, add_ids
# from cbra.utils.maya.node_uuid import add_ids
def get_deformed_history_id_mapping(shapes):
@ -33,7 +34,8 @@ def get_deformed_history_id_mapping(shapes):
deformed_shapes = [x for x in deformed_shapes if not is_referenced(x)]
# Shapes without id
deformed_shapes_without_id = [x for x in deformed_shapes if not get_id(x)]
deformed_shapes_without_id = [x for x in deformed_shapes
if not lib.get_id(x)]
mapping = {}
for shape in deformed_shapes_without_id:
@ -45,7 +47,7 @@ def get_deformed_history_id_mapping(shapes):
continue
for history_shape in history_shapes:
id = get_id(history_shape)
id = lib.get_id(history_shape)
if not id:
continue
@ -81,11 +83,11 @@ class CopyUUIDsFromHistory(pyblish.api.Action):
mapping = get_deformed_history_id_mapping(invalid)
for destination, source in mapping.items():
ids_map[destination] = get_id(source)
ids_map[destination] = lib.get_id(source)
if not ids_map:
return
add_ids(ids_map)
self.log.info(ids_map)
class ValidateLookDeformedShapes(pyblish.api.InstancePlugin):

View file

@ -28,13 +28,29 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
label = 'Look No Default Shaders'
actions = [colorbleed.api.SelectInvalidAction]
def process(self, instance):
"""Process all the nodes in the instance"""
invalid = self.get_invalid(instance)
if invalid:
raise RuntimeError("Invalid node relationships found: "
"{0}".format(invalid))
@classmethod
def get_invalid(cls, instance):
disallowed = ["lambert1", "initialShadingGroup",
"initialParticleSE", "particleCloud1"]
disallowed = set(disallowed)
disallowed = set(["lambert1",
"initialShadingGroup",
"initialParticleSE",
"particleCloud1"])
# Check if there are any skinClusters present
# If so ensure nodes which are skinned
intermediate = []
skinclusters = cmds.ls(type="skinCluster")
cls.log.info("Found skinClusters, will skip original shapes")
if skinclusters:
intermediate += cmds.ls(intermediateObjects=True,
shapes=True,
long=True)
invalid = set()
for node in instance:
@ -48,6 +64,8 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
# Maya.
if (cmds.objectType(node, isAType="surfaceShape") and
not cmds.ls(object_sets, type="shadingEngine")):
if node in intermediate:
continue
cls.log.error("Detected shape without shading engine: "
"'{}'".format(node))
invalid.add(node)
@ -64,11 +82,3 @@ class ValidateLookNoDefaultShaders(pyblish.api.InstancePlugin):
invalid.add(node)
return list(invalid)
def process(self, instance):
"""Process all the nodes in the instance"""
invalid = self.get_invalid(instance)
if invalid:
raise RuntimeError("Invalid node relationships found: "
"{0}".format(invalid))

View file

@ -3,6 +3,8 @@ from colorbleed.maya import lib
import pyblish.api
import colorbleed.api
from cb.utils.maya import context
class ValidateLookSets(pyblish.api.InstancePlugin):
"""Validate if any sets are missing from the instance and look data
@ -41,40 +43,44 @@ class ValidateLookSets(pyblish.api.InstancePlugin):
"'{}'".format(instance.name))
relationships = instance.data["lookData"]["relationships"]
invalid = []
for node in instance:
# get the connected objectSets of the node
sets = lib.get_related_sets(node)
if not sets:
continue
# check if any objectSets are not present ion the relationships
missing_sets = [s for s in sets if s not in relationships]
if missing_sets:
# A set of this node is not coming along, this is wrong!
cls.log.error("Missing sets '{}' for node "
"'{}'".format(missing_sets, node))
invalid.append(node)
continue
# Ensure the node is in the sets that are collected
for shaderset, data in relationships.items():
if shaderset not in sets:
# no need to check for a set if the node
# isn't in it anyway
layer = instance.data.get("renderlayer", "defaultRenderLayer")
with context.renderlayer(layer):
for node in instance:
# get the connected objectSets of the node
sets = lib.get_related_sets(node)
if not sets:
continue
member_nodes = [member['name'] for member in data['members']]
if node not in member_nodes:
# The node is not found in the collected set
# relationships
cls.log.error("Missing '{}' in collected set node "
"'{}'".format(node, shaderset))
# check if any objectSets are not present ion the relationships
missing_sets = [s for s in sets if s not in relationships]
if missing_sets:
# A set of this node is not coming along, this is wrong!
cls.log.error("Missing sets '{}' for node "
"'{}'".format(missing_sets, node))
invalid.append(node)
continue
# Ensure the node is in the sets that are collected
for shaderset, data in relationships.items():
if shaderset not in sets:
# no need to check for a set if the node
# isn't in it anyway
continue
member_nodes = [member['name'] for member in data['members']]
if node not in member_nodes:
# The node is not found in the collected set
# relationships
cls.log.error("Missing '{}' in collected set node "
"'{}'".format(node, shaderset))
invalid.append(node)
continue
return invalid
@classmethod
def repair(cls, context, instance):
pass

View file

@ -18,7 +18,7 @@ class ValidateMeshNoNegativeScale(pyblish.api.Validator):
order = colorbleed.api.ValidateMeshOrder
hosts = ['maya']
families = ['colorbleed.proxy', 'colorbleed.rig', 'colorbleed.model']
families = ['colorbleed.proxy', 'colorbleed.model']
label = 'Mesh No Negative Scale'
actions = [colorbleed.api.SelectInvalidAction]

View file

@ -5,7 +5,11 @@ from colorbleed.maya import lib
class ValidateNodeIDs(pyblish.api.InstancePlugin):
"""Validate nodes have a Colorbleed Id
"""Validate nodes have a Colorbleed Id.
When IDs are missing from nodes *save your scene* and they should be
automatically generated because IDs are created on non-referenced nodes
in Maya upon scene save.
"""

View file

@ -16,11 +16,20 @@ class ValidateRigControllers(pyblish.api.InstancePlugin):
label = "Rig Controllers"
hosts = ["maya"]
families = ["colorbleed.rig"]
actions = [colorbleed.api.RepairAction]
actions = [colorbleed.api.RepairAction,
colorbleed.api.SelectInvalidAction]
def process(self, instance):
invalid = self.get_invalid(instance)
if invalid:
raise RuntimeError('{} failed, see log '
'information'.format(self.label))
@classmethod
def get_invalid(cls, instance):
error = False
invalid = []
is_keyed = list()
not_locked = list()
is_offset = list()
@ -29,7 +38,7 @@ class ValidateRigControllers(pyblish.api.InstancePlugin):
assert controls, "Must have controls in rig controls_SET"
for control in controls:
valid_keyed = self.validate_keyed_state(control)
valid_keyed = cls.validate_keyed_state(control)
if not valid_keyed:
is_keyed.append(control)
@ -39,30 +48,34 @@ class ValidateRigControllers(pyblish.api.InstancePlugin):
if not locked:
not_locked.append(control)
valid_transforms = self.validate_transforms(control)
valid_transforms = cls.validate_transforms(control)
if not valid_transforms:
is_offset.append(control)
if is_keyed:
self.log.error("No controls can be keyes. Failed :\n"
cls.log.error("No controls can be keyes. Failed :\n"
"%s" % is_keyed)
error = True
if is_offset:
self.log.error("All controls default transformation values. "
cls.log.error("All controls default transformation values. "
"Failed :\n%s" % is_offset)
error = True
if not_locked:
self.log.error("All controls must have visibility "
cls.log.error("All controls must have visibility "
"attribute locked. Failed :\n"
"%s" % not_locked)
error = True
if error:
raise RuntimeError("Invalid rig controllers. See log for details.")
invalid = is_keyed + not_locked + is_offset
cls.log.error("Invalid rig controllers. See log for details.")
def validate_transforms(self, control):
return invalid
@staticmethod
def validate_transforms(control):
tolerance = 1e-30
identity = [1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
@ -71,10 +84,12 @@ class ValidateRigControllers(pyblish.api.InstancePlugin):
matrix = cmds.xform(control, query=True, matrix=True, objectSpace=True)
if not all(abs(x - y) < tolerance for x, y in zip(identity, matrix)):
log.error("%s matrix : %s" % (control, matrix))
return False
return True
def validate_keyed_state(self, control):
@staticmethod
def validate_keyed_state(control):
"""Check if the control has an animation curve attached
Args:
control:
@ -90,13 +105,21 @@ class ValidateRigControllers(pyblish.api.InstancePlugin):
@classmethod
def repair(cls, instance):
identity = [1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0]
# lock all controllers in controls_SET
controls = cmds.sets("controls_SET", query=True)
for control in controls:
log.info("Repairing visibility")
attr = "{}.visibility".format(control)
locked = cmds.getAttr(attr, lock=True)
if not locked:
print("Locking visibility for %s" % control)
log.info("Locking visibility for %s" % control)
cmds.setAttr(attr, lock=True)
continue
log.info("Repairing matrix")
if not cls.validate_transforms(control):
cmds.xform(control, matrix=identity, objectSpace=True)

View file

@ -2,9 +2,8 @@ import maya.cmds as cmds
import pyblish.api
import colorbleed.api
import cbra.lib
import cbra.utils.maya.node_uuid as id_utils
import colorbleed.maya.lib as lib
import avalon.io as io
class ValidateRigPointcacheRelatedNodeIds(pyblish.api.InstancePlugin):
@ -27,6 +26,17 @@ class ValidateRigPointcacheRelatedNodeIds(pyblish.api.InstancePlugin):
ignore_types = ("constraint",)
def process(self, instance):
"""Process all meshes"""
print ">>>", instance.data
# Ensure all nodes have a cbId
invalid = self.get_invalid(instance)
if invalid:
raise RuntimeError("Nodes found with non-related "
"asset IDs: {0}".format(invalid))
@classmethod
def get_pointcache_nodes(cls, instance):
@ -57,49 +67,23 @@ class ValidateRigPointcacheRelatedNodeIds(pyblish.api.InstancePlugin):
@classmethod
def get_invalid(cls, instance):
# Get a full context from the instance context
context = instance.data['instanceContext']
item_path = context['itemPath']
context = cbra.lib.parse_context(item_path)
invalid_items = []
# get asset id
nodes = cls.get_pointcache_nodes(instance)
def to_item(id):
"""Split the item id part from a node id"""
return id.rsplit(":", 1)[0]
# Generate a fake id in the current context to retrieve the item
# id prefix that should match with ids on the nodes
fake_node = "__node__"
ids = id_utils.generate_ids(context, [fake_node])
id = ids[fake_node]
item_prefix = to_item(id)
# Parse the invalid
invalid = list()
invalid_items = set()
for member in nodes:
member_id = id_utils.get_id(member)
# skip nodes without ids
if not member_id:
continue
if not member_id.startswith(item_prefix):
invalid.append(member)
invalid_items.add(to_item(member_id))
for node in nodes:
node_id = lib.get_id(node)
if not node_id:
invalid_items.append(node)
# Log invalid item ids
if invalid_items:
for item_id in sorted(invalid_items):
cls.log.warning("Found invalid item id: {0}".format(item_id))
return invalid
return invalid_items
def process(self, instance):
"""Process all meshes"""
# Ensure all nodes have a cbId
invalid = self.get_invalid(instance)
if invalid:
raise RuntimeError("Nodes found with non-related "
"asset IDs: {0}".format(invalid))
@staticmethod
def to_item(id):
"""Split the item id part from a node id"""
return id.rsplit(":", 1)[0]

View file

@ -76,6 +76,9 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin):
"name": asset_name,
"parent": project["_id"]})
assert asset, ("No asset found by the name '{}' "
"in project '{}'".format(asset_name, project_name))
subset = io.find_one({"type": "subset",
"name": subset_name,
"parent": asset["_id"]})
@ -87,6 +90,7 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin):
version = io.find_one({"type": "version",
"parent": subset["_id"]},
sort=[("name", -1)])
# if there is a subset there ought to be version
if version is not None:
version_number += version["name"]

View file

@ -1,75 +0,0 @@
@echo OFF
echo Entering Maya2016 environment...
:: Environment: Maya
set CB_MAYA_VERSION=2016
set CB_MAYA_SHARED=%CB_APP_SHARED%\maya_shared\%CB_MAYA_VERSION%
if "%CB_MAYA_SHARED%" == "" (
echo Error: "CB_MAYA_SHARED" not set
goto :eof
)
:: For scripts menu tool
set PYTHONPATH=%CB_PIPELINE%\git\scriptsmenu\python;%PYTHONPATH%
set CB_SCRIPTS=%CB_PIPELINE%\git\cbMayaScripts\cbMayaScripts
set COLORBLEED_SCRIPTS=%CB_SCRIPTS%
:: Colorbleed Maya
set PYTHONPATH=%CB_PIPELINE%\git\cbMayaScripts;%PYTHONPATH%
set PYTHONPATH=%CB_PIPELINE%\git\inventory\python;%PYTHONPATH%
:: Maya shared
set MAYA_PLUG_IN_PATH=%CB_MAYA_SHARED%\plugins;%MAYA_PLUGIN_PATH%
set MAYA_SHELF_PATH=%CB_MAYA_SHARED%\prefs\shelves;%MAYA_SHELF_PATH%
set MAYA_SCRIPT_PATH=%CB_MAYA_SHARED%\scripts;%MAYA_SCRIPT_PATH%
set XBMLANGPATH=%CB_MAYA_SHARED%\prefs\icons;%XBMLANGPATH%
set MAYA_PRESET_PATH=%CB_MAYA_SHARED%\prefs\attrPresets;%MAYA_PRESET_PATH%
set PYTHONPATH=%CB_MAYA_SHARED%\scripts;%PYTHONPATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules;%MAYA_MODULE_PATH%
:: Additional modules
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\mGear_2016;%MAYA_MODULE_PATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\SOuP;%MAYA_MODULE_PATH%
set MAYA_SHELF_PATH=%CB_MAYA_SHARED%\modules\SOuP\shelves;%MAYA_SHELF_PATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\pdipro35c_Maya2016x64;%MAYA_MODULE_PATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\ovdb\maya\maya2016;%MAYA_MODULE_PATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\cvshapeinverter;%MAYA_MODULE_PATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\Toolchefs;%MAYA_MODULE_PATH%
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\Exocortex;%MAYA_MODULE_PATH%
:: Miarmy
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\Basefount\Miarmy;%MAYA_MODULE_PATH%
set PATH=%CB_MAYA_SHARED%\modules\Basefount\Miarmy\bin;%PATH%
set VRAY_PLUGINS_x64=%CB_MAYA_SHARED%\modules\Basefount\Miarmy\bin\vray\vray_3.1_3.3_3.4\Maya2015and2016;%VRAY_PLUGINS_x64%;
:: Yeti
set MAYA_MODULE_PATH=%CB_MAYA_SHARED%\modules\Yeti-v2.1.5_Maya2016-windows64;%MAYA_MODULE_PATH%
set PATH=%CB_MAYA_SHARED%\modules\Yeti-v2.1.5_Maya2016-windows64\bin;%PATH%;
set VRAY_PLUGINS_x64=%CB_MAYA_SHARED%\modules\Yeti-v2.1.5_Maya2016-windows64\bin;%VRAY_PLUGINS_x64%;
set VRAY_FOR_MAYA2016_PLUGINS_x64=%CB_MAYA_SHARED%\modules\Yeti-v2.1.5_Maya2016-windows64\bin;%VRAY_FOR_MAYA2016_PLUGINS_x64%;
set REDSHIFT_MAYAEXTENSIONSPATH=%CB_MAYA_SHARED%\modules\Yeti-v2.1.5_Maya2016-windows64\plug-ins;%REDSHIFT_MAYAEXTENSIONSPATH%
set peregrinel_LICENSE=5053@CBserver
:: maya-capture
set PYTHONPATH=%CB_PIPELINE%\git\maya-capture;%PYTHONPATH%
set PYTHONPATH=%CB_PIPELINE%\git\maya-capture-gui;%PYTHONPATH%
set PYTHONPATH=%CB_PIPELINE%\git\maya-capture-gui-cb;%PYTHONPATH%
:: maya-matrix-deform
set PYTHONPATH=%CB_PIPELINE%\git\maya-matrix-deformers;%PYTHONPATH%
set MAYA_PLUG_IN_PATH=%CB_PIPELINE%\git\maya-matrix-deformers\plugin;%MAYA_PLUG_IN_PATH%
:: rapid-rig
set XBMLANGPATH=%CB_MAYA_SHARED%\scripts\RapidRig_Modular_V02;%XBMLANGPATH%
set MAYA_SCRIPT_PATH=%CB_MAYA_SHARED%\scripts\RapidRig_Modular_V02;%MAYA_SCRIPT_PATH%
:: Fix Maya Playblast Color Management depth
set MAYA_FLOATING_POINT_RT_PLAYBLAST=1
:: Fix V-ray forcing affinity to 100%
set VRAY_USE_THREAD_AFFINITY=0

View file

@ -1,30 +0,0 @@
@echo OFF
echo Entering Python environment...
set CB_PYTHON_VERSION=2.7
where /Q python.exe
if ERRORLEVEL 1 (
if EXIST C:\Python27\python.exe (
echo Adding C:\Python27 to PATH
set "PATH=%PATH%;C:\Python27"
goto:has-python
) else (
echo Adding embedded python (pipeline)
set "PATH=%PATH%;%CB_APP_SHARED%\python\standalone\%CB_PYTHON_VERSION%\bin"
goto:has-python
)
)
:has-python
:: Python universal (non-compiled)
set PYTHONPATH=%PYTHONPATH%;%CB_APP_SHARED%\python\universal\site-packages
:: Python version/windows-specific
:: set PYTHONPATH=%PYTHONPATH%;%CB_APP_SHARED%\python\win\%CB_PYTHON_VERSION%
:: Python standalone (compiled to version)
if NOT "%CB_PYTHON_STANDALONE%" == "0" (
echo Entering Python Standalone environment...
set PYTHONPATH=%PYTHONPATH%;%CB_APP_SHARED%\python\standalone\%CB_PYTHON_VERSION%\site-packages
)

View file

@ -1,30 +0,0 @@
@echo off
echo Entering pipeline (raw development) environment...
:: Initialize environment
set CB_PIPELINE=P:\pipeline\dev
set CB_APP_SHARED=%CB_PIPELINE%\apps
if "%CB_APP_SHARED%" == "" (
echo Error: "CB_APP_SHARED" not set
goto :eof
)
echo setting STORAGE..
set STORAGE=P:
:: Core
echo Add cb core..
set PYTHONPATH=%CB_PIPELINE%\git\cb;%PYTHONPATH%
set PYTHONPATH=%CB_PIPELINE%\git\cbra;%PYTHONPATH%
:: Extra
set PYTHONPATH=%CB_PIPELINE%\git\pyseq;%PYTHONPATH%
set PYTHONPATH=%CB_PIPELINE%\git\Qt.py;%PYTHONPATH%
:: Ftrack-connect
::set PYTHONPATH=%CB_PIPELINE%\git\ftrack-connect\source;%PYTHONPATH%
:: FFMPEG
set FFMPEG_PATH=%CB_APP_SHARED%\ffmpeg\bin\ffmpeg.exe