[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25820] trunk/blender/source/blender: Grease Pencil: Lock current frame option

Joshua Leung aligorith at gmail.com
Fri Jan 8 02:39:41 CET 2010


Revision: 25820
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25820
Author:   aligorith
Date:     2010-01-08 02:39:41 +0100 (Fri, 08 Jan 2010)

Log Message:
-----------
Grease Pencil: Lock current frame option

It is now possible to make Grease Pencil Layers to keep displaying and editing the current sketch-frame with this option. This allows to draw a frame which contains markings made for different times (i.e. a spacing/timing chart that you can keep adding to as you scrub to different points on the timeline).

Use the clipboard/camera toggle (the one beside the visibility toggle) to enable. This should get an icon of its own at some point...

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_brush.h
    trunk/blender/source/blender/blenkernel/intern/gpencil.c
    trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c
    trunk/blender/source/blender/makesdna/DNA_gpencil_types.h
    trunk/blender/source/blender/makesrna/intern/rna_gpencil.c

Modified: trunk/blender/source/blender/blenkernel/BKE_brush.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_brush.h	2010-01-08 01:14:06 UTC (rev 25819)
+++ trunk/blender/source/blender/blenkernel/BKE_brush.h	2010-01-08 01:39:41 UTC (rev 25820)
@@ -55,7 +55,7 @@
 int brush_clone_image_delete(struct Brush *brush);
 
 /* brush curve */
-void brush_curve_preset(struct Brush *b, enum CurveMappingPreset preset);
+void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset);
 float brush_curve_strength_clamp(struct Brush *br, float p, const float len);
 float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
 

Modified: trunk/blender/source/blender/blenkernel/intern/gpencil.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/gpencil.c	2010-01-08 01:14:06 UTC (rev 25819)
+++ trunk/blender/source/blender/blenkernel/intern/gpencil.c	2010-01-08 01:39:41 UTC (rev 25820)
@@ -349,8 +349,10 @@
 	if (gpl->actframe) {
 		gpf= gpl->actframe;
 		
-		/* do not allow any changes to layer's active frame if layer is locked */
-		if (gpl->flag & GP_LAYER_LOCKED)
+		/* do not allow any changes to layer's active frame if layer is locked from changes
+		 * or if the layer has been set to stay on the current frame
+		 */
+		if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_FRAMELOCK))
 			return gpf;
 		/* do not allow any changes to actframe if frame has painting tag attached to it */
 		if (gpf->flag & GP_FRAME_PAINT) 

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c	2010-01-08 01:14:06 UTC (rev 25819)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c	2010-01-08 01:39:41 UTC (rev 25820)
@@ -119,13 +119,13 @@
 	box= uiLayoutBox(layout);
 	
 	row= uiLayoutRow(box, 0);
+	uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
 	block= uiLayoutGetBlock(row); // err...
 	
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 	
 	/* left-align ............................... */
-	subrow= uiLayoutRow(row, 1);
-	uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
+	subrow= uiLayoutRow(row, 0);
 	
 	/* active */
 	icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
@@ -168,6 +168,11 @@
 		/* visibility button */
 		uiItemR(subrow, "", ICON_RESTRICT_VIEW_OFF, &ptr, "hide", 0); 
 		
+		/* frame locking */
+		// TODO: this needs its own icons...
+		icon= (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION;
+		uiItemR(subrow, "", icon, &ptr, "frame_lock", 0); 
+		
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		
 		/* name */
@@ -189,7 +194,6 @@
 		box= uiLayoutBox(layout);
 		split= uiLayoutSplit(box, 0.5f, 0);
 		
-		
 		/* draw settings ---------------------------------- */
 		/* left column ..................... */
 		col= uiLayoutColumn(split, 0);
@@ -259,14 +263,13 @@
 		uiItemL(col, "Drawing Settings:", 0);
 		
 		/* 'stick to view' option */
-		//uiItemR(col, NULL, 0, &gpd_ptr, "draw_mode", 0);
 		row= uiLayoutRow(col, 1);
 		uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "VIEW");
 		uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "CURSOR");
 		row= uiLayoutRow(col, 1);
 		uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "SURFACE");
 		uiItemEnumR_string(row, NULL, 0, &gpd_ptr, "draw_mode", "STROKE");
-
+		
 		row= uiLayoutRow(col, 0);
 		uiLayoutSetActive(row, (gpd->flag & (GP_DATA_DEPTH_STROKE|GP_DATA_DEPTH_VIEW)) ? 1:0);
 		uiItemR(row, NULL, 0, &gpd_ptr, "use_stroke_endpoints", 0);

Modified: trunk/blender/source/blender/makesdna/DNA_gpencil_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_gpencil_types.h	2010-01-08 01:14:06 UTC (rev 25819)
+++ trunk/blender/source/blender/makesdna/DNA_gpencil_types.h	2010-01-08 01:39:41 UTC (rev 25820)
@@ -113,6 +113,8 @@
 #define GP_LAYER_ONIONSKIN	(1<<4)
 	/* for editing in Action Editor */
 #define GP_LAYER_SELECT		(1<<5)
+	/* current frame for layer can't be changed */
+#define GP_LAYER_FRAMELOCK	(1<<6)
 
 
 /* Grease-Pencil Annotations - 'DataBlock' */

Modified: trunk/blender/source/blender/makesrna/intern/rna_gpencil.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_gpencil.c	2010-01-08 01:14:06 UTC (rev 25819)
+++ trunk/blender/source/blender/makesrna/intern/rna_gpencil.c	2010-01-08 01:39:41 UTC (rev 25820)
@@ -199,6 +199,10 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED);
 	RNA_def_property_ui_text(prop, "Locked", "Layer is protected from further editing and/or frame changes.");
 	
+	prop= RNA_def_property(srna, "frame_lock", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK);
+	RNA_def_property_ui_text(prop, "Frame Locked", "Current frame displayed by layer cannot be changed.");
+	
 	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");





More information about the Bf-blender-cvs mailing list