File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -302,4 +302,10 @@ class FileBasedObject(PhysicalObject):
302302 # is used in a physics simulation.
303303 use_parenting_instead_of_join = tl .Bool (False )
304304
305+ # By default, the objects are rotated by 90 degrees around the X axis after
306+ # loading. This is to reproduce the behavior of Blender UI. If this is set to
307+ # True, the object will not be rotated by 90 degrees around the X axis after
308+ # loading.
309+ do_not_rotate_glb_90_degrees_after_import = tl .Bool (False )
310+
305311 # TODO: trigger error when changing filenames or asset-id after the fact
Original file line number Diff line number Diff line change @@ -476,9 +476,10 @@ def _add_asset(self, obj: core.FileBasedObject):
476476 bpy .ops .object .delete ()
477477
478478 assert len (bpy .context .selected_objects ) == 1
479- blender_obj = bpy .context .selected_objects [0 ]
480- blender_obj .rotation_quaternion = (0.707107 , - 0.707107 , 0 , 0 )
481- bpy .ops .object .transform_apply (location = False , rotation = True , scale = False )
479+ if not obj .do_not_rotate_glb_90_degrees_after_import :
480+ blender_obj = bpy .context .selected_objects [0 ]
481+ blender_obj .rotation_quaternion = (0.707107 , - 0.707107 , 0 , 0 )
482+ bpy .ops .object .transform_apply (location = False , rotation = True , scale = False )
482483
483484 elif extension == "fbx" :
484485 bpy .ops .import_scene .fbx (filepath = obj .render_filename ,
You can’t perform that action at this time.
0 commit comments