Exemplo n.º 1
0
def getMinecraftTransform(context, originCoords, object):
    # getTransform() returns blenderCoords - startCoords, and we need blenderCoords + originCoords(Blender), 
    # so if we substitute startCoords with the opposite of originCoords, getTransform() does all the work for us.

    originCoordsBlender = transform_utils.convertLoc(originCoords)
    loc, rot = transform_utils.getTransform(context, object, originCoordsBlender*-1)
    
    return loc, rot
Exemplo n.º 2
0
def write_frame(context, object, startCoords, frame):
    context.scene.frame_set(frame)

    location, rotation = transform_utils.getTransform(context, object,
                                                      startCoords)

    frame = {"loc": location, "rot": rotation}

    return frame
def write_frame(context, object, startCoords, frame):
    context.scene.frame_set(frame)

    location = transform_utils.getTransform(context, object, startCoords)[0]

    # construct frame
    frame = {
        "loc": location,
        "rot": [0, 0],
        "pose": {
            "Body": [0, 0, 0],
            "LeftArm": [0, 0, 0],
            "RightArm": [0, 0, 0],
            "LeftLeg": [0, 0, 0],
            "RightLeg": [0, 0, 0],
            "Head":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(object), True)
        }
    }

    return frame
Exemplo n.º 4
0
def write_frame(context, object, startCoords, frame):
    context.scene.frame_set(frame)

    location, rotation = transform_utils.getTransform(context, object,
                                                      startCoords)

    # get all the bones in the armature
    bones = object.pose.bones

    # construct frame
    frame = {
        "loc": location,
        "rot": rotation,
        "pose": {
            "Body":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(bones['body']), False),
            "LeftArm":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(bones['left_arm']), False),
            "RightArm":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(bones['right_arm']), False),
            "LeftLeg":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(bones['left_leg']), False),
            "RightLeg":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(bones['right_leg']), False),
            "Head":
            transform_utils.rotation_to_array(
                transform_utils.get_rotation(bones['head']), True)
        }
    }

    return frame
Exemplo n.º 5
0
def write_frame(context, object, startCoords, frame):
    context.scene.frame_set(frame)

    location, rotation = transform_utils.getTransform(context, object,
                                                      startCoords)

    # get all the bones in the armature
    bones = object.pose.bones

    body_v = transform_utils.get_rotation(bones['body'])
    left_arm_v = transform_utils.get_rotation(bones['left_arm'])
    right_arm_v = transform_utils.get_rotation(bones['right_arm'])
    left_leg_v = transform_utils.get_rotation(bones['left_leg'])
    right_leg_v = transform_utils.get_rotation(bones['right_leg'])
    head_v = transform_utils.get_rotation(bones['head'])

    # construct frame
    frame = {
        "location": {
            "x": location[0],
            "y": location[1],
            "z": location[2]
        },
        "rotation": {
            "x": rotation[0],
            "z": rotation[1]
        },
        "pose": {
            "body": {
                "x": body_v[0],
                "y": body_v[1],
                "z": body_v[2]
            },
            "leftArm": {
                "x": left_arm_v[0],
                "y": left_arm_v[1],
                "z": left_arm_v[2]
            },
            "rightArm": {
                "x": right_arm_v[0],
                "y": right_arm_v[1],
                "z": right_arm_v[2]
            },
            "leftLeg": {
                "x": left_leg_v[0],
                "y": left_leg_v[1],
                "z": left_leg_v[2]
            },
            "rightLeg": {
                "x": right_leg_v[0],
                "y": right_leg_v[1],
                "z": right_leg_v[2]
            },
            "head": {
                "x": head_v[0],
                "y": head_v[1],
                "z": head_v[2]
            }
        }
    }

    return frame