Move custom transform orientations to workspace
This commit moves the list of transform orientations from scenes to workspaces. Main reasons for this are: * Transform orientations are UI data and should not be stored in the scene. * Introducion of workspaces caused some (expected) glitches with transform orientations. Mainly when removing one. * Improves code. More technically speaking, this commit does: * Move list of custom transform orientations from Scene to WorkSpace struct. * Store active transform orientation index separate from View3D.twmode (twmode can only be set to preprocessor defined values now). * Display custom transform orientation name in header when transforming in it (used to show "global" which isn't really correct).
This commit is contained in:
@@ -160,11 +160,12 @@ EnumPropertyItem rna_enum_transform_mode_types[] =
|
||||
|
||||
static int select_orientation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
int orientation = RNA_enum_get(op->ptr, "orientation");
|
||||
|
||||
BIF_selectTransformOrientationValue(C, orientation);
|
||||
BIF_selectTransformOrientationValue(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;
|
||||
}
|
||||
@@ -206,10 +207,9 @@ static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
|
||||
static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
||||
|
||||
BIF_removeTransformOrientationIndex(C, selected_index);
|
||||
|
||||
BIF_removeTransformOrientationIndex(C, v3d->custom_orientation_index);
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
|
||||
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
|
||||
|
||||
@@ -223,18 +223,12 @@ static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||
|
||||
static int delete_orientation_poll(bContext *C)
|
||||
{
|
||||
int selected_index = -1;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
|
||||
if (ED_operator_areaactive(C) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
if (v3d) {
|
||||
selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
||||
}
|
||||
|
||||
return selected_index >= 0;
|
||||
return (v3d->twmode >= V3D_MANIP_CUSTOM) && (v3d->custom_orientation_index != -1);
|
||||
}
|
||||
|
||||
static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
|
||||
|
||||
Reference in New Issue
Block a user