[Bf-blender-cvs] [7a20bbd] workspaces: Initially add WorkSpace ID type
Julian Eisel
noreply at git.blender.org
Fri Dec 2 11:42:49 CET 2016
Commit: 7a20bbd30e00261778eb9c66263a4fccacce3508
Author: Julian Eisel
Date: Thu Dec 1 22:54:25 2016 +0100
Branches: workspaces
https://developer.blender.org/rB7a20bbd30e00261778eb9c66263a4fccacce3508
Initially add WorkSpace ID type
===================================================================
M source/blender/blenkernel/BKE_library.h
M source/blender/blenkernel/BKE_main.h
A source/blender/blenkernel/BKE_workspace.h
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/idcode.c
M source/blender/blenkernel/intern/library.c
M source/blender/blenkernel/intern/library_query.c
M source/blender/blenkernel/intern/library_remap.c
A source/blender/blenkernel/intern/workspace.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/blentranslation/BLT_translation.h
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/space_outliner/outliner_intern.h
M source/blender/makesdna/DNA_ID.h
M source/blender/makesdna/DNA_screen_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/CMakeLists.txt
M source/blender/makesrna/intern/makesrna.c
M source/blender/makesrna/intern/rna_ID.c
M source/blender/makesrna/intern/rna_internal.h
M source/blender/makesrna/intern/rna_main.c
M source/blender/makesrna/intern/rna_main_api.c
A source/blender/makesrna/intern/rna_workspace.c
M source/blender/python/intern/bpy_rna.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index bdd791f..77ea7ec 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -96,7 +96,7 @@ void id_clear_lib_data_ex(struct Main *bmain, struct ID *id, const bool id_in_ma
struct ListBase *which_libbase(struct Main *mainlib, short type);
-#define MAX_LIBARRAY 34
+#define MAX_LIBARRAY 35
int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
/* Main API */
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 7eba01e..35c84c6 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -104,6 +104,7 @@ typedef struct Main {
ListBase mask;
ListBase linestyle;
ListBase cachefiles;
+ ListBase workspaces;
char id_tag_update[MAX_LIBARRAY];
diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h
new file mode 100644
index 0000000..283b0ea
--- /dev/null
+++ b/source/blender/blenkernel/BKE_workspace.h
@@ -0,0 +1,32 @@
+/*
+ * ***** 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__
+
+struct WorkSpace;
+
+void BKE_workspace_free(struct WorkSpace *ws);
+
+#endif /* __BKE_WORKSPACE_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index ca55ba0..0202167 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -178,6 +178,7 @@ set(SRC
intern/tracking_stabilize.c
intern/tracking_util.c
intern/unit.c
+ intern/workspace.c
intern/world.c
intern/writeavi.c
intern/writeframeserver.c
@@ -282,6 +283,7 @@ set(SRC
BKE_tracking.h
BKE_unit.h
BKE_utildefines.h
+ BKE_workspace.h
BKE_world.h
BKE_writeavi.h
BKE_writeframeserver.h
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index c76d072..6878546 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -89,6 +89,7 @@ static IDType idtypes[] = {
{ ID_TXT, "Text", "texts", BLT_I18NCONTEXT_ID_TEXT, IDTYPE_FLAGS_ISLINKABLE },
{ ID_VF, "VFont", "fonts", BLT_I18NCONTEXT_ID_VFONT, IDTYPE_FLAGS_ISLINKABLE },
{ ID_WO, "World", "worlds", BLT_I18NCONTEXT_ID_WORLD, IDTYPE_FLAGS_ISLINKABLE },
+ { ID_WS, "WorkSpace", "workspaces", BLT_I18NCONTEXT_ID_WORKSPACE, 0 },
{ ID_WM, "WindowManager", "window_managers", BLT_I18NCONTEXT_ID_WINDOWMANAGER, 0 },
/** Keep last, not an ID exactly, only include for completeness */
@@ -299,6 +300,7 @@ int BKE_idcode_to_index(const short idcode)
CASE_IDINDEX(VF);
CASE_IDINDEX(WM);
CASE_IDINDEX(WO);
+ CASE_IDINDEX(WS);
}
BLI_assert(0);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index ff0112b..abb737c 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -459,6 +459,7 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
case ID_SCR:
case ID_LI:
case ID_KE:
+ case ID_WS:
case ID_WM:
return false; /* can't be linked */
case ID_IP:
@@ -563,6 +564,7 @@ bool id_copy(Main *bmain, ID *id, ID **newid, bool test)
case ID_SCE:
case ID_LI:
case ID_SCR:
+ case ID_WS:
case ID_WM:
return false; /* can't be copied from here */
case ID_VF:
@@ -673,6 +675,8 @@ ListBase *which_libbase(Main *mainlib, short type)
return &(mainlib->paintcurves);
case ID_CF:
return &(mainlib->cachefiles);
+ case ID_WS:
+ return &(mainlib->workspaces);
}
return NULL;
}
@@ -819,7 +823,8 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[INDEX_ID_SCE] = &(main->scene);
lb[INDEX_ID_WM] = &(main->wm);
lb[INDEX_ID_MSK] = &(main->mask);
-
+ lb[INDEX_ID_WS] = &(main->workspaces);
+
lb[INDEX_ID_NULL] = NULL;
return (MAX_LIBARRAY - 1);
@@ -943,6 +948,9 @@ void *BKE_libblock_alloc_notest(short type)
case ID_CF:
id = MEM_callocN(sizeof(CacheFile), "Cache File");
break;
+ case ID_WS:
+ id = MEM_callocN(sizeof(WorkSpace), "Workspace");
+ break;
}
return id;
}
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index a161d9c..9f100d2 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -818,6 +818,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
case ID_PAL:
case ID_PC:
case ID_CF:
+ case ID_WS:
break;
/* Deprecated. */
@@ -925,6 +926,7 @@ bool BKE_library_idtype_can_use_idtype(const short id_type_owner, const short id
return ELEM(id_type_used, ID_MC); /* WARNING! mask->parent.id, not typed. */
case ID_LS:
return (ELEM(id_type_used, ID_TE, ID_OB) || BKE_library_idtype_can_use_idtype(ID_NT, id_type_used));
+ case ID_WS:
case ID_IM:
case ID_VF:
case ID_TXT:
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 3b757a4..b360344 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -105,6 +105,7 @@
#include "BKE_scene.h"
#include "BKE_text.h"
#include "BKE_texture.h"
+#include "BKE_workspace.h"
#include "BKE_world.h"
#ifdef WITH_PYTHON
@@ -812,6 +813,9 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const b
case ID_CF:
BKE_cachefile_free((CacheFile *)id);
break;
+ case ID_WS:
+ BKE_workspace_free((WorkSpace *)id);
+ break;
}
/* avoid notifying on removed data */
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
new file mode 100644
index 0000000..27a67c5
--- /dev/null
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -0,0 +1,32 @@
+/*
+ * ***** 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 blender/blenkernel/intern/workspace.c
+ * \ingroup bke
+ */
+
+#include "BKE_workspace.h"
+
+#include "DNA_screen_types.h"
+
+void BKE_workspace_free(WorkSpace *ws)
+{
+ (void)ws;
+}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 605ccd3..3ad833b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2730,6 +2730,11 @@ static void direct_link_cachefile(FileData *fd, CacheFile *cache_file)
direct_link_animdata(fd, cache_file->adt);
}
+static void direct_link_workspace(FileData *fd, WorkSpace *ws)
+{
+ UNUSED_VARS(fd, ws);
+}
+
/* ************ READ MOTION PATHS *************** */
/* direct data for cache */
@@ -7572,6 +7577,7 @@ static const char *dataname(short id_code)
case ID_MSK: return "Data from MSK";
case ID_LS: return "Data from LS";
case ID_CF: return "Data from CF";
+ case ID_WS: return "Data from WS";
}
return "Data from Lib Block";
@@ -7824,6 +7830,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
case ID_CF:
direct_link_cachefile(fd, (CacheFile *)id);
break;
+ case ID_WS:
+ direct_link_workspace(fd, (WorkSpace *)id);
+ break;
}
oldnewmap_free_unused(fd->datamap);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 169ca10..3d325f0 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3678,6 +3678,13 @@ static void write_cachefiles(WriteData *wd, ListBase *idbase)
}
}
+static void write_workspaces(WriteData *wd, ListBase *idbase)
+{
+ for (WorkSpace *ws = idbase->first; ws; ws = ws->id.next) {
+ writestruct(wd, ID_WS, WorkSpace, 1, ws);
+ }
+}
+
/* Keep it last of write_foodata functions. */
static void write_libraries(WriteData *wd, Main *main)
{
@@ -3875,6 +3882,7 @@ static bool write_file_handle(
write_gpencils(wd, &mainvar->gpencil);
write_linestyles(wd, &mainvar->linestyle);
write_cachefiles(wd, &mainvar->cachefiles);
+ write_workspaces(wd, &mainvar->workspaces);
write_libraries(wd, mainvar->next);
/* So changes above don't cause a 'DNA1' to be detected as changed on undo. */
diff --git a/source/blender/blentranslation/BLT_translation.h b/source/blender/blentranslatio
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list