diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-18 10:12:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-18 10:16:15 +0300 |
commit | 7d055da327b9555f76035075ce4e228d31f04df4 (patch) | |
tree | 1baf55c36ba068acf764febed0a8ddf4bedca438 /source/blender/makesrna/intern/rna_space.c | |
parent | 33ba170f5c2fc3b8b26b895b092a86ebd85d3e13 (diff) |
Move transform orientation to scene
This was stored in the workspace, selected from the view.
Move both to scene since custom orientations are closely related to your
scene data.
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d983f529a48..601a8bffcfa 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -158,18 +158,6 @@ static const EnumPropertyItem draw_channels_items[] = { {0, NULL, 0, NULL, NULL} }; -static const EnumPropertyItem transform_orientation_items[] = { - {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, - {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, - {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", - "Align the transformation axes to average normal of selected elements " - "(bone Y axis for pose mode)"}, - {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, - {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, - // {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, - {0, NULL, 0, NULL, NULL} -}; - #ifndef RNA_RUNTIME static const EnumPropertyItem autosnap_items[] = { {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""}, @@ -435,77 +423,6 @@ static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), Scene *UNUSED(scen } } -static int rna_View3D_transform_orientation_get(PointerRNA *ptr) -{ - const View3D *v3d = (View3D *)ptr->data; - /* convert to enum value */ - return (v3d->twmode == V3D_MANIP_CUSTOM) ? (v3d->twmode + v3d->custom_orientation_index) : v3d->twmode; -} - -void rna_View3D_transform_orientation_set(PointerRNA *ptr, int value) -{ - View3D *v3d = (View3D *)ptr->data; - BIF_selectTransformOrientationValue(v3d, value); -} - -static PointerRNA rna_View3D_current_orientation_get(PointerRNA *ptr) -{ - View3D *v3d = (View3D *)ptr->data; - TransformOrientation *orientation; - - if (v3d->twmode < V3D_MANIP_CUSTOM) { - orientation = NULL; - } - else { - WorkSpace *workspace; - bScreen *screen = ptr->id.data; - - BKE_workspace_layout_find_global(G.main, screen, &workspace); - orientation = BKE_workspace_transform_orientation_find(workspace, v3d->custom_orientation_index); - } - - return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation); -} - -const EnumPropertyItem *rna_TransformOrientation_itemf( - bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) -{ - WorkSpace *workspace; - ListBase *transform_orientations; - EnumPropertyItem tmp = {0, "", 0, "", ""}; - EnumPropertyItem *item = NULL; - int i = V3D_MANIP_CUSTOM, totitem = 0; - - RNA_enum_items_add(&item, &totitem, transform_orientation_items); - - if (ptr->type == &RNA_SpaceView3D) { - bScreen *screen = ptr->id.data; - BKE_workspace_layout_find_global(G.main, screen, &workspace); - } - else { - /* can't use scene from ptr->id.data because that enum is also used by operators */ - workspace = C ? CTX_wm_workspace(C) : NULL; - } - - transform_orientations = workspace ? BKE_workspace_transform_orientations_get(workspace) : NULL; - - if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) { - RNA_enum_item_add_separator(&item, &totitem); - - for (TransformOrientation *ts = transform_orientations->first; ts; ts = ts->next) { - tmp.identifier = ts->name; - tmp.name = ts->name; - tmp.value = i++; - RNA_enum_item_add(&item, &totitem, &tmp); - } - } - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - /* Space 3D View */ static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr) { @@ -2570,19 +2487,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Transform Manipulators", "Transformation manipulators"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "twmode"); - RNA_def_property_enum_items(prop, transform_orientation_items); - RNA_def_property_enum_funcs(prop, "rna_View3D_transform_orientation_get", "rna_View3D_transform_orientation_set", - "rna_TransformOrientation_itemf"); - RNA_def_property_ui_text(prop, "Transform Orientation", "Transformation orientation"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - - prop = RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "TransformOrientation"); - RNA_def_property_pointer_funcs(prop, "rna_View3D_current_orientation_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current transformation orientation"); - prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1); RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set"); |