2.5
authorJoshua Leung <aligorith@gmail.com>
Sun, 15 Feb 2009 23:28:30 +0000 (23:28 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 15 Feb 2009 23:28:30 +0000 (23:28 +0000)
Added RNA wrapping for F-Curve colour settings

source/blender/blenkernel/intern/fcurve.c
source/blender/makesrna/intern/rna_action.c
source/blender/python/BPY_extern.h

index 6f8732a35e2590596b599691f7e5db44024f4e92..49d1b06d9a2bba4b4e373ebbe893d888db7c83f2 100644 (file)
@@ -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;
index 03a4ed27e9a3c0d8f21e8af266746914812c735b..d52881598f1f573b60ef5d19fecdf0d62024c06d 100755 (executable)
@@ -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");
index 296eb6296a72489a4dcb4c4368ddb0b4fe5a5386..35dba84d5535958db8f3f7969c225de4841e9ae3 100644 (file)
@@ -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);