Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send2UE - Avoid bpy.data.objects iterations #71

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/addons/send2ue/core/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ def export_hair(asset_id, properties):
utilities.deselect_all_objects()

# clear animation transformations prior to export so groom exports with no distortion
# TODO: we apparently need to avoid operating on all objects in bpy.data.objects
for scene_object in bpy.data.objects:
for scene_object in bpy.context.scene.objects:
if scene_object.animation_data:
if scene_object.animation_data.action:
scene_object.animation_data.action = None
Expand Down
6 changes: 3 additions & 3 deletions src/addons/send2ue/core/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def get_current_context():
:return dict: A dictionary of values that are the current context.
"""
object_contexts = {}
for scene_object in bpy.data.objects:
for scene_object in bpy.context.scene.objects:
active_action_name = ''
if scene_object.animation_data and scene_object.animation_data.action:
active_action_name = scene_object.animation_data.action.name
Expand Down Expand Up @@ -972,7 +972,7 @@ def escape_local_view():
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
if area.spaces[0].local_view:
for scene_object in bpy.data.objects:
for scene_object in bpy.context.scene.objects:
scene_object.local_view_set(area.spaces[0], True)


Expand Down Expand Up @@ -1208,7 +1208,7 @@ def deselect_all_objects():
"""
This function deselects all object in the scene.
"""
for scene_object in bpy.data.objects:
for scene_object in bpy.context.scene.objects:
scene_object.select_set(False)


Expand Down
Loading