diff --git a/openpype/hosts/blender/plugins/publish/validate_no_colons_in _name.py b/openpype/hosts/blender/plugins/publish/validate_no_colons_in _name.py new file mode 100644 index 0000000000..261ff864d5 --- /dev/null +++ b/openpype/hosts/blender/plugins/publish/validate_no_colons_in _name.py @@ -0,0 +1,39 @@ +from typing import List + +import pyblish.api +import openpype.hosts.blender.api.action + + +class ValidateNoColonsInName(pyblish.api.InstancePlugin): + """There cannot be colons in names + + Object or bone names cannot include colons. Other software do not + handle colons correctly. + + """ + + order = openpype.api.ValidateContentsOrder + hosts = ["blender"] + families = ["model", "rig"] + version = (0, 1, 0) + label = "No Colons in names" + actions = [openpype.hosts.blender.api.action.SelectInvalidAction] + + @classmethod + def get_invalid(cls, instance) -> List: + invalid = [] + for obj in [obj for obj in instance]: + if ':' in obj.name: + invalid.append(obj) + if obj.type == 'ARMATURE': + for bone in obj.data.bones: + if ':' in bone.name: + invalid.append(obj) + break + return invalid + + def process(self, instance): + invalid = self.get_invalid(instance) + if invalid: + raise RuntimeError( + f"Objects found with colon in name: {invalid}") diff --git a/openpype/hosts/blender/plugins/publish/validate_transform_zero.py b/openpype/hosts/blender/plugins/publish/validate_transform_zero.py new file mode 100644 index 0000000000..7456dbc423 --- /dev/null +++ b/openpype/hosts/blender/plugins/publish/validate_transform_zero.py @@ -0,0 +1,40 @@ +from typing import List + +import mathutils + +import pyblish.api +import openpype.hosts.blender.api.action + + +class ValidateTransformZero(pyblish.api.InstancePlugin): + """Transforms can't have any values + + To solve this issue, try freezing the transforms. So long + as the transforms, rotation and scale values are zero, + you're all good. + + """ + + order = openpype.api.ValidateContentsOrder + hosts = ["blender"] + families = ["model"] + category = "geometry" + version = (0, 1, 0) + label = "Transform Zero" + actions = [openpype.hosts.blender.api.action.SelectInvalidAction] + + _identity = mathutils.Matrix() + + @classmethod + def get_invalid(cls, instance) -> List: + invalid = [] + for obj in [obj for obj in instance]: + if obj.matrix_basis != cls._identity: + invalid.append(obj) + return invalid + + def process(self, instance): + invalid = self.get_invalid(instance) + if invalid: + raise RuntimeError( + f"Object found in instance is not in Object Mode: {invalid}")