Revision: 15698 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15698 Author: campbellbarton Date: 2008-07-22 19:49:15 +0200 (Tue, 22 Jul 2008)
Log Message: ----------- svn merge -r15669:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender Modified Paths: -------------- branches/apricot/source/blender/blenkernel/BKE_global.h branches/apricot/source/blender/blenloader/intern/readfile.c branches/apricot/source/blender/blenloader/intern/writefile.c branches/apricot/source/blender/include/BDR_drawaction.h branches/apricot/source/blender/include/BIF_editaction.h branches/apricot/source/blender/include/BIF_space.h branches/apricot/source/blender/include/BSE_editaction_types.h branches/apricot/source/blender/include/transform.h branches/apricot/source/blender/makesdna/DNA_action_types.h branches/apricot/source/blender/makesdna/DNA_space_types.h branches/apricot/source/blender/makesdna/DNA_view3d_types.h branches/apricot/source/blender/makesdna/intern/makesdna.c branches/apricot/source/blender/python/api2_2x/Blender.c branches/apricot/source/blender/python/api2_2x/Particle.c branches/apricot/source/blender/python/api2_2x/doc/Particle.py branches/apricot/source/blender/src/drawaction.c branches/apricot/source/blender/src/drawnode.c branches/apricot/source/blender/src/drawseq.c branches/apricot/source/blender/src/drawview.c branches/apricot/source/blender/src/editaction.c branches/apricot/source/blender/src/editnode.c branches/apricot/source/blender/src/header_action.c branches/apricot/source/blender/src/header_node.c branches/apricot/source/blender/src/header_seq.c branches/apricot/source/blender/src/header_view3d.c branches/apricot/source/blender/src/interface.c branches/apricot/source/blender/src/space.c branches/apricot/source/blender/src/transform_conversions.c branches/apricot/source/blender/src/transform_generics.c branches/apricot/source/blender/src/usiblender.c branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp Added Paths: ----------- branches/apricot/source/blender/src/drawgpencil.c branches/apricot/source/blender/src/editaction_gpencil.c branches/apricot/source/blender/src/gpencil.c Modified: branches/apricot/source/blender/blenkernel/BKE_global.h =================================================================== --- branches/apricot/source/blender/blenkernel/BKE_global.h 2008-07-22 17:44:06 UTC (rev 15697) +++ branches/apricot/source/blender/blenkernel/BKE_global.h 2008-07-22 17:49:15 UTC (rev 15698) @@ -176,6 +176,7 @@ #define G_WEIGHTPAINT (1 << 15) #define G_TEXTUREPAINT (1 << 16) /* #define G_NOFROZEN (1 << 17) also removed */ +#define G_GREASEPENCIL (1 << 17) #define G_DRAWEDGES (1 << 18) #define G_DRAWCREASES (1 << 19) #define G_DRAWSEAMS (1 << 20) @@ -280,3 +281,4 @@ #endif + Modified: branches/apricot/source/blender/blenloader/intern/readfile.c =================================================================== --- branches/apricot/source/blender/blenloader/intern/readfile.c 2008-07-22 17:44:06 UTC (rev 15697) +++ branches/apricot/source/blender/blenloader/intern/readfile.c 2008-07-22 17:49:15 UTC (rev 15698) @@ -69,6 +69,7 @@ #include "DNA_effect_types.h" #include "DNA_fileglobal_types.h" #include "DNA_group_types.h" +#include "DNA_gpencil_types.h" #include "DNA_ipo_types.h" #include "DNA_image_types.h" #include "DNA_key_types.h" @@ -3711,6 +3712,32 @@ /* ************ READ SCREEN ***************** */ +/* relinks grease-pencil data for 3d-view(s) - used for direct_link */ +static void link_gpencil(FileData *fd, bGPdata *gpd) +{ + bGPDlayer *gpl; + bGPDframe *gpf; + bGPDstroke *gps; + + /* relink layers */ + link_list(fd, &gpd->layers); + + for (gpl= gpd->layers.first; gpl; gpl= gpl->next) { + /* relink frames */ + link_list(fd, &gpl->frames); + gpl->actframe= newdataadr(fd, gpl->actframe); + + for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { + /* relink strokes (and their points) */ + link_list(fd, &gpf->strokes); + + for (gps= gpf->strokes.first; gps; gps= gps->next) { + gps->points= newdataadr(fd, gps->points); + } + } + } +} + /* note: file read without screens option G_FILE_NO_UI; check lib pointers in call below */ static void lib_link_screen(FileData *fd, Main *main) @@ -3722,23 +3749,23 @@ if(sc->id.flag & LIB_NEEDLINK) { sc->id.us= 1; sc->scene= newlibadr(fd, sc->id.lib, sc->scene); - + sa= sc->areabase.first; while(sa) { SpaceLink *sl; - + sa->full= newlibadr(fd, sc->id.lib, sa->full); - + /* space handler scriptlinks */ lib_link_scriptlink(fd, &sc->id, &sa->scriptlink); - + for (sl= sa->spacedata.first; sl; sl= sl->next) { if(sl->spacetype==SPACE_VIEW3D) { View3D *v3d= (View3D*) sl; - + v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera); v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre); - + if(v3d->bgpic) { v3d->bgpic->ima= newlibadr_us(fd, sc->id.lib, v3d->bgpic->ima); } @@ -4110,6 +4137,10 @@ v3d->bgpic= newdataadr(fd, v3d->bgpic); if(v3d->bgpic) v3d->bgpic->iuser.ok= 1; + if(v3d->gpd) { + v3d->gpd= newdataadr(fd, v3d->gpd); + link_gpencil(fd, v3d->gpd); + } v3d->localvd= newdataadr(fd, v3d->localvd); v3d->afterdraw.first= v3d->afterdraw.last= NULL; v3d->clipbb= newdataadr(fd, v3d->clipbb); @@ -4144,9 +4175,30 @@ } else if(sl->spacetype==SPACE_NODE) { SpaceNode *snode= (SpaceNode *)sl; + + if(snode->gpd) { + snode->gpd= newdataadr(fd, snode->gpd); + link_gpencil(fd, snode->gpd); + } snode->nodetree= snode->edittree= NULL; snode->flag |= SNODE_DO_PREVIEW; } + else if(sl->spacetype==SPACE_SEQ) { + SpaceSeq *sseq= (SpaceSeq *)sl; + if(sseq->gpd) { + sseq->gpd= newdataadr(fd, sseq->gpd); + link_gpencil(fd, sseq->gpd); + } + } + else if(sl->spacetype==SPACE_ACTION) { + SpaceAction *sact= (SpaceAction *)sl; + + /* WARNING: action-editor doesn't have it's own gpencil data! + * so only adjust pointer, but DON'T LINK + */ + if (sact->gpd) + sact->gpd= newdataadr(fd, sact->gpd); + } } sa->v1= newdataadr(fd, sa->v1); Modified: branches/apricot/source/blender/blenloader/intern/writefile.c =================================================================== --- branches/apricot/source/blender/blenloader/intern/writefile.c 2008-07-22 17:44:06 UTC (rev 15697) +++ branches/apricot/source/blender/blenloader/intern/writefile.c 2008-07-22 17:49:15 UTC (rev 15698) @@ -112,6 +112,7 @@ #include "DNA_customdata_types.h" #include "DNA_effect_types.h" #include "DNA_group_types.h" +#include "DNA_gpencil_types.h" #include "DNA_image_types.h" #include "DNA_ipo_types.h" #include "DNA_fileglobal_types.h" @@ -1565,6 +1566,32 @@ mywrite(wd, MYWRITE_FLUSH, 0); } +static void write_gpencil(WriteData *wd, bGPdata *gpd) +{ + bGPDlayer *gpl; + bGPDframe *gpf; + bGPDstroke *gps; + + /* write gpd data block to file */ + writestruct(wd, DATA, "bGPdata", 1, gpd); + + /* write grease-pencil layers to file */ + for (gpl= gpd->layers.first; gpl; gpl= gpl->next) { + writestruct(wd, DATA, "bGPDlayer", 1, gpl); + + /* write this layer's frames to file */ + for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { + writestruct(wd, DATA, "bGPDframe", 1, gpf); + + /* write strokes */ + for (gps= gpf->strokes.first; gps; gps= gps->next) { + writestruct(wd, DATA, "bGPDstroke", 1, gps); + writestruct(wd, DATA, "bGPDspoint", gps->totpoints, gps->points); + } + } + } +} + static void write_screens(WriteData *wd, ListBase *scrbase) { bScreen *sc; @@ -1610,11 +1637,12 @@ sl= sa->spacedata.first; while(sl) { if(sl->spacetype==SPACE_VIEW3D) { - View3D *v3d= (View3D*) sl; + View3D *v3d= (View3D *) sl; writestruct(wd, DATA, "View3D", 1, v3d); if(v3d->bgpic) writestruct(wd, DATA, "BGpic", 1, v3d->bgpic); if(v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd); if(v3d->clipbb) writestruct(wd, DATA, "BoundBox", 1, v3d->clipbb); + if(v3d->gpd) write_gpencil(wd, v3d->gpd); } else if(sl->spacetype==SPACE_IPO) { writestruct(wd, DATA, "SpaceIpo", 1, sl); @@ -1626,7 +1654,9 @@ writestruct(wd, DATA, "SpaceFile", 1, sl); } else if(sl->spacetype==SPACE_SEQ) { + SpaceSeq *sseq= (SpaceSeq *)sl; writestruct(wd, DATA, "SpaceSeq", 1, sl); + if(sseq->gpd) write_gpencil(wd, sseq->gpd); } else if(sl->spacetype==SPACE_OOPS) { SpaceOops *so= (SpaceOops *)sl; @@ -1689,7 +1719,9 @@ writestruct(wd, DATA, "SpaceTime", 1, sl); } else if(sl->spacetype==SPACE_NODE){ + SpaceNode *snode= (SpaceNode *)sl; writestruct(wd, DATA, "SpaceNode", 1, sl); + if(snode->gpd) write_gpencil(wd, snode->gpd); } sl= sl->next; } Modified: branches/apricot/source/blender/include/BDR_drawaction.h =================================================================== --- branches/apricot/source/blender/include/BDR_drawaction.h 2008-07-22 17:44:06 UTC (rev 15697) +++ branches/apricot/source/blender/include/BDR_drawaction.h 2008-07-22 17:49:15 UTC (rev 15698) @@ -38,6 +38,7 @@ struct bActionGroup; struct Object; struct ListBase; +struct bGPDlayer; /* ****************************** Base Structs ****************************** */ @@ -82,6 +83,7 @@ void draw_agroup_channel(struct gla2DDrawInfo *di, struct bActionGroup *agrp, float ypos); void draw_action_channel(struct gla2DDrawInfo *di, struct bAction *act, float ypos); void draw_object_channel(struct gla2DDrawInfo *di, struct Object *ob, float ypos); +void draw_gpl_channel(struct gla2DDrawInfo *di, struct bGPDlayer *gpl, float ypos); /* Keydata Generation */ void icu_to_keylist(struct IpoCurve *icu, ListBase *keys, ListBase *blocks, ActKeysInc *aki); @@ -89,6 +91,7 @@ void agroup_to_keylist(struct bActionGroup *agrp, ListBase *keys, ListBase *blocks, ActKeysInc *aki); void action_to_keylist(struct bAction *act, ListBase *keys, ListBase *blocks, ActKeysInc *aki); void ob_to_keylist(struct Object *ob, ListBase *keys, ListBase *blocks, ActKeysInc *aki); +void gpl_to_keylist(struct bGPDlayer *gpl, ListBase *keys, ListBase *blocks, ActKeysInc *aki); #endif /* BDR_DRAWACTION_H */ Modified: branches/apricot/source/blender/include/BIF_editaction.h =================================================================== --- branches/apricot/source/blender/include/BIF_editaction.h 2008-07-22 17:44:06 UTC (rev 15697) +++ branches/apricot/source/blender/include/BIF_editaction.h 2008-07-22 17:49:15 UTC (rev 15698) @@ -48,7 +48,8 @@ ACTTYPE_FILLIPO, ACTTYPE_FILLCON, ACTTYPE_IPO, - ACTTYPE_SHAPEKEY + ACTTYPE_SHAPEKEY, + ACTTYPE_GPLAYER }; /* Macros for easier/more consistant state testing */ @@ -69,7 +70,10 @@ #define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0) #define SEL_ICU(icu) (icu->flag & IPO_SELECT) -#define NLA_ACTION_SCALED (G.saction->pin==0 && OBACT && OBACT->action) +#define EDITABLE_GPL(gpl) ((gpl->flag & GP_LAYER_LOCKED)==0) +#define SEL_GPL(gpl) ((gpl->flag & GP_LAYER_ACTIVE) || (gpl->flag & GP_LAYER_SELECT)) + +#define NLA_ACTION_SCALED (G.saction->mode==SACTCONT_ACTION && G.saction->pin==0 && OBACT && OBACT->action) #define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) /* constants for setting ipo-interpolation type */ @@ -114,6 +118,8 @@ struct Key; struct ListBase; struct TimeMarker; +struct bGPdata; +struct bGPDlayer; /* Key operations */ void transform_action_keys(int mode, int dummy); @@ -176,6 +182,24 @@ void action_rename_localmarker(struct bAction *act); void action_remove_localmarkers(struct bAction *act); +/* Grease-Pencil Data */ +void gplayer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, short onlysel); + +void deselect_gpencil_layers(struct bGPdata *gpd, short select_mode); + +short is_gplayer_frame_selected(struct bGPDlayer *gpl); +void set_gplayer_frame_selection(struct bGPDlayer *gpl, short mode); +void select_gpencil_frames(struct bGPDlayer *gpl, short select_mode); +void select_gpencil_frame(struct bGPDlayer *gpl, int selx, short select_mode); +void borderselect_gplayer_frames(struct bGPDlayer *gpl, float min, float max, short select_mode); + +void delete_gpencil_layers(void); +void delete_gplayer_frames(struct bGPDlayer *gpl); +void duplicate_gplayer_frames(struct bGPDlayer *gpd); + +void snap_gplayer_frames(struct bGPDlayer *gpl, short mode); +void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode); + /* ShapeKey stuff */ struct Key *get_action_mesh_key(void); @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs