[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25020] trunk/blender/source/blender: * Grease Pencil drawing now works with Repeat Last operator.
Joshua Leung
aligorith at gmail.com
Mon Nov 30 04:10:49 CET 2009
Revision: 25020
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25020
Author: aligorith
Date: 2009-11-30 04:10:46 +0100 (Mon, 30 Nov 2009)
Log Message:
-----------
* Grease Pencil drawing now works with Repeat Last operator. Stroke info is now saved when drawing strokes, but unfortunately, the post-draw settings tweaking doesn't work from the toolbar still (due to missing region context info)
* Added some update callbacks/flags for F-Curve properties, so changing the colour of an F-Curve updates in realtime.
Modified Paths:
--------------
trunk/blender/source/blender/editors/armature/armature_ops.c
trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
Modified: trunk/blender/source/blender/editors/armature/armature_ops.c
===================================================================
--- trunk/blender/source/blender/editors/armature/armature_ops.c 2009-11-30 02:42:10 UTC (rev 25019)
+++ trunk/blender/source/blender/editors/armature/armature_ops.c 2009-11-30 03:10:46 UTC (rev 25020)
@@ -162,7 +162,7 @@
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2009-11-30 02:42:10 UTC (rev 25019)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2009-11-30 03:10:46 UTC (rev 25020)
@@ -151,11 +151,11 @@
return (gpencil_data_get_pointers(C, NULL) != NULL);
}
-static int gpencil_project_check(tGPsdata *p)
+/* check if projecting strokes into 3d-geometry in the 3D-View */
+static int gpencil_project_check (tGPsdata *p)
{
bGPdata *gpd= p->gpd;
-
- /* in 3d-space - pt->x/y/z are 3 side-by-side floats */
+
if( (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) &&
(p->scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE) &&
(p->scene->toolsettings->snap_flag & SCE_SNAP_PROJECT) )
@@ -227,12 +227,14 @@
/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
if (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) {
if(gpencil_project_check(p) && (view_autodist_simple(p->ar, mval, out))) {
- /* pass */
+ /* projecting onto 3D-Geometry
+ * - nothing more needs to be done here, since view_autodist_simple() has already done it
+ */
}
else {
const short mx=mval[0], my=mval[1];
float rvec[3], dvec[3];
-
+
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
* works OK, but it could of course be improved.
@@ -241,9 +243,9 @@
* - investigate using nearest point(s) on a previous stroke as
* reference point instead or as offset, for easier stroke matching
*/
-
+
gp_get_3d_reference(p, rvec);
-
+
/* method taken from editview.c - mouse_cursor() */
project_short_noclip(p->ar, rvec, mval);
window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my);
@@ -1136,6 +1138,8 @@
/* cleanup */
if(gpencil_project_check(p)) {
View3D *v3d= p->sa->spacedata.first;
+
+ /* need to restore the original projection settings before packing up */
view3d_operator_needs_opengl(C);
view_autodist_init(p->scene, p->ar, v3d);
}
@@ -1206,8 +1210,8 @@
{
tGPsdata *p= op->customdata;
ARegion *ar= p->ar;
- //PointerRNA itemptr;
- //float mousef[2];
+ PointerRNA itemptr;
+ float mousef[2];
int tablet=0;
/* convert from window-space to area-space mouse coordintes */
@@ -1242,7 +1246,6 @@
return;
}
-#if 0 // NOTE: disabled for now, since creating this data is currently useless anyways (and slows things down)
/* fill in stroke data (not actually used directly by gpencil_draw_apply) */
RNA_collection_add(op->ptr, "stroke", &itemptr);
@@ -1250,7 +1253,6 @@
mousef[1]= p->mval[1];
RNA_float_set_array(&itemptr, "mouse", mousef);
RNA_float_set(&itemptr, "pressure", p->pressure);
-#endif
/* apply the current latest drawing point */
gpencil_draw_apply(C, op, p);
@@ -1261,7 +1263,7 @@
/* ------------------------------- */
-/* operator 'redo' (i.e. after changing some properties) */
+/* operator 'redo' (i.e. after changing some properties, but also for repeat last) */
static int gpencil_draw_exec (bContext *C, wmOperator *op)
{
tGPsdata *p = NULL;
@@ -1462,6 +1464,5 @@
/* settings for drawing */
RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to intepret mouse movements.");
- // xxx the stuff below is used only for redo operator, but is not really working
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-11-30 02:42:10 UTC (rev 25019)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-11-30 03:10:46 UTC (rev 25020)
@@ -862,7 +862,7 @@
RNA_def_property_struct_type(prop, "FModifier");
RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active fcurve modifier", "Active fcurve modifier.");
+ RNA_def_property_ui_text(prop, "Active F-Curve Modifier", "Active F-Curve Modifier.");
/* Constraint collection */
func= RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
@@ -910,6 +910,7 @@
RNA_def_property_enum_sdna(prop, NULL, "extend");
RNA_def_property_enum_items(prop, prop_mode_extend_items);
RNA_def_property_ui_text(prop, "Extrapolation", "");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL); // XXX need an update callback for this so that animation gets evaluated
/* Pointers */
prop= RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
@@ -920,18 +921,22 @@
prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set");
RNA_def_property_ui_text(prop, "RNA Path", "RNA Path to property affected by F-Curve.");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL); // XXX need an update callback for this to that animation gets evaluated
prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable.");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL); // XXX need an update callback for this so that animation gets evaluated
/* Color */
prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mode_color_items);
RNA_def_property_ui_text(prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor.");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor.");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
/* Collections */
prop= RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
More information about the Bf-blender-cvs
mailing list