From 96b3e063ba766ca79bd1c2b5b7b80964cde586bf Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Fri, 4 Jun 2021 11:26:37 +0100 Subject: [PATCH] Code refinement --- openpype/hosts/blender/plugins/load/load_abc.py | 5 ++--- openpype/hosts/blender/plugins/load/load_fbx_model.py | 5 ++--- openpype/hosts/blender/plugins/load/load_model.py | 11 +++-------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/openpype/hosts/blender/plugins/load/load_abc.py b/openpype/hosts/blender/plugins/load/load_abc.py index 7261e002f1..522a7fd63a 100644 --- a/openpype/hosts/blender/plugins/load/load_abc.py +++ b/openpype/hosts/blender/plugins/load/load_abc.py @@ -161,9 +161,8 @@ class CacheModelLoader(plugin.AssetLoader): "family": context["representation"]["context"]["family"] } - nodes = objects - self[:] = nodes - return nodes + self[:] = objects + return objects def update(self, container: Dict, representation: Dict): """Update the loaded asset. diff --git a/openpype/hosts/blender/plugins/load/load_fbx_model.py b/openpype/hosts/blender/plugins/load/load_fbx_model.py index 776217e5f1..0e49eada3f 100644 --- a/openpype/hosts/blender/plugins/load/load_fbx_model.py +++ b/openpype/hosts/blender/plugins/load/load_fbx_model.py @@ -157,9 +157,8 @@ class FbxModelLoader(plugin.AssetLoader): "family": context["representation"]["context"]["family"] } - nodes = objects - self[:] = nodes - return nodes + self[:] = objects + return objects def update(self, container: Dict, representation: Dict): """Update the loaded asset. diff --git a/openpype/hosts/blender/plugins/load/load_model.py b/openpype/hosts/blender/plugins/load/load_model.py index a6ace64254..ff2d526d10 100644 --- a/openpype/hosts/blender/plugins/load/load_model.py +++ b/openpype/hosts/blender/plugins/load/load_model.py @@ -29,7 +29,6 @@ class BlendModelLoader(plugin.AssetLoader): def _remove(self, asset_group): objects = list(asset_group.children) - empties = [] for obj in objects: if obj.type == 'MESH': @@ -38,10 +37,7 @@ class BlendModelLoader(plugin.AssetLoader): bpy.data.meshes.remove(obj.data) elif obj.type == 'EMPTY': objects.extend(obj.children) - empties.append(obj) - - for empty in empties: - bpy.data.objects.remove(empty) + bpy.data.objects.remove(obj) def _process(self, libpath, asset_group, group_name): relative = bpy.context.preferences.filepaths.use_relative_paths @@ -145,9 +141,8 @@ class BlendModelLoader(plugin.AssetLoader): "family": context["representation"]["context"]["family"] } - nodes = objects - self[:] = nodes - return nodes + self[:] = objects + return objects def update(self, container: Dict, representation: Dict): """Update the loaded asset.