[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19806] branches/blender2.5/blender/source /blender: A bit more F-Modifier wrapping...
Joshua Leung
aligorith at gmail.com
Mon Apr 20 05:29:46 CEST 2009
Revision: 19806
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19806
Author: aligorith
Date: 2009-04-20 05:29:45 +0200 (Mon, 20 Apr 2009)
Log Message:
-----------
A bit more F-Modifier wrapping...
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c
Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c 2009-04-20 00:19:16 UTC (rev 19805)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_buttons.c 2009-04-20 03:29:45 UTC (rev 19806)
@@ -162,20 +162,6 @@
WM_event_add_notifier(C, NC_SCENE, scene);
}
-#if 0 // XXX replace this for RNA
-/* callback to copy over RNA-Paths accordingly */
-static void driver_rnapath_copy_cb (bContext *C, void *driver_v, void *strbuf_v)
-{
- ChannelDriver *driver= (ChannelDriver *)driver_v;
- char *stringBuf= (char *)strbuf_v;
-
- /* copy over string */
- if (driver->rna_path)
- MEM_freeN(driver->rna_path);
- driver->rna_path= BLI_strdupn(stringBuf, strlen(stringBuf));
-}
-#endif
-
/* callback to remove the active driver */
static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v)
{
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-04-20 00:19:16 UTC (rev 19805)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_fcurve.c 2009-04-20 03:29:45 UTC (rev 19806)
@@ -104,7 +104,8 @@
FMod_Generator *gen= (FMod_Generator *)fcm->data;
switch (gen->mode) {
- //case FCM_GENERATOR_POLYNOMIAL:
+ case FCM_GENERATOR_POLYNOMIAL:
+ return &RNA_FModifierGenerator_PolyExpanded;
//case FCM_GENERATOR_POLYNOMIAL_FACTORISED:
case FCM_GENERATOR_FUNCTION:
return &RNA_FModifierGenerator_Function;
@@ -214,9 +215,10 @@
{FCM_GENERATOR_EXPRESSION, "EXPRESSION", "Expression", ""},
{0, NULL, NULL, NULL}};
+ /* struct wrapping settings */
RNA_def_struct_sdna_from(srna, "FMod_Generator", "data");
- //RNA_def_struct_ui_text(srna, "Generator F-Curve Modifier", "Deterministically generates values for the modified F-Curve.");
+ /* settings */
prop= RNA_def_property(srna, "additive", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
RNA_def_property_ui_text(prop, "Additive", "Values generated by this modifier are applied on top of the existing values instead of overwriting them.");
@@ -227,19 +229,39 @@
RNA_def_property_ui_text(prop, "Mode", "Type of generator to use.");
}
-// XXX this is temporary...
+/* this is a temporary dummy generator-modifier wrapping (to be discarded) */
static void rna_def_fmodifier_generator(BlenderRNA *brna)
{
StructRNA *srna;
srna= RNA_def_struct(brna, "FModifierGenerator", "FModifier");
- RNA_def_struct_sdna(srna, "FMod_Generator");
- RNA_def_struct_ui_text(srna, "Generator F-Curve Modifier", "Generates values for modified F-Curve.");
+ RNA_def_struct_ui_text(srna, "Generator F-Curve Modifier", "Deterministically generates values for the modified F-Curve.");
/* define common props */
rna_def_fmodifier_generator_common(srna);
}
+static void rna_def_fmodifier_generator_polyexpanded(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "FModifierGenerator_PolyExpanded", "FModifier");
+ RNA_def_struct_ui_text(srna, "Expanded Polynomial Generator", "Generates values for the modified F-Curve using expanded polynomial expresion.");
+
+ /* define common props */
+ rna_def_fmodifier_generator_common(srna);
+
+ /* order of the polynomial */
+ // XXX this has a special validation func
+ prop= RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Polynomial Order", "The highest power of 'x' for this polynomial. (i.e. the number of coefficients - 1)");
+
+ /* coefficients array */
+ //prop= RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE);
+ //RNA_def_property_ui_text(prop, "Coefficients", "Coefficients for 'x' (starting from lowest power).");
+}
+
static void rna_def_fmodifier_generator_function(BlenderRNA *brna)
{
StructRNA *srna;
@@ -300,11 +322,34 @@
static void rna_def_fmodifier_cycles(BlenderRNA *brna)
{
StructRNA *srna;
- //PropertyRNA *prop;
+ PropertyRNA *prop;
+ static EnumPropertyItem prop_type_items[] = {
+ {0, "NONE", "No Cycles", ""},
+ {1, "REPEAT", "Repeat Motion", ""},
+ {1, "REPEAT_OFFSET", "Repeat with Offset", ""},
+ {0, NULL, NULL, NULL}};
+
srna= RNA_def_struct(brna, "FModifierCycles", "FModifier");
RNA_def_struct_ui_text(srna, "Cycles F-Curve Modifier", "Repeats the values of the modified F-Curve.");
RNA_def_struct_sdna_from(srna, "FMod_Cycles", "data");
+
+ /* before */
+ prop= RNA_def_property(srna, "before_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "Before Mode", "Cycling mode to use before first keyframe.");
+
+ prop= RNA_def_property(srna, "before_cycles", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Before Cycles", "Maximum number of cycles to allow before first keyframe. (0 = infinite)");
+
+
+ /* after */
+ prop= RNA_def_property(srna, "after_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "After Mode", "Cycling mode to use after last keyframe.");
+
+ prop= RNA_def_property(srna, "after_cycles", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "After Cycles", "Maximum number of cycles to allow after last keyframe. (0 = infinite)");
}
/* --------- */
@@ -348,22 +393,18 @@
prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.xmin");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.ymin");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.xmax");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.ymax");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
}
@@ -556,6 +597,7 @@
rna_def_fmodifier(brna);
rna_def_fmodifier_generator(brna);
+ rna_def_fmodifier_generator_polyexpanded(brna);
rna_def_fmodifier_generator_function(brna);
rna_def_fmodifier_envelope(brna);
rna_def_fmodifier_cycles(brna);
More information about the Bf-blender-cvs
mailing list