diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-01-06 03:56:20 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-01-06 03:56:20 +0300 |
commit | 0d9feca157552353fb4537fc33f274d180967ae3 (patch) | |
tree | fed9590b095e0fb61e099be1569b6ccc98a748ce /source/blender/makesrna | |
parent | c16c6c053678168ae3779c2c56f9b2d555f760c0 (diff) |
Added RNA for color ramps, as well as color-ramp properties for material
and color.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 61 |
3 files changed, 70 insertions, 4 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 939753d3992..3223c1947e7 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -62,6 +62,8 @@ extern StructRNA RNA_CollectionProperty; extern StructRNA RNA_CollisionModifier; extern StructRNA RNA_CollisionSensor; extern StructRNA RNA_CollisionSettings; +extern StructRNA RNA_ColorRamp; +extern StructRNA RNA_ColorRampElement; extern StructRNA RNA_ColorSequence; extern StructRNA RNA_Constraint; extern StructRNA RNA_ControlFluidSettings; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 85698da2d82..20bac170554 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -103,6 +103,17 @@ static void rna_def_material_colors(StructRNA *srna, PropertyRNA *prop) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Alpha", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + /* Color bands */ + prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "ramp_col"); + RNA_def_property_struct_type(prop, "ColorRamp"); + RNA_def_property_ui_text(prop, "Color Ramp", ""); + + prop= RNA_def_property(srna, "specularity_ramp", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec"); + RNA_def_property_struct_type(prop, "ColorRamp"); + RNA_def_property_ui_text(prop, "Specularity Ramp", ""); } static void rna_def_material_diffuse(StructRNA *srna, PropertyRNA *prop) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b35e763d024..12dc72c2616 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -37,6 +37,58 @@ #else +void rna_def_color_ramp_element(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "ColorRampElement", NULL); + RNA_def_struct_sdna(srna, "CBData"); + RNA_def_struct_ui_text(srna, "Color Ramp Element", "DOC_BROKEN"); + + prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "r"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Color", ""); + + prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "pos"); + RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_text(prop, "Position", ""); + + /* XXX: CBData.cur? */ +} + +void rna_def_color_ramp(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_interpolation_items[] = { + {1, "EASE", "Ease", ""}, + {3, "CARDINAL", "Cardinal", ""}, + {0, "LINEAR", "Linear", ""}, + {2, "B_SPLINE", "B-Spline", ""}, + {4, "CONSTANT", "Constant", ""}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "ColorRamp", NULL); + RNA_def_struct_sdna(srna, "ColorBand"); + RNA_def_struct_ui_text(srna, "Color Ramp", "DOC_BROKEN"); + + prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR); + RNA_def_property_collection_sdna(prop, NULL, "data", "tot"); + RNA_def_property_struct_type(prop, "ColorRampElement"); + RNA_def_property_ui_text(prop, "Elements", ""); + + /* XXX: CBData.flag, tot, cur ? */ + + prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ipotype"); + RNA_def_property_enum_items(prop, prop_interpolation_items); + RNA_def_property_ui_text(prop, "Interpolation", ""); +} + void rna_def_mapping_texture(BlenderRNA *brna) { StructRNA *srna; @@ -295,6 +347,8 @@ void RNA_def_texture(BlenderRNA *brna) rna_def_mapping_texture(brna); rna_def_environment_map(brna); + rna_def_color_ramp(brna); + rna_def_color_ramp_element(brna); srna= RNA_def_struct(brna, "Texture", "ID"); RNA_def_struct_sdna(srna, "Tex"); @@ -437,11 +491,10 @@ void RNA_def_texture(BlenderRNA *brna) /* XXX: plugin */ - /* - prop= RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE); + prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "coba"); - RNA_def_property_struct_type(prop, "ColorBand"); - RNA_def_property_ui_text(prop, "Color Band", "");*/ + RNA_def_property_struct_type(prop, "ColorRamp"); + RNA_def_property_ui_text(prop, "Color Ramp", ""); prop= RNA_def_property(srna, "environment_map", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "env"); |