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:
authorTon Roosendaal <ton@blender.org>2009-04-20 14:13:55 +0400
committerTon Roosendaal <ton@blender.org>2009-04-20 14:13:55 +0400
commit74b12d1d6df9d3ff5b9f258c81eda82fa37901cf (patch)
treec4ea60be8d93e413cd1fe4be5e2ed42e99902211 /source/blender/blenkernel
parent332e00198914bb6cd34199fffb3832e170066959 (diff)
2.5
Patch from Joshua, converting Grease Pencil to 2.5. All GP data now is an ID block, allowing re-use, link and append. For better contextual control within 2.5, these GP ID's will get linked to actual data, like NodeTrees, Scenes, Images or Objects. That will ensure Undo works, and opens up exciting new use cases as well. :) Patch note: on reading files, GPencils linked from editors will get moved to the main library, using standard naming (indicating where it was used), and with "Fake User" set. That way the user can manually relink the pencils where appropriate. We can check on just linking GP to some default, like 3d window pencils to Scene? Nice to experiment with. Notes for Joshua: - for reading old GPencil, it has to use old code as well, meaning to tread data as "indirect data, within another ID". - Saving ID data means the chunk in file BHead needs the ID_GD code, and not "DATA", which indicates 'indirect data'. That's the file format spec. - I've added do_versions_gpencil_2_50(), feel free to further tweak things here, like linking things to scene or so. - Formerly GPencil saved 2.50 files won't convert gpencil
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_main.h1
-rw-r--r--source/blender/blenkernel/intern/library.c16
2 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 30cf800a3d8..6881bdfdb2c 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -77,6 +77,7 @@ typedef struct Main {
ListBase brush;
ListBase particle;
ListBase wm;
+ ListBase gpencil;
} Main;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 0712b53c5dd..5728b844a88 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -79,6 +79,7 @@
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_anim_types.h"
+#include "DNA_gpencil_types.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
@@ -114,6 +115,7 @@
#include "BKE_brush.h"
#include "BKE_idprop.h"
#include "BKE_particle.h"
+#include "BKE_gpencil.h"
#define MAX_IDPUP 60 /* was 24 */
@@ -199,6 +201,8 @@ ListBase *wich_libbase(Main *mainlib, short type)
return &(mainlib->particle);
case ID_WM:
return &(mainlib->wm);
+ case ID_GD:
+ return &(mainlib->gpencil);
}
return 0;
}
@@ -269,6 +273,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[a++]= &(main->scene);
lb[a++]= &(main->library);
lb[a++]= &(main->wm);
+ lb[a++]= &(main->gpencil);
lb[a]= NULL;
@@ -374,6 +379,9 @@ static ID *alloc_libblock_notest(short type)
case ID_WM:
id = MEM_callocN(sizeof(wmWindowManager), "Window manager");
break;
+ case ID_GD:
+ id = MEM_callocN(sizeof(bGPdata), "Grease Pencil");
+ break;
}
return id;
}
@@ -577,6 +585,9 @@ void free_libblock(ListBase *lb, void *idv)
if(free_windowmanager_cb)
free_windowmanager_cb(NULL, (wmWindowManager *)id);
break;
+ case ID_GD:
+ free_gpencil_data((bGPdata *)id);
+ break;
}
if (id->properties) {
@@ -986,14 +997,15 @@ static void lib_indirect_test_id(ID *id)
if(id->lib)
return;
-
+
if(GS(id->name)==ID_OB) {
Object *ob= (Object *)id;
bActionStrip *strip;
Mesh *me;
int a;
-
+
+ // XXX old animation system!
for (strip=ob->nlastrips.first; strip; strip=strip->next){
LIBTAG(strip->object);
LIBTAG(strip->act);