From 1ab0b46f2c3c47eac11bd7fe018b097d55f450aa Mon Sep 17 00:00:00 2001 From: JoshQuake Date: Wed, 7 Aug 2024 11:46:25 -0700 Subject: [PATCH] replaced data.objects with context.scene.objects Iterating through bpy.data.objects is against Extensions policy. Replaced instances with bpy.context.scene.objects --- src/addons/send2ue/core/export.py | 3 +-- src/addons/send2ue/core/utilities.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/addons/send2ue/core/export.py b/src/addons/send2ue/core/export.py index 616710f1..086837a6 100644 --- a/src/addons/send2ue/core/export.py +++ b/src/addons/send2ue/core/export.py @@ -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 diff --git a/src/addons/send2ue/core/utilities.py b/src/addons/send2ue/core/utilities.py index 2ce880b2..7c085ab2 100644 --- a/src/addons/send2ue/core/utilities.py +++ b/src/addons/send2ue/core/utilities.py @@ -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 @@ -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) @@ -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)