mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-26 13:32:32 +00:00
fix(Blenvy:Blender): fixed issues with delete operator for "custom property" style components
This commit is contained in:
parent
e394edade2
commit
c1e2bb6ecf
@ -152,12 +152,21 @@ class BLENVY_OT_component_remove(Operator):
|
|||||||
|
|
||||||
print("removing component ", self.component_name, "from object '"+target.name+"'")
|
print("removing component ", self.component_name, "from object '"+target.name+"'")
|
||||||
|
|
||||||
if target is not None and 'bevy_components' in target :
|
|
||||||
component_value = get_bevy_component_value_by_long_name(target, self.component_name)
|
if target is not None:
|
||||||
if component_value is not None:
|
if 'bevy_components' in target:
|
||||||
remove_component_from_item(target, self.component_name)
|
component_value = get_bevy_component_value_by_long_name(target, self.component_name)
|
||||||
else :
|
if component_value is not None:
|
||||||
self.report({"ERROR"}, "The component to remove ("+ self.component_name +") does not exist")
|
remove_component_from_item(target, self.component_name)
|
||||||
|
else :
|
||||||
|
self.report({"ERROR"}, "The component to remove ("+ self.component_name +") does not exist")
|
||||||
|
else:
|
||||||
|
# for the classic "custom properties"
|
||||||
|
if self.component_name in target:
|
||||||
|
del target[self.component_name]
|
||||||
|
else:
|
||||||
|
self.report({"ERROR"}, "The component to remove ("+ self.component_name +") does not exist")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.report({"ERROR"}, "The target to remove ("+ self.component_name +") from does not exist")
|
self.report({"ERROR"}, "The target to remove ("+ self.component_name +") from does not exist")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
@ -372,7 +372,7 @@ class BLENVY_PT_component_tools_panel(bpy.types.Panel):
|
|||||||
operator.target_name = target_component_name
|
operator.target_name = target_component_name
|
||||||
col.enabled = internal and registry_has_type_infos and component_name != "" and target_component_name != "" and component_name != target_component_name
|
col.enabled = internal and registry_has_type_infos and component_name != "" and target_component_name != "" and component_name != target_component_name
|
||||||
|
|
||||||
|
#print("target", target, target.name, "component_name", component_name, "item type", get_selection_type(target))
|
||||||
col = row.column()
|
col = row.column()
|
||||||
operator = col.operator("blenvy.component_remove", text="", icon="X")
|
operator = col.operator("blenvy.component_remove", text="", icon="X")
|
||||||
operator.item_name = target.name
|
operator.item_name = target.name
|
||||||
|
Loading…
Reference in New Issue
Block a user