Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_relations.c
| Show First 20 Lines • Show All 294 Lines • ▼ Show 20 Lines | static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| /* Get object to work on - use a menu if we need to... */ | /* Get object to work on - use a menu if we need to... */ | ||||
| if (ob->dup_group && ob->dup_group->id.lib) { | if (ob->dup_group && ob->dup_group->id.lib) { | ||||
| /* gives menu with list of objects in group */ | /* gives menu with list of objects in group */ | ||||
| /* proxy_group_objects_menu(C, op, ob, ob->dup_group); */ | /* proxy_group_objects_menu(C, op, ob, ob->dup_group); */ | ||||
| WM_enum_search_invoke(C, op, event); | WM_enum_search_invoke(C, op, event); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| else if (ob->id.lib) { | else if (ob->id.lib) { | ||||
| uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION); | uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION); | ||||
| uiLayout *layout = uiPupMenuLayout(pup); | uiLayout *layout = UI_popup_menu_layout(pup); | ||||
| /* create operator menu item with relevant properties filled in */ | /* create operator menu item with relevant properties filled in */ | ||||
| uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL, | uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL, | ||||
| WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); | WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); | ||||
| /* present the menu and be done... */ | /* present the menu and be done... */ | ||||
| uiPupMenuEnd(C, pup); | UI_popup_menu_end(C, pup); | ||||
| /* this invoke just calls another instance of this operator... */ | /* this invoke just calls another instance of this operator... */ | ||||
| return OPERATOR_INTERFACE; | return OPERATOR_INTERFACE; | ||||
| } | } | ||||
| else { | else { | ||||
| /* error.. cannot continue */ | /* error.. cannot continue */ | ||||
| BKE_report(op->reports, RPT_ERROR, "Can only make proxy for a referenced object or group"); | BKE_report(op->reports, RPT_ERROR, "Can only make proxy for a referenced object or group"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| ▲ Show 20 Lines • Show All 556 Lines • ▼ Show 20 Lines | static int parent_set_exec(bContext *C, wmOperator *op) | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) | static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE); | uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE); | ||||
| uiLayout *layout = uiPupMenuLayout(pup); | uiLayout *layout = UI_popup_menu_layout(pup); | ||||
| wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", true); | wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", true); | ||||
| PointerRNA opptr; | PointerRNA opptr; | ||||
| #if 0 | #if 0 | ||||
| uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT); | uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT); | ||||
| #else | #else | ||||
| opptr = uiItemFullO_ptr(layout, ot, IFACE_("Object"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); | opptr = uiItemFullO_ptr(layout, ot, IFACE_("Object"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); | ||||
| Show All 24 Lines | #endif | ||||
| } | } | ||||
| /* vertex parenting */ | /* vertex parenting */ | ||||
| if (OB_TYPE_SUPPORT_PARVERT(ob->type)) { | if (OB_TYPE_SUPPORT_PARVERT(ob->type)) { | ||||
| uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX); | uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX); | ||||
| uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI); | uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI); | ||||
| } | } | ||||
| uiPupMenuEnd(C, pup); | UI_popup_menu_end(C, pup); | ||||
| return OPERATOR_INTERFACE; | return OPERATOR_INTERFACE; | ||||
| } | } | ||||
| static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) | static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) | ||||
| { | { | ||||
| const char *prop_id = RNA_property_identifier(prop); | const char *prop_id = RNA_property_identifier(prop); | ||||
| const int type = RNA_enum_get(ptr, "type"); | const int type = RNA_enum_get(ptr, "type"); | ||||
| ▲ Show 20 Lines • Show All 1,537 Lines • ▼ Show 20 Lines | void OBJECT_OT_drop_named_material(wmOperatorType *ot) | ||||
| RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign"); | RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign"); | ||||
| } | } | ||||
| static int object_unlink_data_exec(bContext *C, wmOperator *op) | static int object_unlink_data_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| ID *id; | ID *id; | ||||
| PropertyPointerRNA pprop; | PropertyPointerRNA pprop; | ||||
| uiIDContextProperty(C, &pprop.ptr, &pprop.prop); | UI_context_active_but_prop_get_templateID(C, &pprop.ptr, &pprop.prop); | ||||
| if (pprop.prop == NULL) { | if (pprop.prop == NULL) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Incorrect context for running object data unlink"); | BKE_report(op->reports, RPT_ERROR, "Incorrect context for running object data unlink"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| id = pprop.ptr.id.data; | id = pprop.ptr.id.data; | ||||
| Show All 37 Lines | |||||