Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/geometry/geometry_attributes.c
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| static bool geometry_attributes_poll(bContext *C) | static bool geometry_attributes_poll(bContext *C) | ||||
| { | { | ||||
| Object *ob = ED_object_context(C); | Object *ob = ED_object_context(C); | ||||
| ID *data = (ob) ? ob->data : NULL; | ID *data = (ob) ? ob->data : NULL; | ||||
| return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data)) && | return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data)) && | ||||
| BKE_id_attributes_supported(data); | BKE_id_attributes_supported(data); | ||||
| } | } | ||||
| static bool geometry_attributes_remove_poll(bContext *C) | |||||
| { | |||||
| if (!geometry_attributes_poll(C)) { | |||||
| return false; | |||||
| } | |||||
| Object *ob = ED_object_context(C); | |||||
| ID *data = (ob) ? ob->data : NULL; | |||||
| if (BKE_id_attributes_active_get(data) != NULL) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C, | static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C, | ||||
| PointerRNA *UNUSED(ptr), | PointerRNA *UNUSED(ptr), | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | bool *r_free) | ||||
| { | { | ||||
| if (C == NULL) { | if (C == NULL) { | ||||
| return DummyRNA_NULL_items; | return DummyRNA_NULL_items; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Remove Geometry Attribute"; | ot->name = "Remove Geometry Attribute"; | ||||
| ot->description = "Remove attribute from geometry"; | ot->description = "Remove attribute from geometry"; | ||||
| ot->idname = "GEOMETRY_OT_attribute_remove"; | ot->idname = "GEOMETRY_OT_attribute_remove"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = geometry_attribute_remove_exec; | ot->exec = geometry_attribute_remove_exec; | ||||
| ot->poll = geometry_attributes_poll; | ot->poll = geometry_attributes_remove_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||