Skip to content

Commit

Permalink
Merge pull request #285 from MozillaReality/fix-import-error-reporting
Browse files Browse the repository at this point in the history
Fix things related to scene-grababbles
  • Loading branch information
keianhzo committed May 13, 2024
2 parents 87074ec + 2ea175f commit 7eb5656
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 30 deletions.
12 changes: 3 additions & 9 deletions addons/io_hubs_addon/components/definitions/physics_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,15 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_

@classmethod
def gather_import(cls, gltf, blender_host, component_name, component_value, import_report, blender_ob=None):
HubsComponent.gather_import(gltf, blender_host, component_name,
component_value, import_report, blender_ob)

gltf_yup = gltf.import_settings.get('gltf_yup', True)

blender_component = import_component(component_name, blender_host)
for property_name, property_value in component_value.items():
if property_name == 'offset' and gltf_yup:
property_value['y'], property_value['z'] = property_value['z'], property_value['y']

assign_property(gltf.vnodes, blender_component,
property_name, property_value)

elif property_name == 'halfExtents':
elif property_name == 'halfExtents' and gltf_yup:
property_value['y'], property_value['z'] = property_value['z'], property_value['y']

assign_property(gltf.vnodes, blender_component,
property_name, property_value)
assign_property(gltf.vnodes, blender_component,
property_name, property_value)
26 changes: 10 additions & 16 deletions addons/io_hubs_addon/components/definitions/rigid_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,30 +170,24 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_

@classmethod
def gather_import(cls, gltf, blender_host, component_name, component_value, import_report, blender_ob=None):
HubsComponent.gather_import(gltf, blender_host, component_name,
component_value, import_report, blender_ob)

gltf_yup = gltf.import_settings.get('gltf_yup', True)

blender_component = import_component(component_name, blender_host)
for property_name, property_value in component_value.items():
if property_name == 'gravity' and gltf_yup:
property_value[1], property_value[2] = property_value[2], property_value[1]

assign_property(gltf.vnodes, blender_component,
property_name, property_value)

elif property_name == 'angularFactor':
elif property_name == 'angularFactor' and gltf_yup:
property_value[1], property_value[2] = property_value[2], property_value[1]

assign_property(gltf.vnodes, blender_component,
property_name, property_value)

elif property_name == 'collisionMask':
blender_component.collisionMask = [
'objects' in component_value['collisionMask'],
'triggers' in component_value['collisionMask'],
'environment' in component_value['collisionMask'],
'avatars' in component_value['collisionMask'],
'media-frames' in component_value['collisionMask'],
property_value = [
'objects' in property_value,
'triggers' in property_value,
'environment' in property_value,
'avatars' in property_value,
'media-frames' in property_value,
]

assign_property(gltf.vnodes, blender_component,
property_name, property_value)
7 changes: 2 additions & 5 deletions addons/io_hubs_addon/components/hubs_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,8 @@ def gather(self, export_settings, object):
def gather_import(cls, gltf, blender_host, component_name, component_value, import_report, blender_ob=None):
component = import_component(component_name, blender_host)
for property_name, property_value in component_value.items():
try:
assign_property(gltf.vnodes, component,
property_name, property_value)
except Exception as err:
print(err)
assign_property(gltf.vnodes, component,
property_name, property_value)

def post_export(self, export_settings, host, ob=None):
'''This is called by the exporter after the export process has finished'''
Expand Down

0 comments on commit 7eb5656

Please sign in to comment.