Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_ops.c
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | EnumPropertyItem rna_enum_transform_mode_types[] = | ||||
| {TFM_ALIGN, "ALIGN", 0, "Align", ""}, | {TFM_ALIGN, "ALIGN", 0, "Align", ""}, | ||||
| {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""}, | {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""}, | ||||
| {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""}, | {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| static int select_orientation_exec(bContext *C, wmOperator *op) | static int select_orientation_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| View3D *v3d = CTX_wm_view3d(C); | |||||
| int orientation = RNA_enum_get(op->ptr, "orientation"); | int orientation = RNA_enum_get(op->ptr, "orientation"); | ||||
| BIF_selectTransformOrientationValue(C, orientation); | BIF_selectTransformOrientationValue(CTX_wm_workspace(C), v3d, orientation); | ||||
| WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); | WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) | static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| uiPopupMenu *pup; | uiPopupMenu *pup; | ||||
| uiLayout *layout; | uiLayout *layout; | ||||
| Show All 25 Lines | static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) | ||||
| RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); | RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); | ||||
| RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); | RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); | ||||
| } | } | ||||
| static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) | static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); | |||||
| BIF_removeTransformOrientationIndex(C, selected_index); | BIF_removeTransformOrientation(C, v3d->custom_orientation); | ||||
| WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); | WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); | ||||
| WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C)); | WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C)); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| { | { | ||||
| return delete_orientation_exec(C, op); | return delete_orientation_exec(C, op); | ||||
| } | } | ||||
| static int delete_orientation_poll(bContext *C) | static int delete_orientation_poll(bContext *C) | ||||
| { | { | ||||
| int selected_index = -1; | |||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| if (ED_operator_areaactive(C) == 0) | if (ED_operator_areaactive(C) == 0) | ||||
| return 0; | return 0; | ||||
| return v3d->custom_orientation != NULL; | |||||
| if (v3d) { | |||||
| selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); | |||||
| } | |||||
| return selected_index >= 0; | |||||
| } | } | ||||
| static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot) | static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Delete Orientation"; | ot->name = "Delete Orientation"; | ||||
| ot->description = "Delete transformation orientation"; | ot->description = "Delete transformation orientation"; | ||||
| ot->idname = "TRANSFORM_OT_delete_orientation"; | ot->idname = "TRANSFORM_OT_delete_orientation"; | ||||
| ▲ Show 20 Lines • Show All 931 Lines • Show Last 20 Lines | |||||