diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_workspace.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 37 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 20 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/workspace.c | 31 |
6 files changed, 45 insertions, 62 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); |