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:
authorCampbell Barton <ideasman42@gmail.com>2018-04-18 10:12:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-18 10:16:15 +0300
commit7d055da327b9555f76035075ce4e228d31f04df4 (patch)
tree1baf55c36ba068acf764febed0a8ddf4bedca438 /source/blender/blenkernel/intern/scene.c
parent33ba170f5c2fc3b8b26b895b092a86ebd85d3e13 (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/blenkernel/intern/scene.c')
-rw-r--r--source/blender/blenkernel/intern/scene.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index e94a722ca28..e68d1db3e4a 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -272,6 +272,7 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
}
BLI_duplicatelist(&(sce_dst->markers), &(sce_src->markers));
+ BLI_duplicatelist(&(sce_dst->transform_spaces), &(sce_src->transform_spaces));
BLI_duplicatelist(&(sce_dst->r.views), &(sce_src->r.views));
BKE_keyingsets_copy(&(sce_dst->keyingsets), &(sce_src->keyingsets));
@@ -492,6 +493,7 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
}
BLI_freelistN(&sce->markers);
+ BLI_freelistN(&sce->transform_spaces);
BLI_freelistN(&sce->r.views);
BKE_toolsettings_free(sce->toolsettings);
@@ -835,6 +837,8 @@ void BKE_scene_init(Scene *sce)
sce->toolsettings->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
sce->toolsettings->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
+ sce->orientation_index_custom = -1;
+
/* Master Collection */
sce->collection = MEM_callocN(sizeof(SceneCollection), "Master Collection");
BLI_strncpy(sce->collection->name, "Master Collection", sizeof(sce->collection->name));
@@ -2134,3 +2138,36 @@ Depsgraph *BKE_scene_get_depsgraph(Scene *scene,
}
return depsgraph;
}
+
+/* -------------------------------------------------------------------- */
+/** \name Scene Orientation
+ * \{ */
+
+void BKE_scene_transform_orientation_remove(
+ Scene *scene, TransformOrientation *orientation)
+{
+ const int orientation_index = BKE_scene_transform_orientation_get_index(scene, orientation);
+ if (scene->orientation_index_custom == orientation_index) {
+ /* could also use orientation_index-- */
+ scene->orientation_type = V3D_MANIP_GLOBAL;
+ scene->orientation_index_custom = -1;
+ }
+ BLI_freelinkN(&scene->transform_spaces, orientation);
+}
+
+TransformOrientation *BKE_scene_transform_orientation_find(
+ const Scene *scene, const int index)
+{
+ return BLI_findlink(&scene->transform_spaces, index);
+}
+
+/**
+ * \return the index that \a orientation has within \a scene's transform-orientation list or -1 if not found.
+ */
+int BKE_scene_transform_orientation_get_index(
+ const Scene *scene, const TransformOrientation *orientation)
+{
+ return BLI_findindex(&scene->transform_spaces, orientation);
+}
+
+/** \} */