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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-30 03:57:32 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-30 03:57:32 +0300
commitd953e940d3c5b9302539dfd00624fd60bc0ed017 (patch)
tree9e75c4e5ecbb4412f89bea4b43577e6457c31318 /source/blender/makesrna/intern/rna_color.c
parentd86b38cd6163fe71774525388961b9919b3c7fd5 (diff)
RNA
* Added more DNA_color_types.h, starting from patch by Sebastian Skejø. What's missing is write access to some things like point location, hard to retrieve the CurveMapping for proper update still.. * Added all datablocks as ID pointer in Main already, now only have to change the type from ID to the specific type. Also added filename to Main, which is basically the only non-internal property. * Fixed setting shadow buffers size in lamps, also ensured it to be a multiple of 16.
Diffstat (limited to 'source/blender/makesrna/intern/rna_color.c')
-rw-r--r--source/blender/makesrna/intern/rna_color.c186
1 files changed, 185 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index d5c1b79d466..ba92cb9c938 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -32,17 +32,201 @@
#ifdef RNA_RUNTIME
+#include "BKE_colortools.h"
+
+static int rna_CurveMapping_curves_length(PointerRNA *ptr)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+ int len;
+
+ for(len=0; len<CM_TOT; len++)
+ if(!cumap->cm[len].curve)
+ break;
+
+ return len;
+}
+
+static void rna_CurveMapping_curves_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+
+ rna_iterator_array_begin(iter, cumap->cm, sizeof(CurveMap), rna_CurveMapping_curves_length(ptr), NULL);
+}
+
+static void rna_CurveMapping_use_clipping_set(PointerRNA *ptr, int value)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+
+ if(value) cumap->flag |= CUMA_DO_CLIP;
+ else cumap->flag &= ~CUMA_DO_CLIP;
+
+ curvemapping_changed(cumap, 0);
+}
+
+static void rna_CurveMapping_black_level_set(PointerRNA *ptr, int index, float value)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+ cumap->black[index]= value;
+ curvemapping_set_black_white(cumap, NULL, NULL);
+}
+
+static void rna_CurveMapping_white_level_set(PointerRNA *ptr, int index, float value)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+ cumap->white[index]= value;
+ curvemapping_set_black_white(cumap, NULL, NULL);
+}
+
+static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+
+ *min= -100.0f;
+ *max= cumap->clipr.xmax;
+}
+
+static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float *max)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+
+ *min= -100.0f;
+ *max= cumap->clipr.ymax;
+}
+
+static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float *max)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+
+ *min= cumap->clipr.xmin;
+ *max= 100.0f;
+}
+
+static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *max)
+{
+ CurveMapping *cumap= (CurveMapping*)ptr->data;
+
+ *min= cumap->clipr.ymin;
+ *max= 100.0f;
+}
+
#else
-void RNA_def_color(BlenderRNA *brna)
+static void rna_def_curvemappoint(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
+ static EnumPropertyItem prop_handle_type_items[] = {
+ {0, "AUTO", "Auto Handle", ""},
+ {CUMA_VECTOR, "VECTOR", "Vector Handle", ""},
+ {0, NULL, NULL, NULL}
+ };
srna= RNA_def_struct(brna, "CurveMapPoint", NULL, "CurveMapPoint");
+ /* not editable for now, need to have CurveMapping to do curvemapping_changed */
+
+ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+ RNA_def_property_ui_text(prop, "Location", "");
+
+ prop= RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flag", PROP_DEF_ENUM_BITFLAGS);
+ RNA_def_property_enum_items(prop, prop_handle_type_items);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+ RNA_def_property_ui_text(prop, "Handle Type", "");
+
+ prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_SELECT);
+ RNA_def_property_ui_text(prop, "Selected", "");
+}
+
+static void rna_def_curvemap(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static EnumPropertyItem prop_extend_items[] = {
+ {0, "HORIZONTAL", "Horizontal", ""},
+ {CUMA_EXTEND_EXTRAPOLATE, "EXTRAPOLATED", "Extrapolated", ""},
+ {0, NULL, NULL, NULL}
+ };
+
srna= RNA_def_struct(brna, "CurveMap", NULL, "CurveMap");
+ /* not editable for now, need to have CurveMapping to do curvemapping_changed */
+
+ prop= RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flag", CUMA_EXTEND_EXTRAPOLATE);
+ RNA_def_property_enum_items(prop, prop_extend_items);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+ RNA_def_property_ui_text(prop, "Extend", "");
+
+ prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "curve", "totpoint");
+ RNA_def_property_struct_type(prop, "CurveMapPoint");
+ RNA_def_property_ui_text(prop, "Points", "");
+}
+
+static void rna_def_curvemapping(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
srna= RNA_def_struct(brna, "CurveMapping", NULL, "CurveMapping");
+
+ prop= RNA_def_property(srna, "use_clipping", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP);
+ RNA_def_property_ui_text(prop, "Use Clipping", "");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_CurveMapping_use_clipping_set");
+
+ prop= RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.xmin");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Min X", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminx_range");
+
+ prop= RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.ymin");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Min Y", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminy_range");
+
+ prop= RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.xmax");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Max X", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxx_range");
+
+ prop= RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.ymax");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Max Y", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
+
+ prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_CurveMapping_curves_length", 0, 0);
+ RNA_def_property_struct_type(prop, "CurveMap");
+ RNA_def_property_ui_text(prop, "Curves", "");
+
+ prop= RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "black");
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Black Level", "");
+ RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_black_level_set", NULL);
+
+ prop= RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "white");
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "White Level", "");
+ RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_white_level_set", NULL);
+}
+
+void RNA_def_color(BlenderRNA *brna)
+{
+ rna_def_curvemappoint(brna);
+ rna_def_curvemap(brna);
+ rna_def_curvemapping(brna);
}
#endif