Skip to content

Commit

Permalink
Merge pull request #8 from MozillaReality/fix-regressions
Browse files Browse the repository at this point in the history
Fix regressions in 2.83 release
  • Loading branch information
netpro2k authored Jun 16, 2020
2 parents 60abe2e + cdaa1dc commit b5899c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,19 @@ def patched_gather_gltf(exporter, export_settings):
export_user_extensions('hubs_gather_gltf_hook', export_settings, exporter._GlTF2Exporter__gltf)
exporter._GlTF2Exporter__traverse(exporter._GlTF2Exporter__gltf.extensions)

# Monkey patch to add gather_joint_hook, has been merged upstrea for Blender 2.9 without the hubs_ prefix and should be removed once that ships
from io_scene_gltf2.blender.exp import gltf2_blender_gather_joints
from io_scene_gltf2.io.exp.gltf2_io_user_extensions import export_user_extensions
orig_gather_joint = gltf2_blender_gather_joints.gather_joint
def patched_gather_joint(blender_object, blender_bone, export_settings):
node = orig_gather_joint(blender_object, blender_bone, export_settings)
export_user_extensions('hubs_gather_joint_hook', export_settings, node, blender_bone)
return node


def register():
gltf2_blender_export.__gather_gltf = patched_gather_gltf
gltf2_blender_gather_joints.gather_joint = patched_gather_joint

components.register()
settings.register()
Expand All @@ -45,6 +56,7 @@ def register():

def unregister():
gltf2_blender_export.__gather_gltf = orig_gather_gltf
gltf2_blender_gather_joints.gather_joint = orig_gather_joint

components.unregister()
settings.unregister()
Expand Down Expand Up @@ -118,7 +130,7 @@ def gather_material_hook(self, gltf2_object, blender_material, export_settings):
required=False,
)

def gather_joint_hook(self, gltf2_object, blender_pose_bone, export_settings):
def hubs_gather_joint_hook(self, gltf2_object, blender_pose_bone, export_settings):
if not self.properties.enabled: return

self.add_hubs_components(gltf2_object, blender_pose_bone.bone, export_settings)
Expand Down
2 changes: 2 additions & 0 deletions gather_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def gather_lightmap_texture_info(blender_material, export_settings):
nodes = blender_material.node_tree.nodes
lightmap_node = next((n for n in nodes if isinstance(n, MozLightmapNode)), None)

if not lightmap_node: return

texture = lightmap_node.inputs.get("Lightmap")
intensity = lightmap_node.intensity

Expand Down

0 comments on commit b5899c6

Please sign in to comment.