Skip to content

Commit

Permalink
replaced data.objects with context.scene.objects (#71)
Browse files Browse the repository at this point in the history
Iterating through bpy.data.objects is against Extensions policy. Replaced instances with bpy.context.scene.objects
  • Loading branch information
JoshQuake authored Aug 7, 2024
1 parent 1ed59ed commit 4e7a785
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
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

0 comments on commit 4e7a785

Please sign in to comment.