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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_scene.h8
-rw-r--r--source/blender/blenkernel/BKE_screen.h3
-rw-r--r--source/blender/blenkernel/BKE_workspace.h8
-rw-r--r--source/blender/blenkernel/intern/scene.c37
-rw-r--r--source/blender/blenkernel/intern/screen.c20
-rw-r--r--source/blender/blenkernel/intern/workspace.c31
-rw-r--r--source/blender/blenloader/intern/readfile.c3
-rw-r--r--source/blender/blenloader/intern/versioning_280.c29
-rw-r--r--source/blender/blenloader/intern/writefile.c7
-rw-r--r--source/blender/editors/include/ED_transform.h2
-rw-r--r--source/blender/editors/screen/workspace_edit.c4
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c2
-rw-r--r--source/blender/editors/transform/transform.c19
-rw-r--r--source/blender/editors/transform/transform_generics.c11
-rw-r--r--source/blender/editors/transform/transform_manipulator.c11
-rw-r--r--source/blender/editors/transform/transform_ops.c20
-rw-r--r--source/blender/editors/transform/transform_orientations.c41
-rw-r--r--source/blender/makesdna/DNA_scene_types.h5
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h8
-rw-r--r--source/blender/makesdna/DNA_workspace_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_scene.c115
-rw-r--r--source/blender/makesrna/intern/rna_space.c96
-rw-r--r--source/blender/makesrna/intern/rna_workspace.c38
24 files changed, 231 insertions, 292 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index afb77bb5206..8036673cbdf 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -48,6 +48,7 @@ struct ViewLayer;
struct UnitSettings;
struct ViewRender;
struct WorkSpace;
+struct TransformOrientation;
typedef enum eSceneCopyMethod {
SCE_COPY_NEW = 0,
@@ -211,6 +212,13 @@ void BKE_scene_free_depsgraph_hash(struct Scene *scene);
struct Depsgraph *BKE_scene_get_depsgraph(struct Scene *scene, struct ViewLayer *view_layer, bool allocate);
+void BKE_scene_transform_orientation_remove(
+ struct Scene *scene, struct TransformOrientation *orientation);
+struct TransformOrientation *BKE_scene_transform_orientation_find(
+ const struct Scene *scene, const int index);
+int BKE_scene_transform_orientation_get_index(
+ const struct Scene *scene, const struct TransformOrientation *orientation);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 984e3fb2a03..ee0fb5f2776 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -325,9 +325,6 @@ void BKE_screen_manipulator_tag_refresh(struct bScreen *sc);
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
void BKE_screen_view3d_scene_sync(struct bScreen *sc, struct Scene *scene);
-void BKE_screen_transform_orientation_remove(
- const struct bScreen *screen, const struct WorkSpace *workspace,
- const struct TransformOrientation *orientation) ATTR_NONNULL();
bool BKE_screen_is_fullscreen_area(const struct bScreen *screen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
bool BKE_screen_is_used(const struct bScreen *screen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h
index c4de9d134b7..3d28b66dd20 100644
--- a/source/blender/blenkernel/BKE_workspace.h
+++ b/source/blender/blenkernel/BKE_workspace.h
@@ -62,13 +62,6 @@ void BKE_workspace_view_layer_remove_references(
const struct Main *bmain,
const struct ViewLayer *view_layer) ATTR_NONNULL();
-void BKE_workspace_transform_orientation_remove(
- struct WorkSpace *workspace, struct TransformOrientation *orientation) ATTR_NONNULL();
-struct TransformOrientation *BKE_workspace_transform_orientation_find(
- const struct WorkSpace *workspace, const int index) ATTR_NONNULL();
-int BKE_workspace_transform_orientation_get_index(
- const struct WorkSpace *workspace, const struct TransformOrientation *orientation) ATTR_NONNULL();
-
struct WorkSpaceLayout *BKE_workspace_layout_find(
const struct WorkSpace *workspace, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
struct WorkSpaceLayout *BKE_workspace_layout_find_global(
@@ -96,7 +89,6 @@ void BKE_workspace_active_screen_set(
struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS;
struct Base *BKE_workspace_active_base_get(const struct WorkSpace *workspace, const struct Scene *scene);
-struct ListBase *BKE_workspace_transform_orientations_get(struct WorkSpace *workspace) GETTER_ATTRS;
struct ViewLayer *BKE_workspace_view_layer_get(
const struct WorkSpace *workspace,
const struct Scene *scene) GETTER_ATTRS;
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);
+}
+
+/** \} */
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 35055a59243..8283655503c 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -812,26 +812,6 @@ void BKE_screen_view3d_scene_sync(bScreen *sc, Scene *scene)
}
}
-void BKE_screen_transform_orientation_remove(
- const bScreen *screen, const WorkSpace *workspace, const TransformOrientation *orientation)
-{
- const int orientation_index = BKE_workspace_transform_orientation_get_index(workspace, orientation);
-
- for (ScrArea *area = screen->areabase.first; area; area = area->next) {
- for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
-
- if (v3d->custom_orientation_index == orientation_index) {
- /* could also use orientation_index-- */
- v3d->twmode = V3D_MANIP_GLOBAL;
- v3d->custom_orientation_index = -1;
- }
- }
- }
- }
-}
-
/* magic zoom calculation, no idea what
* it signifies, if you find out, tell me! -zr
*/
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index afceea9dd5f..466848fa6b1 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -171,7 +171,6 @@ void BKE_workspace_free(WorkSpace *workspace)
BLI_freelistN(&workspace->owner_ids);
BLI_freelistN(&workspace->layouts);
- BLI_freelistN(&workspace->transform_orientations);
BKE_viewrender_free(&workspace->view_render);
}
@@ -272,31 +271,6 @@ void BKE_workspace_view_layer_remove_references(
}
}
-void BKE_workspace_transform_orientation_remove(
- WorkSpace *workspace, TransformOrientation *orientation)
-{
- for (WorkSpaceLayout *layout = workspace->layouts.first; layout; layout = layout->next) {
- BKE_screen_transform_orientation_remove(BKE_workspace_layout_screen_get(layout), workspace, orientation);
- }
-
- BLI_freelinkN(&workspace->transform_orientations, orientation);
-}
-
-TransformOrientation *BKE_workspace_transform_orientation_find(
- const WorkSpace *workspace, const int index)
-{
- return BLI_findlink(&workspace->transform_orientations, index);
-}
-
-/**
- * \return the index that \a orientation has within \a workspace's transform-orientation list or -1 if not found.
- */
-int BKE_workspace_transform_orientation_get_index(
- const WorkSpace *workspace, const TransformOrientation *orientation)
-{
- return BLI_findindex(&workspace->transform_orientations, orientation);
-}
-
WorkSpaceLayout *BKE_workspace_layout_find(
const WorkSpace *workspace, const bScreen *screen)
{
@@ -423,11 +397,6 @@ Base *BKE_workspace_active_base_get(const WorkSpace *workspace, const Scene *sce
return view_layer->basact;
}
-ListBase *BKE_workspace_transform_orientations_get(WorkSpace *workspace)
-{
- return &workspace->transform_orientations;
-}
-
ViewLayer *BKE_workspace_view_layer_get(const WorkSpace *workspace, const Scene *scene)
{
return workspace_relation_get_data_matching_parent(&workspace->scene_viewlayer_relations, scene);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index b40321f75d1..fdd65add6d1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2902,7 +2902,6 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main
link_list(fd, BKE_workspace_layouts_get(workspace));
link_list(fd, &workspace->hook_layout_relations);
link_list(fd, &workspace->scene_viewlayer_relations);
- link_list(fd, BKE_workspace_transform_orientations_get(workspace));
link_list(fd, &workspace->owner_ids);
for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first;
@@ -6258,7 +6257,7 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain)
}
link_list(fd, &(sce->markers));
- link_list(fd, &(sce->transform_spaces)); /* only for old files */
+ link_list(fd, &(sce->transform_spaces));
link_list(fd, &(sce->r.layers));
link_list(fd, &(sce->r.views));
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index d8314cb232c..0b2e44bff86 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -95,7 +95,6 @@ static void do_version_workspaces_create_from_screens(Main *bmain)
Scene *scene = screen->scene;
WorkSpace *workspace;
ViewLayer *layer = BKE_view_layer_from_scene_get(scene);
- ListBase *transform_orientations;
if (screen_parent) {
/* fullscreen with "Back to Previous" option, don't create
@@ -116,9 +115,6 @@ static void do_version_workspaces_create_from_screens(Main *bmain)
BLI_strncpy(workspace->view_render.engine_id, RE_engine_id_BLENDER_EEVEE,
sizeof(workspace->view_render.engine_id));
#endif
-
- transform_orientations = BKE_workspace_transform_orientations_get(workspace);
- BLI_duplicatelist(transform_orientations, &scene->transform_spaces);
}
}
@@ -750,25 +746,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
if (!MAIN_VERSION_ATLEAST(main, 280, 2)) {
- if (!DNA_struct_elem_find(fd->filesdna, "View3D", "short", "custom_orientation_index")) {
- for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
- for (ScrArea *area = screen->areabase.first; area; area = area->next) {
- for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- if (v3d->twmode >= V3D_MANIP_CUSTOM) {
- v3d->custom_orientation_index = v3d->twmode - V3D_MANIP_CUSTOM;
- v3d->twmode = V3D_MANIP_CUSTOM;
- }
- else {
- v3d->custom_orientation_index = -1;
- }
- }
- }
- }
- }
- }
-
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "cascade_max_dist")) {
for (Lamp *la = main->lamp.first; la; la = la->id.next) {
la->cascade_max_dist = 1000.0f;
@@ -947,6 +924,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
con = con_next;
}
}
+
+ if (!DNA_struct_elem_find(fd->filesdna, "Scene", "int", "orientation_index_custom")) {
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ scene->orientation_index_custom = -1;
+ }
+ }
}
if (!MAIN_VERSION_ATLEAST(main, 280, 6)) {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index c6523dc99e2..ab71676b3df 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2648,6 +2648,11 @@ static void write_scene(WriteData *wd, Scene *sce)
writestruct(wd, DATA, TimeMarker, 1, marker);
}
+ /* writing dynamic list of TransformOrientations to the blend file */
+ for (TransformOrientation *ts = sce->transform_spaces.first; ts; ts = ts->next) {
+ writestruct(wd, DATA, TransformOrientation, 1, ts);
+ }
+
/* writing MultiView to the blend file */
for (SceneRenderView *srv = sce->r.views.first; srv; srv = srv->next) {
writestruct(wd, DATA, SceneRenderView, 1, srv);
@@ -3625,14 +3630,12 @@ static void write_cachefile(WriteData *wd, CacheFile *cache_file)
static void write_workspace(WriteData *wd, WorkSpace *workspace)
{
ListBase *layouts = BKE_workspace_layouts_get(workspace);
- ListBase *transform_orientations = BKE_workspace_transform_orientations_get(workspace);
writestruct(wd, ID_WS, WorkSpace, 1, workspace);
writelist(wd, DATA, WorkSpaceLayout, layouts);
writelist(wd, DATA, WorkSpaceDataRelation, &workspace->hook_layout_relations);
writelist(wd, DATA, WorkSpaceDataRelation, &workspace->scene_viewlayer_relations);
writelist(wd, DATA, wmOwnerID, &workspace->owner_ids);
- writelist(wd, DATA, TransformOrientation, transform_orientations);
}
/* Keep it last of write_foodata functions. */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 536f9c22dcd..a6bed6c1ee6 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -130,7 +130,7 @@ void BIF_createTransformOrientation(struct bContext *C, struct ReportList *repor
const char *name, const bool use_view,
const bool activate, const bool overwrite);
void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
-void BIF_selectTransformOrientationValue(struct View3D *v3d, int orientation);
+void BIF_selectTransformOrientationValue(struct Scene *scene, int orientation);
void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const short around);
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index ace3f17542e..b4aea54c66d 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -225,10 +225,6 @@ WorkSpace *ED_workspace_duplicate(
bmain, workspace_old->id.name + 2, scene,
BKE_workspace_view_layer_get(workspace_old, scene),
&workspace_old->view_render);
- ListBase *transform_orientations_old = BKE_workspace_transform_orientations_get(workspace_old);
- ListBase *transform_orientations_new = BKE_workspace_transform_orientations_get(workspace_new);
-
- BLI_duplicatelist(transform_orientations_new, transform_orientations_old);
workspace_new->tool = workspace_old->tool;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 9234c8c3d77..5a5d1df3a08 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -348,7 +348,7 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->twflag |= U.manipulator_flag & V3D_MANIPULATOR_DRAW;
v3d->twtype = V3D_MANIP_TRANSLATE;
v3d->around = V3D_AROUND_CENTER_MEAN;
- v3d->custom_orientation_index = -1;
+ scene->orientation_index_custom = -1;
v3d->bundle_size = 0.2f;
v3d->bundle_drawtype = OB_PLAINAXES;
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 3ed6c87b750..1f47f44f2f6 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -333,7 +333,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
if (v3d->twflag & V3D_MANIPULATOR_DRAW) {
uiItemR(row, &v3dptr, "transform_manipulators", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
- uiItemR(row, &v3dptr, "transform_orientation", 0, "", ICON_NONE);
+ uiItemR(row, &sceneptr, "transform_orientation", 0, "", ICON_NONE);
}
if (obedit == NULL && v3d->localvd == NULL) {
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 3752d7f6c26..b6d794a7812 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -62,6 +62,7 @@
#include "BKE_constraint.h"
#include "BKE_particle.h"
#include "BKE_unit.h"
+#include "BKE_scene.h"
#include "BKE_mask.h"
#include "BKE_report.h"
#include "BKE_workspace.h"
@@ -2009,13 +2010,10 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
!RNA_property_is_set(op->ptr, prop))
{
- View3D *v3d = t->view;
-
- v3d->twmode = t->current_orientation;
-
- BLI_assert(((v3d->custom_orientation_index == -1) && (t->custom_orientation == NULL)) ||
- (BKE_workspace_transform_orientation_get_index(
- CTX_wm_workspace(C), t->custom_orientation) == v3d->custom_orientation_index));
+ t->scene->orientation_type = t->current_orientation;
+ BLI_assert(((t->scene->orientation_index_custom == -1) && (t->custom_orientation == NULL)) ||
+ (BKE_scene_transform_orientation_get_index(
+ t->scene, t->custom_orientation) == t->scene->orientation_index_custom));
}
}
}
@@ -2040,12 +2038,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
short orientation = (t->con.mode & CON_APPLY) ? t->con.orientation : t->current_orientation;
if (orientation == V3D_MANIP_CUSTOM) {
- WorkSpace *workspace = CTX_wm_workspace(C);
- const int custom_orientation_index = BKE_workspace_transform_orientation_get_index(
- workspace, t->custom_orientation);
+ const int orientation_index_custom = BKE_scene_transform_orientation_get_index(
+ t->scene, t->custom_orientation);
/* Maybe we need a t->con.custom_orientation? Seems like it would always match t->custom_orientation. */
- orientation = V3D_MANIP_CUSTOM + custom_orientation_index;
+ orientation = V3D_MANIP_CUSTOM + orientation_index_custom;
BLI_assert(orientation >= V3D_MANIP_CUSTOM);
}
RNA_enum_set(op->ptr, "constraint_orientation", orientation);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 8f369aea0c8..2fdb34e125a 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -83,6 +83,7 @@
#include "BKE_mask.h"
#include "BKE_workspace.h"
#include "BKE_layer.h"
+#include "BKE_scene.h"
#include "DEG_depsgraph.h"
@@ -1328,9 +1329,9 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->around = V3D_AROUND_CURSOR;
}
- t->current_orientation = v3d->twmode;
- t->custom_orientation = BKE_workspace_transform_orientation_find(
- CTX_wm_workspace(C), v3d->custom_orientation_index);
+ t->current_orientation = t->scene->orientation_type;
+ t->custom_orientation = BKE_scene_transform_orientation_find(
+ t->scene, t->scene->orientation_index_custom);
/* exceptional case */
if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
@@ -1429,8 +1430,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
orientation = V3D_MANIP_GLOBAL;
}
else {
- custom_orientation = BKE_workspace_transform_orientation_find(
- CTX_wm_workspace(C), orientation - V3D_MANIP_CUSTOM);
+ custom_orientation = BKE_scene_transform_orientation_find(
+ t->scene, orientation - V3D_MANIP_CUSTOM);
orientation = V3D_MANIP_CUSTOM;
}
}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 8944817baca..6fb9ed862ab 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -59,6 +59,7 @@
#include "BKE_editmesh.h"
#include "BKE_lattice.h"
#include "BKE_gpencil.h"
+#include "BKE_scene.h"
#include "BKE_workspace.h"
#include "BIF_gl.h"
@@ -619,7 +620,7 @@ static int calc_manipulator_stats(
* if we could check 'totsel' now, this should be skipped with no selection. */
if (ob && !is_gp_edit) {
- switch (v3d->twmode) {
+ switch (scene->orientation_type) {
case V3D_MANIP_GLOBAL:
{
@@ -672,8 +673,8 @@ static int calc_manipulator_stats(
}
case V3D_MANIP_CUSTOM:
{
- TransformOrientation *custom_orientation = BKE_workspace_transform_orientation_find(
- CTX_wm_workspace(C), v3d->custom_orientation_index);
+ TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find(
+ scene, scene->orientation_index_custom);
float mat[3][3];
if (applyTransformOrientation(custom_orientation, mat, NULL)) {
@@ -1133,9 +1134,9 @@ static void manipulator_xform_message_subscribe(
RNA_pointer_create(&screen->id, &RNA_SpaceView3D, sa->spacedata.first, &space_ptr);
{
- extern PropertyRNA rna_SpaceView3D_transform_orientation;
+ extern PropertyRNA rna_Scene_transform_orientation;
const PropertyRNA *props[] = {
- &rna_SpaceView3D_transform_orientation,
+ &rna_Scene_transform_orientation,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
WM_msg_subscribe_rna(mbus, &space_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__);
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index d5d25888ec8..6f31f5311bc 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -160,12 +160,12 @@ const EnumPropertyItem rna_enum_transform_mode_types[] =
static int select_orientation_exec(bContext *C, wmOperator *op)
{
- View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
int orientation = RNA_enum_get(op->ptr, "orientation");
- BIF_selectTransformOrientationValue(v3d, orientation);
-
- WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+ BIF_selectTransformOrientationValue(scene, orientation);
+
+ WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
return OPERATOR_FINISHED;
}
@@ -206,12 +206,10 @@ 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);
+ Scene *scene = CTX_data_scene(C);
+ BIF_removeTransformOrientationIndex(C, scene->orientation_index_custom);
- 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));
+ WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
return OPERATOR_FINISHED;
}
@@ -223,12 +221,12 @@ static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent
static int delete_orientation_poll(bContext *C)
{
- View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
if (ED_operator_areaactive(C) == 0)
return 0;
- return (v3d->twmode >= V3D_MANIP_CUSTOM) && (v3d->custom_orientation_index != -1);
+ return (scene->orientation_type >= V3D_MANIP_CUSTOM) && (scene->orientation_index_custom != -1);
}
static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 7b3f91b81da..9e6f4847b5b 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -53,6 +53,7 @@
#include "BKE_report.h"
#include "BKE_main.h"
#include "BKE_screen.h"
+#include "BKE_scene.h"
#include "BKE_workspace.h"
#include "BLT_translation.h"
@@ -65,16 +66,15 @@
void BIF_clearTransformOrientation(bContext *C)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
- ListBase *transform_orientations = BKE_workspace_transform_orientations_get(workspace);
+ Scene *scene = CTX_data_scene(C);
+ ListBase *transform_orientations = &scene->transform_spaces;
View3D *v3d = CTX_wm_view3d(C);
BLI_freelistN(transform_orientations);
-
- // Need to loop over all view3d
- if (v3d && v3d->twmode == V3D_MANIP_CUSTOM) {
- v3d->twmode = V3D_MANIP_GLOBAL; /* fallback to global */
- v3d->custom_orientation_index = -1;
+
+ if (v3d && scene->orientation_type == V3D_MANIP_CUSTOM) {
+ scene->orientation_type = V3D_MANIP_GLOBAL; /* fallback to global */
+ scene->orientation_index_custom = -1;
}
}
@@ -323,8 +323,8 @@ TransformOrientation *addMatrixSpace(bContext *C, float mat[3][3],
const char *name, const bool overwrite)
{
TransformOrientation *ts = NULL;
- WorkSpace *workspace = CTX_wm_workspace(C);
- ListBase *transform_orientations = BKE_workspace_transform_orientations_get(workspace);
+ Scene *scene = CTX_data_scene(C);
+ ListBase *transform_orientations = &scene->transform_spaces;
char name_unique[sizeof(ts->name)];
if (overwrite) {
@@ -351,24 +351,24 @@ TransformOrientation *addMatrixSpace(bContext *C, float mat[3][3],
void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target)
{
- BKE_workspace_transform_orientation_remove(CTX_wm_workspace(C), target);
+ BKE_scene_transform_orientation_remove(CTX_data_scene(C), target);
}
void BIF_removeTransformOrientationIndex(bContext *C, int index)
{
- TransformOrientation *target = BKE_workspace_transform_orientation_find(CTX_wm_workspace(C), index);
+ TransformOrientation *target = BKE_scene_transform_orientation_find(CTX_data_scene(C), index);
BIF_removeTransformOrientation(C, target);
}
void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
{
- int index = BKE_workspace_transform_orientation_get_index(CTX_wm_workspace(C), target);
- View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
+ int index = BKE_scene_transform_orientation_get_index(scene, target);
BLI_assert(index != -1);
- v3d->twmode = V3D_MANIP_CUSTOM;
- v3d->custom_orientation_index = index;
+ scene->orientation_type = V3D_MANIP_CUSTOM;
+ scene->orientation_index_custom = index;
}
/**
@@ -377,18 +377,17 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
* \param orientation: If this is #V3D_MANIP_CUSTOM or greater, the custom transform orientation
* with index \a orientation - #V3D_MANIP_CUSTOM gets activated.
*/
-void BIF_selectTransformOrientationValue(View3D *v3d, int orientation)
+void BIF_selectTransformOrientationValue(Scene *scene, int orientation)
{
const bool is_custom = orientation >= V3D_MANIP_CUSTOM;
-
- v3d->twmode = is_custom ? V3D_MANIP_CUSTOM : orientation;
- v3d->custom_orientation_index = is_custom ? (orientation - V3D_MANIP_CUSTOM) : -1;
+ scene->orientation_type = is_custom ? V3D_MANIP_CUSTOM : orientation;
+ scene->orientation_index_custom = is_custom ? (orientation - V3D_MANIP_CUSTOM) : -1;
}
int BIF_countTransformOrientation(const bContext *C)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
- ListBase *transform_orientations = BKE_workspace_transform_orientations_get(workspace);
+ Scene *scene = CTX_data_scene(C);
+ ListBase *transform_orientations = &scene->transform_spaces;
return BLI_listbase_count(transform_orientations);
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index db997aed1cb..1c518331cf7 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1481,7 +1481,10 @@ typedef struct Scene {
struct AudioData audio;
ListBase markers;
- ListBase transform_spaces DNA_DEPRECATED;
+ ListBase transform_spaces;
+
+ int orientation_index_custom;
+ int orientation_type;
void *sound_scene;
void *playback_handle;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 70d0d8c9d4d..2b82638a6b8 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -197,7 +197,7 @@ typedef struct View3D {
char gridflag;
/* transform manipulator info */
- char twtype, twmode, twflag;
+ char twtype, _pad5, twflag;
short flag3;
@@ -211,9 +211,7 @@ typedef struct View3D {
char multiview_eye; /* multiview current eye - for internal use */
- /* The active custom transform orientation of this 3D view. */
- short custom_orientation_index;
- char pad3[2];
+ char pad3[4];
/* note, 'fx_settings.dof' is currently _not_ allocated,
* instead set (temporarily) from camera */
@@ -363,7 +361,7 @@ enum {
#define V3D_MANIP_ROTATE 2
#define V3D_MANIP_SCALE 4
-/* View3d->twmode */
+/* Scene.orientation_type */
#define V3D_MANIP_GLOBAL 0
#define V3D_MANIP_LOCAL 1
#define V3D_MANIP_NORMAL 2
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index 82aa7b8b81c..dab6f8c1ea0 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -95,9 +95,6 @@ typedef struct WorkSpace {
/* Feature tagging (use for addons) */
ListBase owner_ids DNA_PRIVATE_WORKSPACE_READ_WRITE; /* wmOwnerID */
- /* Custom transform orientations */
- ListBase transform_orientations DNA_PRIVATE_WORKSPACE;
-
int pad;
int flags DNA_PRIVATE_WORKSPACE; /* enum eWorkSpaceFlags */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 2e842687831..6f9b1ccebf5 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -37,6 +37,8 @@
#include "DNA_userdef_types.h"
#include "DNA_world_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_screen_types.h" /* TransformOrientation */
#include "IMB_imbuf_types.h"
@@ -71,6 +73,7 @@
#endif
#include "ED_render.h"
+#include "ED_transform.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -438,6 +441,18 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
#endif
+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}
+};
+
#ifdef RNA_RUNTIME
#include "DNA_anim_types.h"
@@ -1627,6 +1642,8 @@ static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
}
}
+
+
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
{
TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
@@ -2013,6 +2030,71 @@ static void rna_ViewLayer_remove(
}
}
+static int rna_Scene_transform_orientation_get(PointerRNA *ptr)
+{
+ Scene *scene = ptr->data;
+ /* convert to enum value */
+ return (scene->orientation_type == V3D_MANIP_CUSTOM) ?
+ (scene->orientation_type + scene->orientation_index_custom) : scene->orientation_type;
+}
+
+void rna_Scene_transform_orientation_set(PointerRNA *ptr, int value)
+{
+ Scene *scene = ptr->data;
+ BIF_selectTransformOrientationValue(scene, value);
+}
+
+static PointerRNA rna_Scene_current_orientation_get(PointerRNA *ptr)
+{
+ Scene *scene = ptr->data;
+ TransformOrientation *orientation;
+
+ if (scene->orientation_type < V3D_MANIP_CUSTOM) {
+ orientation = NULL;
+ }
+ else {
+ orientation = BKE_scene_transform_orientation_find(scene, scene->orientation_index_custom);
+ }
+
+ return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
+}
+
+const EnumPropertyItem *rna_TransformOrientation_itemf(
+ bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+{
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ EnumPropertyItem *item = NULL;
+ int i = V3D_MANIP_CUSTOM, totitem = 0;
+
+ RNA_enum_items_add(&item, &totitem, transform_orientation_items);
+
+ Scene *scene = CTX_data_scene(C);
+ if (ptr->type == &RNA_Scene) {
+ scene = ptr->data;
+ }
+ else {
+ scene = CTX_data_scene(C);
+ }
+ const ListBase *transform_orientations = &scene->transform_spaces;
+
+ 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;
+}
+
+
#else
/* Grease Pencil Interpolation tool settings */
@@ -2281,6 +2363,24 @@ static void rna_def_gpencil_brushes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_ui_text(prop, "Active Brush Index", "Index of active brush");
}
+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);
+}
+
static void rna_def_tool_settings(BlenderRNA *brna)
{
StructRNA *srna;
@@ -6278,6 +6378,20 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Timeline Markers", "Markers used in all timelines for the current scene");
rna_def_timeline_markers(brna, prop);
+ /* Orientations */
+ prop = RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "orientation_type");
+ RNA_def_property_enum_items(prop, transform_orientation_items);
+ RNA_def_property_enum_funcs(prop, "rna_Scene_transform_orientation_get", "rna_Scene_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_Scene_current_orientation_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current transformation orientation");
+
/* Audio Settings */
prop = RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
@@ -6387,6 +6501,7 @@ void RNA_def_scene(BlenderRNA *brna)
rna_def_statvis(brna);
rna_def_unit_settings(brna);
rna_def_scene_image_format_data(brna);
+ rna_def_transform_orientation(brna);
rna_def_selected_uv_element(brna);
rna_def_display_safe_areas(brna);
RNA_define_animate_sdna(true);
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");
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index 609493c54b8..92c45998913 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -71,18 +71,6 @@ static PointerRNA rna_workspace_screens_item_get(CollectionPropertyIterator *ite
return rna_pointer_inherit_refine(&iter->parent, &RNA_Screen, screen);
}
-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);
-}
-
/* workspace.owner_ids */
static wmOwnerID *rna_WorkSpace_owner_ids_new(
@@ -204,13 +192,6 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Tool Index", "Tool group index");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- 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, "owner_ids", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "wmOwnerID");
RNA_def_property_ui_text(prop, "UI Tags", "");
@@ -244,29 +225,10 @@ static void rna_def_workspace(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_window_update_all");
}
-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_owner(brna);
rna_def_workspace(brna);
- rna_def_transform_orientation(brna);
}
#endif /* RNA_RUNTIME */