work
save startup blend for animation tab & whatnot
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
"""
|
||||
Statistics and analysis helpers for Atomic Data Manager.
|
||||
|
||||
Blend-file storage estimates live in ``utils.compat`` (merged there so
|
||||
``bl_ext`` dev deploy cannot miss a separate ``utils/blend_storage`` file).
|
||||
"""
|
||||
@@ -915,6 +915,8 @@ def analyze_unused_from_graph(graph, category, include_fake_users=None):
|
||||
Returns:
|
||||
List of unused item names for the specified category
|
||||
"""
|
||||
from . import users
|
||||
|
||||
if include_fake_users is None:
|
||||
include_fake_users = config.include_fake_users
|
||||
|
||||
@@ -1184,6 +1186,20 @@ def analyze_unused_from_graph(graph, category, include_fake_users=None):
|
||||
item_name = datablock.name
|
||||
if (category, item_name) not in used:
|
||||
if item_name not in category_do_not_flag:
|
||||
# Objects that appear in a scene collection must stay (traceable to a scene), even
|
||||
# if the RNA graph missed them (e.g. mesh parented to an out-of-scene armature).
|
||||
if category == 'objects':
|
||||
try:
|
||||
if users.object_all(item_name):
|
||||
continue
|
||||
except (AttributeError, KeyError, RuntimeError, ReferenceError):
|
||||
pass
|
||||
if category == 'materials':
|
||||
try:
|
||||
if datablock.users > 0 and not datablock.use_fake_user:
|
||||
continue
|
||||
except (AttributeError, RuntimeError, ReferenceError):
|
||||
pass
|
||||
unused.append(item_name)
|
||||
except (AttributeError, RuntimeError, ReferenceError):
|
||||
# Datablock may be invalid
|
||||
|
||||
@@ -223,6 +223,10 @@ def materials_deep():
|
||||
# check if material has a fake user or if ignore fake users
|
||||
# is enabled
|
||||
if not material.use_fake_user or config.include_fake_users:
|
||||
# If Blender still counts users but we found none, don't flag (name collisions
|
||||
# with linked IDs, drivers, or refs we don't traverse). Fake-user purge unchanged.
|
||||
if material.users > 0 and not material.use_fake_user:
|
||||
continue
|
||||
unused.append(material.name)
|
||||
else:
|
||||
# Second check: material is used, but check if it's ONLY used by unused objects
|
||||
|
||||
@@ -127,6 +127,8 @@ def _has_any_unused_materials():
|
||||
# First check: standard unused detection
|
||||
if not users.material_all(material.name):
|
||||
if not material.use_fake_user or config.include_fake_users:
|
||||
if material.users > 0 and not material.use_fake_user:
|
||||
continue
|
||||
return True
|
||||
else:
|
||||
# Second check: material is used, but check if it's ONLY used by unused objects
|
||||
|
||||
@@ -416,8 +416,8 @@ def image_geometry_nodes(image_key):
|
||||
from ..utils import compat
|
||||
|
||||
for obj in bpy.data.objects:
|
||||
# Skip library-linked and override objects
|
||||
if compat.is_library_or_override(obj):
|
||||
# Skip purely linked objects; library overrides can have local GN modifiers (#15)
|
||||
if compat.is_object_linked_without_override(obj):
|
||||
continue
|
||||
|
||||
# Check if object is in any scene collection (reuse object_all logic)
|
||||
@@ -583,8 +583,8 @@ def material_geometry_nodes(material_key):
|
||||
from ..utils import compat
|
||||
|
||||
for obj in bpy.data.objects:
|
||||
# Skip library-linked and override objects
|
||||
if compat.is_library_or_override(obj):
|
||||
# Skip purely linked objects; library overrides can have local GN modifiers (#15)
|
||||
if compat.is_object_linked_without_override(obj):
|
||||
continue
|
||||
|
||||
# Check if object is in any scene collection (reuse object_all logic)
|
||||
|
||||
Reference in New Issue
Block a user