Revision: 18501
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18501
Author:   ton
Date:     2009-01-14 17:13:50 +0100 (Wed, 14 Jan 2009)

Log Message:
-----------
2.5

GPencil code back!

Joshua will probably take this further. I've added XXX notes
where fixes are required. Also note that ED_gpencil.h has
all old exports, which is probably not needed, most can go
to gpencil_intern.h

Also added Makefile fixes for sculpt

Modified Paths:
--------------
    branches/blender2.5/blender/source/Makefile
    branches/blender2.5/blender/source/blender/editors/Makefile
    branches/blender2.5/blender/source/blender/editors/SConscript
    branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
    branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h
    
branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    
branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_intern.h
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/gpencil/drawgpencil.c
    
branches/blender2.5/blender/source/blender/editors/gpencil/editaction_gpencil.c
    branches/blender2.5/blender/source/blender/editors/gpencil/gpencil.c
    branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_intern.h
    branches/blender2.5/blender/source/blender/editors/include/ED_gpencil.h
    branches/blender2.5/blender/source/blender/editors/include/ED_sequencer.h
    branches/blender2.5/blender/source/blender/editors/sculpt/Makefile

Modified: branches/blender2.5/blender/source/Makefile
===================================================================
--- branches/blender2.5/blender/source/Makefile 2009-01-14 15:29:29 UTC (rev 
18500)
+++ branches/blender2.5/blender/source/Makefile 2009-01-14 16:13:50 UTC (rev 
18501)
@@ -241,6 +241,7 @@
 PULIB += $(OCGDIR)/blender/ed_curve/libed_curve.a
 PULIB += $(OCGDIR)/blender/ed_armature/libed_armature.a
 PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
+PULIB += $(OCGDIR)/blender/ed_sculpt/libed_sculpt.a
 PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a
 PULIB += $(OCGDIR)/blender/ed_transform/libed_transform.a
 PULIB += $(OCGDIR)/blender/ed_util/libed_util.a

Modified: branches/blender2.5/blender/source/blender/editors/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/editors/Makefile 2009-01-14 
15:29:29 UTC (rev 18500)
+++ branches/blender2.5/blender/source/blender/editors/Makefile 2009-01-14 
16:13:50 UTC (rev 18501)
@@ -29,6 +29,6 @@
 # Bounces make to subdirectories.
 
 SOURCEDIR = source/blender/editors
-DIRS = armature mesh animation object datafiles transform screen curve gpencil 
physics preview space_outliner space_time space_view3d interface util  
space_api space_ipo space_image space_node space_buttons space_info space_file 
space_sound space_action space_nla space_script space_text space_sequencer
+DIRS = armature mesh animation object sculpt datafiles transform screen curve 
gpencil physics preview space_outliner space_time space_view3d interface util  
space_api space_ipo space_image space_node space_buttons space_info space_file 
space_sound space_action space_nla space_script space_text space_sequencer
 
 include nan_subdirs.mk

Modified: branches/blender2.5/blender/source/blender/editors/SConscript
===================================================================
--- branches/blender2.5/blender/source/blender/editors/SConscript       
2009-01-14 15:29:29 UTC (rev 18500)
+++ branches/blender2.5/blender/source/blender/editors/SConscript       
2009-01-14 16:13:50 UTC (rev 18501)
@@ -11,7 +11,7 @@
                        'mesh/SConscript',
                        'object/SConscript',
                        'curve/SConscript',
-                       #'gpencil/SConscript', enable this when there is 
actually code in gpencil/
+                       'gpencil/SConscript',
                        #'physics/SConscript', enable this when there is 
actually code in physics/
                        #'preview/SConscript', enable this when there is 
actually code in preview/
                        'space_buttons/SConscript',

Copied: 
branches/blender2.5/blender/source/blender/editors/gpencil/drawgpencil.c (from 
rev 18495, trunk/blender/source/blender/src/drawgpencil.c)
===================================================================
--- branches/blender2.5/blender/source/blender/editors/gpencil/drawgpencil.c    
                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/gpencil/drawgpencil.c    
