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-09-27 04:20:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-27 04:20:27 +0300
commited83075402c2b6df757857ead0c93bb8bf14093d (patch)
treebfb38e533d018a02bc345a58c4db6e3a041a1191 /source/blender/blenkernel/intern/workspace.c
parent6ebe21164468fe231749bea29d5152493ea61d42 (diff)
Tool System: set a default tool for each mode
Also clear tools for the default startup file so changes to defaults apply to new files.
Diffstat (limited to 'source/blender/blenkernel/intern/workspace.c')
-rw-r--r--source/blender/blenkernel/intern/workspace.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 2829708391f..0b1f9d8bd24 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -161,17 +161,9 @@ void BKE_workspace_free(WorkSpace *workspace)
BLI_freelistN(&workspace->owner_ids);
BLI_freelistN(&workspace->layouts);
- for (bToolRef *tref = workspace->tools.first, *tref_next; tref; tref = tref_next) {
- tref_next = tref->next;
- if (tref->runtime) {
- MEM_freeN(tref->runtime);
- }
- if (tref->properties) {
- IDP_FreeProperty(tref->properties);
- MEM_freeN(tref->properties);
- }
+ while (!BLI_listbase_is_empty(&workspace->tools)) {
+ BKE_workspace_tool_remove(workspace, workspace->tools.first);
}
- BLI_freelistN(&workspace->tools);
if (workspace->status_text) {
MEM_freeN(workspace->status_text);
@@ -352,6 +344,19 @@ WorkSpaceLayout *BKE_workspace_layout_iter_circular(
return NULL;
}
+void BKE_workspace_tool_remove(
+ struct WorkSpace *workspace, struct bToolRef *tref)
+{
+ if (tref->runtime) {
+ MEM_freeN(tref->runtime);
+ }
+ if (tref->properties) {
+ IDP_FreeProperty(tref->properties);
+ MEM_freeN(tref->properties);
+ }
+ BLI_remlink(&workspace->tools, tref);
+ MEM_freeN(tref);
+}
/* -------------------------------------------------------------------- */
/* Getters/Setters */