diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_workspace.h')
-rw-r--r-- | source/blender/blenkernel/BKE_workspace.h | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h new file mode 100644 index 00000000000..0aff79b7e30 --- /dev/null +++ b/source/blender/blenkernel/BKE_workspace.h @@ -0,0 +1,145 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file BKE_workspace.h + * \ingroup bke + */ + +#ifndef __BKE_WORKSPACE_H__ +#define __BKE_WORKSPACE_H__ + +#include "BLI_compiler_attrs.h" + +struct bScreen; +struct EvaluationContext; +struct Main; +struct Scene; +struct TransformOrientation; +struct ViewLayer; + +/* -------------------------------------------------------------------- */ +/* Create, delete, init */ + +struct WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name); +void BKE_workspace_free(struct WorkSpace *workspace); +void BKE_workspace_remove(struct Main *bmain, struct WorkSpace *workspace); + +struct WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const struct Main *bmain); +void BKE_workspace_instance_hook_free(const struct Main *bmain, struct WorkSpaceInstanceHook *hook); + +struct WorkSpaceLayout *BKE_workspace_layout_add( + struct WorkSpace *workspace, + struct bScreen *screen, + const char *name) ATTR_NONNULL(); +void BKE_workspace_layout_remove( + struct Main *bmain, + struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL(); + +void BKE_workspace_relations_free( + ListBase *relation_list); + + +/* -------------------------------------------------------------------- */ +/* General Utils */ + +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( + const struct Main *bmain, const struct bScreen *screen, + struct WorkSpace **r_workspace) ATTR_NONNULL(1, 2); + +struct WorkSpaceLayout *BKE_workspace_layout_iter_circular( + const struct WorkSpace *workspace, struct WorkSpaceLayout *start, + bool (*callback)(const struct WorkSpaceLayout *layout, void *arg), + void *arg, const bool iter_backward); + + +/* -------------------------------------------------------------------- */ +/* Getters/Setters */ + +#define GETTER_ATTRS ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT +#define SETTER_ATTRS ATTR_NONNULL(1) + +struct WorkSpace *BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS; +void BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS; +struct WorkSpaceLayout *BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS; +void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook, struct WorkSpaceLayout *layout) SETTER_ATTRS; +struct bScreen *BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS; +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; +void BKE_workspace_view_layer_set( + struct WorkSpace *workspace, + struct ViewLayer *layer, + struct Scene *scene) SETTER_ATTRS; +struct ListBase *BKE_workspace_layouts_get(struct WorkSpace *workspace) GETTER_ATTRS; + +const char *BKE_workspace_layout_name_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS; +void BKE_workspace_layout_name_set( + struct WorkSpace *workspace, struct WorkSpaceLayout *layout, const char *new_name) ATTR_NONNULL(); +struct bScreen *BKE_workspace_layout_screen_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS; +void BKE_workspace_layout_screen_set(struct WorkSpaceLayout *layout, struct bScreen *screen) SETTER_ATTRS; + +struct WorkSpaceLayout *BKE_workspace_hook_layout_for_workspace_get( + const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS; +void BKE_workspace_hook_layout_for_workspace_set( + struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL(); + +struct ViewRender *BKE_workspace_view_render_get(struct WorkSpace *workspace) GETTER_ATTRS; + +/* flags */ +bool BKE_workspace_use_scene_settings_get(const struct WorkSpace *workspace) GETTER_ATTRS; +void BKE_workspace_use_scene_settings_set(struct WorkSpace *workspace, bool value) SETTER_ATTRS; + +/* Update / evaluate */ +void BKE_workspace_update_tagged(struct EvaluationContext *eval_ctx, + struct Main *bmain, + struct WorkSpace *workspace, + struct Scene *scene); + +void BKE_workspace_update_object_mode( + struct EvaluationContext *eval_ctx, + struct WorkSpace *workspace); + +struct Object *BKE_workspace_edit_object( + struct WorkSpace *workspace, struct Scene *scene); + +bool BKE_workspace_owner_id_check( + const struct WorkSpace *workspace, const char *owner_id) ATTR_NONNULL(); + +#undef GETTER_ATTRS +#undef SETTER_ATTRS + +#endif /* __BKE_WORKSPACE_H__ */ |