Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-02-16 02:28:30 +0300
committerJoshua Leung <aligorith@gmail.com>2009-02-16 02:28:30 +0300
commit95207cec009bfb406b5c64046a5765ff466eeb68 (patch)
treee3319de521e2de67d366340438fb325dadb2055c /source
parente05742b64d9a9fcecd42d0a58af1d6d4706c7759 (diff)
2.5
Added RNA wrapping for F-Curve colour settings
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c3
-rwxr-xr-xsource/blender/makesrna/intern/rna_action.c23
-rw-r--r--source/blender/python/BPY_extern.h6
3 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 6f8732a35e2..49d1b06d9a2 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -622,8 +622,7 @@ static float evaluate_driver (ChannelDriver *driver, float evaltime)
/* this evaluates the expression using Python,and returns its result:
* - on errors it reports, then returns 0.0f
*/
- //return BPY_pydriver_eval(driver); // XXX old func
- return 1.0f;
+ return BPY_pydriver_eval(driver);
#endif /* DISABLE_PYTHON*/
}
break;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 03a4ed27e9a..d52881598f1 100755
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -157,6 +157,11 @@ void rna_def_fcurve(BlenderRNA *brna)
{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", "Constant", ""},
{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", "Linear", ""},
{0, NULL, NULL, NULL}};
+ static EnumPropertyItem prop_mode_color_items[] = {
+ {FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", "Automatic Rainbow", ""},
+ {FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", "Automatic XYZ to RGB", ""},
+ {FCURVE_COLOR_CUSTOM, "CUSTOM", "User Defined", ""},
+ {0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "FCurve", NULL);
RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time.");
@@ -164,14 +169,13 @@ void rna_def_fcurve(BlenderRNA *brna)
/* Enums */
prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "extend");
- RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
RNA_def_property_enum_items(prop, prop_mode_extend_items);
RNA_def_property_ui_text(prop, "Extrapolation", "");
/* Pointers */
- //prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- //RNA_def_property_pointer_sdna(prop, NULL, "driver");
- //RNA_def_property_ui_text(prop, "Driver", "");
+ prop= RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE); // xxx?
+ RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)");
/* Path + Array Index */
prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE);
@@ -181,7 +185,16 @@ void rna_def_fcurve(BlenderRNA *brna)
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.");
-
+
+ /* 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.");
+
+ 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.");
+
/* Collections */
prop= RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 296eb6296a7..35dba84d553 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -36,7 +36,7 @@ extern char btempdir[]; /* use this to store a valid temp directory */
struct Text; /* defined in DNA_text_types.h */
struct ID; /* DNA_ID.h */
struct Object; /* DNA_object_types.h */
-struct IpoDriver; /* DNA_curve_types.h */
+struct ChannelDriver; /* DNA_anim_types.h */
struct ScriptLink; /* DNA_scriptlink_types.h */
struct ListBase; /* DNA_listBase.h */
struct SpaceText; /* DNA_space_types.h */
@@ -116,8 +116,8 @@ extern "C" {
short eventValue, unsigned short space_event);
void BPY_pydriver_update(void);
- float BPY_pydriver_eval(struct IpoDriver *driver);
- struct Object **BPY_pydriver_get_objects(struct IpoDriver *driver);
+ float BPY_pydriver_eval(struct ChannelDriver *driver);
+ struct Object **BPY_pydriver_get_objects(struct ChannelDriver *driver);
int BPY_button_eval(char *expr, double *value);