fix error with info notes
This commit is contained in:
parent
8701aebc91
commit
adc35fac62
68
fn.py
68
fn.py
@ -323,7 +323,6 @@ def get_view_layer_collection(col, vl_col=None, view_layer=None):
|
|||||||
'''return viewlayer collection from collection
|
'''return viewlayer collection from collection
|
||||||
col: the collection to get viewlayer collection from
|
col: the collection to get viewlayer collection from
|
||||||
view_layer (viewlayer, optional) : viewlayer to search in, if not passed, use active viewlayer
|
view_layer (viewlayer, optional) : viewlayer to search in, if not passed, use active viewlayer
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if vl_col is None:
|
if vl_col is None:
|
||||||
if view_layer:
|
if view_layer:
|
||||||
@ -543,4 +542,69 @@ def build_path_from_template(template: str,
|
|||||||
|
|
||||||
return applied_template
|
return applied_template
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
# region visibility states store
|
||||||
|
|
||||||
|
def store_visibility_states(collection=None):
|
||||||
|
"""Store visibility states of objects and collections
|
||||||
|
|
||||||
|
Args:
|
||||||
|
collection: Target collection to scan. If None, scans entire scene starting from root.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: Visibility states for objects, collections, and viewlayer collections
|
||||||
|
"""
|
||||||
|
visibility_states = {
|
||||||
|
'objects': {},
|
||||||
|
'collections': {},
|
||||||
|
'view_layer_collections': {}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine target viewlayer collection
|
||||||
|
if collection is None:
|
||||||
|
target_vl_collection = bpy.context.view_layer.layer_collection
|
||||||
|
else:
|
||||||
|
target_vl_collection = get_view_layer_collection(collection)
|
||||||
|
if target_vl_collection is None:
|
||||||
|
# Collection not found in current viewlayer
|
||||||
|
return visibility_states
|
||||||
|
|
||||||
|
# Store visibility states by iterating through viewlayer collections
|
||||||
|
def store_visibility_recursive(vl_col):
|
||||||
|
# Get the actual collection from viewlayer collection
|
||||||
|
col = vl_col.collection
|
||||||
|
|
||||||
|
# Store collection visibility states
|
||||||
|
visibility_states['collections'][col.name] = {
|
||||||
|
'hide_select': getattr(col, 'hide_select', False),
|
||||||
|
'hide_viewport': getattr(col, 'hide_viewport', False),
|
||||||
|
'hide_render': getattr(col, 'hide_render', False),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Store viewlayer collection visibility states
|
||||||
|
visibility_states['view_layer_collections'][vl_col.name] = {
|
||||||
|
'exclude': getattr(vl_col, 'exclude', False),
|
||||||
|
'hide_viewport': getattr(vl_col, 'hide_viewport', False),
|
||||||
|
'indirect_only': getattr(vl_col, 'indirect_only', False),
|
||||||
|
'holdout': getattr(vl_col, 'indirect_only', False),
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Store objects in this collection
|
||||||
|
for obj in col.objects:
|
||||||
|
if obj.name not in visibility_states['objects']: # Avoid duplicates
|
||||||
|
visibility_states['objects'][obj.name] = {
|
||||||
|
'hide_viewport': obj.hide_viewport,
|
||||||
|
'hide_render': obj.hide_render,
|
||||||
|
'hide_select': obj.hide_select,
|
||||||
|
'hide_viewlayer': obj.hide_get(),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Recursively process children
|
||||||
|
for child_vl_col in vl_col.children:
|
||||||
|
store_visibility_recursive(child_vl_col)
|
||||||
|
|
||||||
|
store_visibility_recursive(target_vl_collection)
|
||||||
|
|
||||||
|
return visibility_states
|
||||||
|
@ -99,7 +99,7 @@ class RT_OT_scene_checker(Operator):
|
|||||||
# Show in viewport
|
# Show in viewport
|
||||||
# title = "Changed Settings" if apply else "Checked Settings (nothing changed)"
|
# title = "Changed Settings" if apply else "Checked Settings (nothing changed)"
|
||||||
title = "Visibility checks report (details in console)"
|
title = "Visibility checks report (details in console)"
|
||||||
fn.show_message_box(problems, _title = title, _icon = 'INFO')
|
fn.show_message_box(problems, title=title, icon='INFO')
|
||||||
else:
|
else:
|
||||||
self.report({'INFO'}, 'All good')
|
self.report({'INFO'}, 'All good')
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class RT_OT_info_note(Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
## Split text in list of lines to display
|
## Split text in list of lines to display
|
||||||
lines = self.text.split('\n')
|
lines = self.text.split('\n')
|
||||||
fn.show_message_box(_message=lines, _title=self.title, _icon=self.icon)
|
fn.show_message_box(message=lines, title=self.title, icon=self.icon)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
# Not registered yet
|
# Not registered yet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user