Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2017-06-01 21:41:18 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-06-01 21:46:18 +0300
commit46fc0bb87ebda166d08b23cbcca799acb2c54158 (patch)
tree1566d535d93c4fb81b962cdbc1346ca8242460f2 /source/blender/makesrna/intern/rna_workspace.c
parent7f564d74f9edaaa41ce27c6e854869096f70b4da (diff)
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).
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace.c')
-rw-r--r--source/blender/makesrna/intern/rna_workspace.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index 29fe5bae0e4..adea8ea4556 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -76,6 +76,18 @@ static void rna_workspace_object_mode_set(PointerRNA *ptr, int value)
#endif /* USE_WORKSPACE_MODE */
+void rna_workspace_transform_orientations_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ WorkSpace *workspace = ptr->id.data;
+ rna_iterator_listbase_begin(iter, BKE_workspace_transform_orientations_get(workspace), NULL);
+}
+
+static PointerRNA rna_workspace_transform_orientations_item_get(CollectionPropertyIterator *iter)
+{
+ TransformOrientation *transform_orientation = rna_iterator_listbase_get(iter);
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_TransformOrientation, transform_orientation);
+}
+
static PointerRNA rna_workspace_render_layer_get(PointerRNA *ptr)
{
WorkSpace *workspace = ptr->data;
@@ -127,6 +139,13 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
#endif
+ prop = RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "transform_orientations", NULL);
+ RNA_def_property_struct_type(prop, "TransformOrientation");
+ RNA_def_property_collection_funcs(prop, "rna_workspace_transform_orientations_begin", NULL, NULL,
+ "rna_workspace_transform_orientations_item_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Transform Orientations", "");
+
prop = RNA_def_property(srna, "render_layer", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "SceneLayer");
RNA_def_property_pointer_funcs(prop, "rna_workspace_render_layer_get", "rna_workspace_render_layer_set",
@@ -136,9 +155,28 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL);
}
+static void rna_def_transform_orientation(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TransformOrientation", NULL);
+
+ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "mat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+}
+
void RNA_def_workspace(BlenderRNA *brna)
{
rna_def_workspace(brna);
+ rna_def_transform_orientation(brna);
}
#endif /* RNA_RUNTIME */