Export to fbx with collection batch results in wrong frame rate #103425

Open
opened 2022-12-23 01:12:14 +01:00 by Bungle · 2 comments

System Information
Operating system: Windows 11
Graphics card: Intel UHD graphics 730 (i5-12400)

Blender Version
Broken:
3.4.1, 55485cb379f7, blender-v3.4-release
3.2.1, a2d59b2dac9e, master

Worked:

Short description of error
When I used export to fbx with Batch Mode set to Collection, frame rate will be set to 24fps.

Exact steps for others to reproduce the error

  1. Open default blender scene

  2. Set frame rate to 60

  3. Export to fbx with Batch Mode set to Collection

  4. Import back and frame rate is reset to 24

**System Information** Operating system: Windows 11 Graphics card: Intel UHD graphics 730 (i5-12400) **Blender Version** Broken: 3.4.1, 55485cb379f7, blender-v3.4-release 3.2.1, a2d59b2dac9e, master Worked: **Short description of error** When I used export to fbx with Batch Mode set to Collection, frame rate will be set to 24fps. **Exact steps for others to reproduce the error** 1. Open default blender scene 2. Set frame rate to 60 3. Export to fbx with Batch Mode set to Collection 4. Import back and frame rate is reset to 24
Author

Added subscriber: @Bungle

Added subscriber: @Bungle
Author

It seems when using export with collection batch mode(including SCENE_COLLECTION and ACTIVE_SCENE_COLLECTION), addon creates a dummy scene during process but does not copy original scene data to dummy scene. FPS data is one of those.

For workaround you can go to scripts/addons/io_scene_fbx/export_fbx_bin.py and add a few lines:

def save(operator, context,
         filepath="",
         use_selection=False,
         use_visible=False,
         use_active_collection=False,
         batch_mode='OFF',
         use_batch_own_dir=False,
         **kwargs
         ):

...

            if batch_mode in {'COLLECTION', 'SCENE_COLLECTION', 'ACTIVE_SCENE_COLLECTION'}:
                # Collection, so that objects update properly, add a dummy scene.
                scene = bpy.data.scenes.new(name="FBX_Temp")

                # Workaround start
                scene.render.fps = context.scene.render.fps
                scene.render.fps_base = context.scene.render.fps_base
                # Workaround end

                src_scenes = {}  # Count how much each 'source' scenes are used.
                for obj in getattr(data, data_obj_propname):
                    for src_sce in obj.users_scene:
                        src_scenes[src_sce] = src_scenes.setdefault(src_sce, 0) + 1
                    scene.collection.objects.link(obj)

In blender 3.4.1 release, that part is at line 3289.

This is a workaround for simple cases like mine, using many collections within a single scene.
If any other scene info like fps is missing, I guess you can do something similar to to copy the data.

It seems when using export with collection batch mode(including SCENE_COLLECTION and ACTIVE_SCENE_COLLECTION), addon creates a dummy scene during process but does not copy original scene data to dummy scene. FPS data is one of those. For workaround you can go to scripts/addons/io_scene_fbx/export_fbx_bin.py and add a few lines: ``` def save(operator, context, filepath="", use_selection=False, use_visible=False, use_active_collection=False, batch_mode='OFF', use_batch_own_dir=False, **kwargs ): ... if batch_mode in {'COLLECTION', 'SCENE_COLLECTION', 'ACTIVE_SCENE_COLLECTION'}: # Collection, so that objects update properly, add a dummy scene. scene = bpy.data.scenes.new(name="FBX_Temp") # Workaround start scene.render.fps = context.scene.render.fps scene.render.fps_base = context.scene.render.fps_base # Workaround end src_scenes = {} # Count how much each 'source' scenes are used. for obj in getattr(data, data_obj_propname): for src_sce in obj.users_scene: src_scenes[src_sce] = src_scenes.setdefault(src_sce, 0) + 1 scene.collection.objects.link(obj) ``` In blender 3.4.1 release, that part is at line 3289. This is a workaround for simple cases like mine, using many collections within a single scene. If any other scene info like fps is missing, I guess you can do something similar to to copy the data.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#103425
No description provided.