Add base visibility conflict checkers
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import bpy
|
||||
|
||||
from bpy.props import (BoolProperty,
|
||||
EnumProperty,
|
||||
PointerProperty,
|
||||
CollectionProperty,
|
||||
StringProperty)
|
||||
|
||||
from .. import fn
|
||||
|
||||
class RT_OT_select_object_by_name(bpy.types.Operator):
|
||||
bl_idname = "rt.select_object_by_name"
|
||||
bl_label = "Select Object By name"
|
||||
bl_description = "Select object and modifier"
|
||||
bl_options = {"REGISTER", "INTERNAL"}
|
||||
|
||||
object_name: StringProperty(
|
||||
name="Object Name",
|
||||
description="Name of the object to select",
|
||||
default="",
|
||||
options={'SKIP_SAVE'}
|
||||
)
|
||||
|
||||
modifier_name: StringProperty(
|
||||
name="Modifier Name",
|
||||
description="Name of the modifier to show (optional)",
|
||||
default="",
|
||||
options={'SKIP_SAVE'}
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
# Check if object name is provided
|
||||
if not self.object_name:
|
||||
self.report({'ERROR'}, "No object name provided")
|
||||
return {'CANCELLED'}
|
||||
|
||||
# Get the object
|
||||
target_object = context.scene.objects.get(self.object_name)
|
||||
if not target_object:
|
||||
self.report({'WARNING'}, f"Object '{self.object_name}' not found in scene")
|
||||
return {'CANCELLED'}
|
||||
|
||||
# Make it the active object
|
||||
# fn.show_and_active_object(context, target_object, make_active=True, )
|
||||
context.view_layer.objects.active = target_object
|
||||
|
||||
# Handle modifier expansion if modifier name is provided
|
||||
if self.modifier_name:
|
||||
# Check if the object has modifiers
|
||||
if target_object.modifiers:
|
||||
# Look for the specified modifier
|
||||
modifier = target_object.modifiers.get(self.modifier_name)
|
||||
if modifier:
|
||||
# Expand only this modifier
|
||||
for mod in target_object.modifiers:
|
||||
# Collapse all modifiers first
|
||||
mod.show_expanded = mod == modifier
|
||||
|
||||
## Make it the active modifier
|
||||
target_object.modifiers.active = modifier
|
||||
## Show modifier panel
|
||||
fn.set_properties_editor_tab('MODIFIER')
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
classes = (
|
||||
RT_OT_select_object_by_name,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
Reference in New Issue
Block a user