Revision: 18294 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18294 Author: nicholasbishop Date: 2009-01-03 20:39:39 +0100 (Sat, 03 Jan 2009)
Log Message: ----------- Added RNA for MTex, also property for mtex array in Material RNA. Modified Paths: -------------- branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c branches/blender2.5/blender/source/blender/makesrna/intern/rna_texture.c Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c =================================================================== --- branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c 2009-01-03 18:43:11 UTC (rev 18293) +++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c 2009-01-03 19:39:39 UTC (rev 18294) @@ -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 @@ 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 @@ 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); Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_texture.c =================================================================== --- branches/blender2.5/blender/source/blender/makesrna/intern/rna_texture.c 2009-01-03 18:43:11 UTC (rev 18293) +++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_texture.c 2009-01-03 19:39:39 UTC (rev 18294) @@ -71,6 +71,13 @@ {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 @@ 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) _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs