[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37359] branches/soc-2011-avocado/blender: Initial commit for grease pencil to bmesh tool.

Dan Walters dan683 at gmail.com
Fri Jun 10 09:27:30 CEST 2011


Revision: 37359
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37359
Author:   dan_w
Date:     2011-06-10 07:27:30 +0000 (Fri, 10 Jun 2011)
Log Message:
-----------
Initial commit for grease pencil to bmesh tool. Contains python ui, corresponding c code, and base grease pencil crawling code.

Modified Paths:
--------------
    branches/soc-2011-avocado/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_intern.h
    branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_ops.c
    branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_paint.c

Modified: branches/soc-2011-avocado/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-avocado/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-10 07:22:35 UTC (rev 37358)
+++ branches/soc-2011-avocado/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-10 07:27:30 UTC (rev 37359)
@@ -57,6 +57,9 @@
 
     row = col.row()
     row.prop(context.tool_settings, "use_grease_pencil_sessions")
+	
+    row = col.row()
+    row.operator("gpencil.convert_to_bmesh", text="Convert to Mesh")
 
 # ********** default tools for objectmode ****************
 

Modified: branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_intern.h
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_intern.h	2011-06-10 07:22:35 UTC (rev 37358)
+++ branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_intern.h	2011-06-10 07:27:30 UTC (rev 37359)
@@ -44,6 +44,7 @@
 /* drawing ---------- */
 
 void GPENCIL_OT_draw(struct wmOperatorType *ot);
+void GPENCIL_OT_convert_to_bmesh(struct wmOperatorType *ot);
 
 /* Paint Modes for operator*/
 typedef enum eGPencil_PaintModes {

Modified: branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_ops.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_ops.c	2011-06-10 07:22:35 UTC (rev 37358)
+++ branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_ops.c	2011-06-10 07:27:30 UTC (rev 37359)
@@ -73,6 +73,7 @@
 	/* Drawing ----------------------- */
 	
 	WM_operatortype_append(GPENCIL_OT_draw);
+	WM_operatortype_append(GPENCIL_OT_convert_to_bmesh);
 	
 	/* Editing (Buttons) ------------ */
 	

Modified: branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-06-10 07:22:35 UTC (rev 37358)
+++ branches/soc-2011-avocado/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-06-10 07:27:30 UTC (rev 37359)
@@ -1598,6 +1598,31 @@
 	return OPERATOR_RUNNING_MODAL;
 }
 
+/* start of interactive drawing part of operator */
+static int gpencil_to_bmesh_invoke (bContext *C, wmOperator *op, wmEvent *event)
+{
+	bGPdata **gpd_ptr = NULL;
+	PointerRNA ptr;
+
+	/* get pointer to Grease Pencil Data */
+	gpd_ptr= gpencil_data_get_pointers((bContext *)C, &ptr);
+
+	if (gpd_ptr)
+	{
+		bGPDlayer* p_gp_layer = gpencil_layer_getactive(*gpd_ptr);
+		if(p_gp_layer)
+		{
+			bGPDframe* p_actframe = p_gp_layer->actframe;
+			if(p_actframe)
+			{
+				//
+			}
+		}
+	}
+
+	return 0;
+}
+
 /* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */
 static int gpencil_area_exists(bContext *C, ScrArea *satest)
 {
@@ -1783,3 +1808,15 @@
 	
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
 }
+
+void GPENCIL_OT_convert_to_bmesh (wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Grease Pencil To BMesh COnvert";
+	ot->idname= "GPENCIL_OT_convert_to_bmesh";
+	ot->description= "Convert active grease pencil data to b mesh";
+
+	/* api callbacks */
+	ot->invoke= gpencil_to_bmesh_invoke;
+}
+




More information about the Bf-blender-cvs mailing list