Fix problem in viz conflict check
parent
186229cdba
commit
3695470354
|
@ -600,22 +600,17 @@ class GPTB_OT_list_object_visibility_conflicts(bpy.types.Operator):
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
visibility_items: CollectionProperty(type=GPTB_PG_object_visibility) # type: ignore[valid-type]
|
visibility_items: CollectionProperty(type=GPTB_PG_object_visibility) # type: ignore[valid-type]
|
||||||
|
|
||||||
## options:
|
|
||||||
# check_viewlayer : BoolProperty(name="Check Viewlayer", default=False, description="Compare viewlayer (eye) visibility")
|
|
||||||
# check_viewport : BoolProperty(name="Check Viewport", default=False, description="Compare Viewport (screen icon) visibility")
|
|
||||||
# check_render : BoolProperty(name="Check Viewport", default=False, description="Compare Render visibility")
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
# Clear and rebuild both collections
|
# Clear and rebuild both collections
|
||||||
self.visibility_items.clear()
|
self.visibility_items.clear()
|
||||||
|
|
||||||
# Store objects with conflicts
|
# Store objects with conflicts
|
||||||
# objects_with_conflicts = [o for o in context.scene.objects if not (o.hide_get() == o.hide_viewport == o.hide_render)]
|
## TODO: Maybe better (but less detailed) to just check o.visible_get (global visiblity) against render viz ?
|
||||||
|
objects_with_conflicts = [o for o in context.scene.objects if not (o.hide_get() == o.hide_viewport == o.hide_render)]
|
||||||
|
|
||||||
# Create visibility items in same order
|
# Create visibility items in same order
|
||||||
for obj in context.scene.objects: # objects_with_conflicts
|
for obj in objects_with_conflicts:
|
||||||
item = self.visibility_items.add()
|
item = self.visibility_items.add()
|
||||||
item.object_name = obj.name
|
item.object_name = obj.name
|
||||||
item["is_hidden"] = obj.hide_get()
|
item["is_hidden"] = obj.hide_get()
|
||||||
|
@ -624,10 +619,6 @@ class GPTB_OT_list_object_visibility_conflicts(bpy.types.Operator):
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
# row.prop(self, "check_viewlayer")
|
|
||||||
# row.prop(self, "check_viewport")
|
|
||||||
# row.prop(self, "check_render")
|
|
||||||
## If filtered by prop, displayed list will resize while applying changes ! (not good)
|
|
||||||
|
|
||||||
# Add sync buttons at the top
|
# Add sync buttons at the top
|
||||||
row = layout.row(align=False)
|
row = layout.row(align=False)
|
||||||
|
@ -649,7 +640,7 @@ class GPTB_OT_list_object_visibility_conflicts(bpy.types.Operator):
|
||||||
|
|
||||||
## Viewlayer visibility "as prop" to allow slide toggle
|
## Viewlayer visibility "as prop" to allow slide toggle
|
||||||
# hide_icon='HIDE_ON' if vis_item.is_hidden else 'HIDE_OFF'
|
# hide_icon='HIDE_ON' if vis_item.is_hidden else 'HIDE_OFF'
|
||||||
hide_icon='HIDE_ON' if obj.hide_get() else 'HIDE_OFF'
|
hide_icon='HIDE_ON' if obj.hide_get() else 'HIDE_OFF' # based on object state
|
||||||
row.prop(vis_item, "is_hidden", text="", icon=hide_icon, emboss=False)
|
row.prop(vis_item, "is_hidden", text="", icon=hide_icon, emboss=False)
|
||||||
|
|
||||||
# Direct object properties
|
# Direct object properties
|
||||||
|
|
Loading…
Reference in New Issue