[Bf-extensions-cvs] [4a522d35] master: Amaranth: Fix Debug feature to list users of image datablocks

Pablo Vazquez noreply at git.blender.org
Sun Jul 24 04:35:58 CEST 2022


Commit: 4a522d353a585e6986ac7c98c1d0decadc7db916
Author: Pablo Vazquez
Date:   Sun Jul 24 04:26:46 2022 +0200
Branches: master
https://developer.blender.org/rBA4a522d353a585e6986ac7c98c1d0decadc7db916

Amaranth: Fix Debug feature to list users of image datablocks

The code was looking for background images in the 3D Viewport, which have
been moved to Camera objects in 2.8.

Fixes T98252

===================================================================

M	amaranth/__init__.py
M	amaranth/scene/debug.py

===================================================================

diff --git a/amaranth/__init__.py b/amaranth/__init__.py
index 06a42c8e..e63f0cb9 100644
--- a/amaranth/__init__.py
+++ b/amaranth/__init__.py
@@ -74,7 +74,7 @@ from amaranth.misc import (
 bl_info = {
     "name": "Amaranth Toolset",
     "author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez, CansecoGPC",
-    "version": (1, 0, 10),
+    "version": (1, 0, 11),
     "blender": (3, 2, 0),
     "location": "Everywhere!",
     "description": "A collection of tools and settings to improve productivity",
diff --git a/amaranth/scene/debug.py b/amaranth/scene/debug.py
index 38692743..a73d688e 100755
--- a/amaranth/scene/debug.py
+++ b/amaranth/scene/debug.py
@@ -65,7 +65,7 @@ class AMTH_store_data():
         'TEXTURE': [],             # Textures (Psys, Brushes)
         'MODIFIER': [],            # Modifiers
         'MESH_DATA': [],           # Vertex Colors
-        'VIEW3D': [],              # Background Images
+        'OUTLINER_OB_CAMERA': [],  # Background Images
         'NODETREE': [],            # Compositor
         }
     libraries = []                 # Libraries x type
@@ -632,6 +632,7 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
 
                                     if name not in AMTH_store_data.users['MATERIAL']:
                                         AMTH_store_data.users['MATERIAL'].append(name)
+
             # Check Lights
             for la in d.lights:
                 # Cycles
@@ -643,6 +644,7 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
                                    no.image and no.image.name == x:
                                 if la.name not in AMTH_store_data.users['LIGHT']:
                                     AMTH_store_data.users['LIGHT'].append(la.name)
+
             # Check World
             for wo in d.worlds:
                 # Cycles
@@ -654,6 +656,7 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
                                    no.image and no.image.name == x:
                                 if wo.name not in AMTH_store_data.users['WORLD']:
                                     AMTH_store_data.users['WORLD'].append(wo.name)
+
             # Check Textures
             for te in d.textures:
                 if te and te.type == 'IMAGE' and te.image:
@@ -662,6 +665,7 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
                     if name == x and \
                             name not in AMTH_store_data.users['TEXTURE']:
                         AMTH_store_data.users['TEXTURE'].append(te.name)
+
             # Check Modifiers in Objects
             for ob in d.objects:
                 for mo in ob.modifiers:
@@ -672,21 +676,19 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
                             name = '"{0}" modifier in {1}'.format(mo.name, ob.name)
                             if name not in AMTH_store_data.users['MODIFIER']:
                                 AMTH_store_data.users['MODIFIER'].append(name)
-            # Check Background Images in Viewports
-            for scr in d.screens:
-                for ar in scr.areas:
-                    if ar.type == 'VIEW_3D':
-                        if ar.spaces and \
-                               ar.spaces.active and \
-                               ar.spaces.active.background_images:
-                            for bg in ar.spaces.active.background_images:
-                                image = bg.image
-
-                                if bg and image and image.name == x:
-                                    name = 'Background for 3D Viewport in Screen "{0}"'\
-                                            .format(scr.name)
-                                    if name not in AMTH_store_data.users['VIEW3D']:
-                                        AMTH_store_data.users['VIEW3D'].append(name)
+
+            # Check Background Images in Cameras
+            for ob in d.objects:
+                if ob and ob.type == 'CAMERA' and ob.data.background_images:
+                    for bg in ob.data.background_images:
+                        image = bg.image
+
+                        if bg and image and image.name == x:
+                            name = 'Used as background for Camera "{0}"'\
+                                    .format(ob.name)
+                            if name not in AMTH_store_data.users['OUTLINER_OB_CAMERA']:
+                                AMTH_store_data.users['OUTLINER_OB_CAMERA'].append(name)
+
             # Check the Compositor
             for sce in d.scenes:
                 if sce.node_tree and sce.node_tree.nodes:



More information about the Bf-extensions-cvs mailing list