Пример #1
0
def fix_weights():
    for object_ in get_type("skins"):
        override = get_3d_context(object_)
        try:
            bpy.ops.object.vertex_group_normalize_all(override,
                                                      lock_active=False)
        except:
            raise exceptions.BCryException(
                "Please fix weightless vertices first.")
    bcPrint("Weights Corrected.")
Пример #2
0
def get_armature_from_node(group):
    armature_count = 0
    armature = None
    for object_ in group.objects:
        if object_.type == "ARMATURE":
            armature_count += 1
            armature = object_

    if armature_count == 1:
        return armature

    error_message = None
    if armature_count == 0:
        raise exceptions.BCryException("i_caf node has no armature!")
        error_message = "i_caf node has no armature!"
    elif armature_count > 1:
        raise exceptions.BCryException(
            "{} i_caf node have more than one armature!".format(node_name))

    return None
Пример #3
0
    def pump(self, message, message_type='info', newline=False):
        if newline:
            print()

        if message_type == 'info':
            print("[Info] BCry: {!r}".format(message))

        elif message_type == 'debug':
            print("[Debug] BCry: {!r}".format(message))

        elif message_type == 'warning':
            print("[Warning] BCry: {!r}".format(message))

        elif message_type == 'error':
            print("[Error] BCry: {!r}".format(message))

        else:
            raise exceptions.BCryException(
                "No such message type {!r}".format(message_type))
Пример #4
0
def get_material_name(material_name):
    try:
        return material_name.split('__')[2]
    except:
        raise exceptions.BCryException(
            "Material name is not convenient for BCry!")