gregzaal / Gaffer

A light-manager add-on for Blender
386 stars 30 forks source link

API change in beta 2.81 builds for Mapping node #111

Closed MarshmallowCirno closed 5 years ago

MarshmallowCirno commented 5 years ago

I'm writing this to let you know that there are API changes in beta 2.81 builds. Namely Mapping node was changed and it no longer has rotation, translation and scale attributes. See https://github.com/KhronosGroup/glTF-Blender-IO/issues/661

I fixed it by changing uses_default_values function (line 888)

    defaults_dict = {
        "ShaderNodeMapping": {
            "vector_type": "POINT",
            "_socket_0": Vector((0, 0, 0)),
            "_socket_1": Euler((0, 0, 0)),
            "_socket_2": Vector((1, 1, 1)),
        },

and update_rotation function (line 1140)

    n.inputs['Rotation'].default_value[2] = radians(gaf_props.hdri_rotation)

    e = 2
    n.inputs['Location'].default_value[2] = pow(gaf_props.hdri_horz_shift, e) * 2
    n.inputs['Scale'].default_value[2] = pow(1 - ((gaf_props.hdri_horz_exp * 2 - 1) * pow(gaf_props.hdri_horz_shift, e)), e)

in functions.py