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:
authorNicholas Bishop <nicholasbishop@gmail.com>2009-01-03 22:39:39 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2009-01-03 22:39:39 +0300
commit927adad8e254fc9f28a483abbe4ce0c663788276 (patch)
tree88174a5de8a4f772541cbbe474382da47733bf1b
parent666f82a0a9e0006c4360bec229a32f7cf53c2023 (diff)
Added RNA for MTex, also property for mtex array in Material RNA.
-rw-r--r--source/blender/makesrna/intern/rna_material.c16
-rw-r--r--source/blender/makesrna/intern/rna_texture.c22
2 files changed, 36 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 407a421bdd7..4e342664af0 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -30,6 +30,7 @@
#include "rna_internal.h"
#include "DNA_material_types.h"
+#include "DNA_texture_types.h"
#include "WM_types.h"
@@ -45,6 +46,12 @@ static void rna_Material_mode_halo_set(PointerRNA *ptr, int value)
mat->mode &= ~(MA_HALO|MA_STAR|MA_HALO_XALPHA|MA_ZINV|MA_ENV);
}
+static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Material *mat= (Material*)ptr->data;
+ rna_iterator_array_begin(iter, (void*)mat->mtex, sizeof(MTex*), MAX_MTEX, NULL);
+}
+
#else
static void rna_def_material_colors(StructRNA *srna, PropertyRNA *prop)
@@ -402,16 +409,21 @@ static void rna_def_material_halo(StructRNA *srna, PropertyRNA *prop)
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SOFT); /* use bitflags */
RNA_def_property_ui_text(prop, "Halo Mode Soft", "Softens the halo.");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-
}
void RNA_def_material(BlenderRNA *brna)
{
StructRNA *srna= NULL;
PropertyRNA *prop= NULL;
-
+
srna= RNA_def_struct(brna, "Material", "ID");
RNA_def_struct_ui_text(srna, "Material", "DOC_BROKEN");
+
+ /* mtex */
+ prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MappingTexture");
+ RNA_def_property_collection_funcs(prop, "rna_Material_mtex_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 0);
+ RNA_def_property_ui_text(prop, "Textures", "");
/* colors */
rna_def_material_colors(srna, prop);
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 7abf5c0e41a..27054f8d8f6 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -71,6 +71,13 @@ void rna_def_mapping_texture(BlenderRNA *brna)
{MTEX_BLEND_COLOR, "COLOR", "Color", ""},
{0, NULL, NULL, NULL}};
+ static EnumPropertyItem prop_mapping_items[] = {
+ {MTEX_FLAT, "FLAT", "Flat", "Maps X and Y coordinates directly."},
+ {MTEX_CUBE, "CUBE", "Cube", "Maps using the normal vector."},
+ {MTEX_TUBE, "TUBE", "Tube", "Maps with Z as central axis."},
+ {MTEX_SPHERE, "SPHERE", "Sphere", "Maps with Z as central axis."},
+ {0, NULL, NULL, NULL}};
+
srna= RNA_def_struct(brna, "MappingTexture", NULL);
RNA_def_struct_sdna(srna, "MTex");
RNA_def_struct_ui_text(srna, "MappingTexture", "DOC_BROKEN");
@@ -96,6 +103,21 @@ void rna_def_mapping_texture(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "tex");
RNA_def_property_struct_type(prop, "Texture");
RNA_def_property_ui_text(prop, "Texture", "");
+
+ /* XXX: MTex.uvname, MTex.proj[xyz] */
+
+ prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "");
+
+ prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "ofs");
+ RNA_def_property_ui_range(prop, -10, 10, 10, 2);
+ RNA_def_property_ui_text(prop, "Offset", "");
+
+ prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_ui_range(prop, -100, 100, 10, 2);
+ RNA_def_property_ui_text(prop, "Size", "");
}
void rna_def_environment_map(BlenderRNA *brna)