2009-01-14 16:13:50 UTC (rev 18501)
@@ -0,0 +1,1061 @@
+/**
+ * $Id$
+ *
+ * ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008, Blender Foundation
+ * This is a new part of Blender
+ *
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+ 
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <math.h>
+#include <float.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "BMF_Api.h"
+
+#include "BLI_arithb.h"
+#include "BLI_blenlib.h"
+
+#include "DNA_gpencil_types.h"
+#include "DNA_listBase.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_view3d_types.h"
+
+#include "BKE_blender.h"
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_sequence.h"
+#include "BKE_utildefines.h"
+
+#include "PIL_time.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "ED_gpencil.h"
+#include "ED_sequencer.h"
+#include "ED_util.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "gpencil_intern.h"
+
+/* ************************************************** */
+/* GREASE PENCIL PANEL-UI DRAWING */
+
+/* Every space which implements Grease-Pencil functionality should have a panel
+ * for the settings. All of the space-dependent parts should be coded in the 
panel
+ * code for that space, but the rest is all handled by generic panel here.
+ */
+
+/* ------- Callbacks ----------- */
+/* These are just 'dummy wrappers' around gpencil api calls */
+
+#if 0
+// XXX
+/* make layer active one after being clicked on */
+void gp_ui_activelayer_cb (void *gpd, void *gpl)
+{
+       gpencil_layer_setactive(gpd, gpl);
+       
+       scrarea_queue_winredraw(curarea);
+       allqueue(REDRAWACTION, 0);
+}
+
+/* rename layer and set active */
+void gp_ui_renamelayer_cb (void *gpd_arg, void *gpl_arg)
+{
+       bGPdata *gpd= (bGPdata *)gpd_arg;
+       bGPDlayer *gpl= (bGPDlayer *)gpl_arg;
+       
+       BLI_uniquename(&gpd->layers, gpl, "GP_Layer", offsetof(bGPDlayer, 
info[0]), 128);
+       gpencil_layer_setactive(gpd, gpl);
+       
+       scrarea_queue_winredraw(curarea);
+       allqueue(REDRAWACTION, 0);
+}
+
+/* add a new layer */
+void gp_ui_addlayer_cb (void *gpd, void *dummy)
+{
+       gpencil_layer_addnew(gpd);
+       
+       scrarea_queue_winredraw(curarea);
+       allqueue(REDRAWACTION, 0);
+}
+
+/* delete active layer */
+void gp_ui_dellayer_cb (void *gpd, void *dummy)
+{
+       gpencil_layer_delactive(gpd);
+       
+       scrarea_queue_winredraw(curarea);
+       allqueue(REDRAWACTION, 0);
+}
+
+/* delete last stroke of active layer */
+void gp_ui_delstroke_cb (void *gpd, void *gpl)
+{
+       bGPDframe *gpf= gpencil_layer_getframe(gpl, CFRA, 0);
+       
+       gpencil_layer_setactive(gpd, gpl);
+       gpencil_frame_delete_laststroke(gpf);
+       
+       scrarea_queue_winredraw(curarea);
+}
+
+/* delete active frame of active layer */
+void gp_ui_delframe_cb (void *gpd, void *gpl)
+{
+       bGPDframe *gpf= gpencil_layer_getframe(gpl, CFRA, 0);
+       
+       gpencil_layer_setactive(gpd, gpl);
+       gpencil_layer_delframe(gpl, gpf);
+       
+       scrarea_queue_winredraw(curarea);
+       allqueue(REDRAWACTION, 0);
+}
+
+/* convert the active layer to geometry */
+void gp_ui_convertlayer_cb (void *gpd, void *gpl)
+{
+       gpencil_layer_setactive(gpd, gpl);
+       gpencil_convert_menu();
+       
+       scrarea_queue_winredraw(curarea);
+}
+#endif
+
+/* ------- Drawing Code ------- */
+
+#if 0
+/* XXX */
+/* draw the controls for a given layer */
+static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, 
short *xco, short *yco)
+{
+       uiBut *but;
+       short active= (gpl->flag & GP_LAYER_ACTIVE);
+       short width= 314;
+       short height;
+       int rb_col;
+       
+       /* unless button has own callback, it adds this callback to button */
+       uiBlockSetFunc(block, gp_ui_activelayer_cb, gpd, gpl);
+       
+       /* draw header */
+       {
+               uiBlockSetEmboss(block, UI_EMBOSSN);
+               
+               /* rounded header */
+               if (active) uiBlockSetCol(block, TH_BUT_ACTION);
+                       rb_col= (active)?-20:20;
+                       uiDefBut(block, ROUNDBOX, B_REDR, "", *xco-8, *yco-2, 
width, 24, NULL, 5.0, 0.0, 15.0, (float)(rb_col-20), ""); 
+               if (active) uiBlockSetCol(block, TH_AUTO);
+               
+               /* lock toggle */
+               uiDefIconButBitI(block, ICONTOG, GP_LAYER_LOCKED, B_REDR, 
ICON_UNLOCKED,        *xco-7, *yco-1, 20, 20, &gpl->flag, 0.0, 0.0, 0, 0, 
"Layer cannot be modified");
+       }
+       
+       /* when layer is locked or hidden, only draw header */
+       if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) {
+               char name[256]; /* gpl->info is 128, but we need space for 
'locked/hidden' as well */
+               
+               height= 0;
+               
+               /* visibility button (only if hidden but not locked!) */
+               if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & 
GP_LAYER_LOCKED))
+                       uiDefIconButBitI(block, ICONTOG, GP_LAYER_HIDE, B_REDR, 
ICON_RESTRICT_VIEW_OFF, *xco+12, *yco-1, 20, 20, &gpl->flag, 0.0, 0.0, 0, 0, 
"Visibility of layer");
+               
+               /* name */
+               if (gpl->flag & GP_LAYER_HIDE)
+                       sprintf(name, "%s (Hidden)", gpl->info);
+               else
+                       sprintf(name, "%s (Locked)", gpl->info);
+               uiDefBut(block, LABEL, 1, name, *xco+35, *yco, 240, 20, NULL, 
0.0, 0.0, 0, 0, "Short description of what this layer is for (optional)");
+                       
+               /* delete button (only if hidden but not locked!) */
+               if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & 
GP_LAYER_LOCKED)) {
+                       but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 
*xco+(width-30), *yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
+                       uiButSetFunc(but, gp_ui_dellayer_cb, gpd, NULL);
+               }       
+               uiBlockSetEmboss(block, UI_EMBOSS);
+       }
+       else {
+               height= 97;
+               
+               /* draw rest of header */
+               {
+                       /* visibility button */
+                       uiDefIconButBitI(block, ICONTOG, GP_LAYER_HIDE, B_REDR, 
ICON_RESTRICT_VIEW_OFF, *xco+12, *yco-1, 20, 20, &gpl->flag, 0.0, 0.0, 0, 0, 
"Visibility of layer");
+                       
+                       uiBlockSetEmboss(block, UI_EMBOSS);
+                       
+                       /* name */
+                       but= uiDefButC(block, TEX, B_REDR, "Info:",     
*xco+36, *yco, 240, 19, gpl->info, 0, 127, 0, 0, "Short description of what 
this layer is for (optional)");
+                       uiButSetFunc(but, gp_ui_renamelayer_cb, gpd, gpl);
+                       
+                       /* delete 'button' */
+                       uiBlockSetEmboss(block, UI_EMBOSSN);
+                       
+                       but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 
*xco+(width-30), *yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
+                       uiButSetFunc(but, gp_ui_dellayer_cb, gpd, NULL);
+                       
+                       uiBlockSetEmboss(block, UI_EMBOSS);
+               }
+               
+               /* draw backdrop */
+               if (active) uiBlockSetCol(block, TH_BUT_ACTION);
+                       uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-8, 
*yco-height, width, height-1, NULL, 5.0, 0.0, 12.0, (float)rb_col, ""); 
+               if (active) uiBlockSetCol(block, TH_AUTO);
+               
+               /* draw settings */
+               {
+                       /* color */
+                       uiBlockBeginAlign(block);
+                               uiDefButF(block, COL, B_REDR, "",               
*xco, *yco-26, 150, 19, gpl->color, 0, 0, 0, 0, "Color to use for all strokes 
on this Grease Pencil Layer");

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to