Blender  V2.59
rna_material.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_material.c 38092 2011-07-04 19:22:37Z jbakker $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation (2008), Nathan Letwory
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <float.h>
00031 #include <stdlib.h>
00032 
00033 #include "RNA_define.h"
00034 
00035 #include "rna_internal.h"
00036 
00037 #include "DNA_material_types.h"
00038 #include "DNA_texture_types.h"
00039 
00040 #include "WM_api.h"
00041 #include "WM_types.h"
00042 
00043 static EnumPropertyItem prop_texture_coordinates_items[] = {
00044 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"},
00045 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
00046 {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"},
00047 {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"},
00048 {TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Uses normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
00049 {TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates"},
00050 {TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates"},
00051 {TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates"},
00052 {TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates"},
00053 {TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh"},
00054 {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates"},
00055 {0, NULL, 0, NULL, NULL}};
00056 
00057 EnumPropertyItem ramp_blend_items[] = {
00058 {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
00059 {MA_RAMP_ADD, "ADD", 0, "Add", ""},
00060 {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
00061 {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
00062 {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
00063 {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
00064 {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
00065 {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
00066 {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
00067 {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
00068 {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""},
00069 {MA_RAMP_BURN, "BURN", 0, "Burn", ""},
00070 {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
00071 {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
00072 {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
00073 {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
00074 {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""}, 
00075 {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""}, 
00076 {0, NULL, 0, NULL, NULL}};
00077 
00078 #ifdef RNA_RUNTIME
00079 
00080 #include "MEM_guardedalloc.h"
00081 
00082 #include "DNA_node_types.h"
00083 
00084 #include "BKE_depsgraph.h"
00085 #include "BKE_main.h"
00086 #include "BKE_material.h"
00087 #include "BKE_texture.h"
00088 #include "BKE_node.h"
00089 
00090 #include "ED_node.h"
00091 
00092 static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00093 {
00094         Material *ma= ptr->id.data;
00095 
00096         DAG_id_tag_update(&ma->id, 0);
00097         if(scene->gm.matmode == GAME_MAT_GLSL)
00098                 WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
00099         else
00100                 WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
00101 }
00102 
00103 static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00104 {
00105         Material *ma= ptr->id.data;
00106 
00107         DAG_id_tag_update(&ma->id, 0);
00108         WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
00109 }
00110 
00111 static PointerRNA rna_Material_mirror_get(PointerRNA *ptr)
00112 {
00113         return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceMirror, ptr->id.data);
00114 }
00115 
00116 static PointerRNA rna_Material_transp_get(PointerRNA *ptr)
00117 {
00118         return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceTransparency, ptr->id.data);
00119 }
00120 
00121 static PointerRNA rna_Material_halo_get(PointerRNA *ptr)
00122 {
00123         return rna_pointer_inherit_refine(ptr, &RNA_MaterialHalo, ptr->id.data);
00124 }
00125 
00126 static PointerRNA rna_Material_sss_get(PointerRNA *ptr)
00127 {
00128         return rna_pointer_inherit_refine(ptr, &RNA_MaterialSubsurfaceScattering, ptr->id.data);
00129 }
00130 
00131 static PointerRNA rna_Material_strand_get(PointerRNA *ptr)
00132 {
00133         return rna_pointer_inherit_refine(ptr, &RNA_MaterialStrand, ptr->id.data);
00134 }
00135 
00136 static PointerRNA rna_Material_physics_get(PointerRNA *ptr)
00137 {
00138         return rna_pointer_inherit_refine(ptr, &RNA_MaterialPhysics, ptr->id.data);
00139 }
00140 
00141 static void rna_Material_type_set(PointerRNA *ptr, int value)
00142 {
00143         Material *ma= (Material*)ptr->data;
00144 
00145         if(ma->material_type == MA_TYPE_HALO && value != MA_TYPE_HALO)
00146                 ma->mode &= ~(MA_STAR|MA_HALO_XALPHA|MA_ZINV|MA_ENV);
00147 
00148         ma->material_type= value;
00149 }
00150 
00151 static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00152 {
00153         Material *ma= (Material*)ptr->data;
00154         rna_iterator_array_begin(iter, (void*)ma->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
00155 }
00156 
00157 static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr)
00158 {
00159         Material *ma= (Material*)ptr->data;
00160         Tex *tex;
00161 
00162         tex= give_current_material_texture(ma);
00163         return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
00164 }
00165 
00166 static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value)
00167 {
00168         Material *ma= (Material*)ptr->data;
00169 
00170         set_current_material_texture(ma, value.data);
00171 }
00172 
00173 static int rna_Material_active_texture_editable(PointerRNA *ptr)
00174 {
00175         Material *ma= (Material*)ptr->id.data;
00176 
00177         return has_current_material_texture(ma);
00178 }
00179 
00180 static PointerRNA rna_Material_active_node_material_get(PointerRNA *ptr)
00181 {
00182         Material *ma= give_node_material((Material*)ptr->data);
00183         return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
00184 }
00185 
00186 static void rna_Material_active_node_material_set(PointerRNA *ptr, PointerRNA value)
00187 {
00188         Material *ma= (Material*)ptr->data;
00189         Material *ma_act= value.data;
00190 
00191         nodeSetActiveID(ma->nodetree, ID_MA, &ma_act->id);
00192 }
00193 
00194 static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max)
00195 {
00196         Material *ma= (Material*)ptr->id.data;
00197 
00198         if(ma->mode & MA_STR_B_UNITS) {
00199                 *min= 0.0001f;
00200                 *max= 2.0f;
00201         }
00202         else {
00203                 *min= 0.25f;
00204                 *max= 20.0f;
00205         }
00206 }
00207 
00208 static void rna_MaterialStrand_end_size_range(PointerRNA *ptr, float *min, float *max)
00209 {
00210         Material *ma= (Material*)ptr->id.data;
00211 
00212         if(ma->mode & MA_STR_B_UNITS) {
00213                 *min= 0.0001f;
00214                 *max= 1.0f;
00215         }
00216         else {
00217                 *min= 0.25f;
00218                 *max= 10.0f;
00219         }
00220 }
00221 
00222 static int rna_MaterialTextureSlot_use_get(PointerRNA *ptr)
00223 {
00224         Material *ma= (Material*)ptr->id.data;
00225         MTex *mtex= (MTex*)ptr->data;
00226         int a;
00227 
00228         for(a=0; a<MAX_MTEX; a++)
00229                 if(ma->mtex[a] == mtex)
00230                         return (ma->septex & (1<<a)) == 0;
00231         
00232         return 0;
00233 }
00234 
00235 static void rna_MaterialTextureSlot_use_set(PointerRNA *ptr, int value)
00236 {
00237         Material *ma= (Material*)ptr->id.data;
00238         MTex *mtex= (MTex*)ptr->data;
00239         int a;
00240 
00241         for(a=0; a<MAX_MTEX; a++) {
00242                 if(ma->mtex[a] == mtex) {
00243                         if(value)
00244                                 ma->septex &= ~(1<<a);
00245                         else
00246                                 ma->septex |= (1<<a);
00247                 }
00248         }
00249 }
00250 
00251 static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value)
00252 {
00253         Material *ma= (Material*)ptr->data;
00254 
00255         if(value) ma->mode |= MA_RAMP_COL;
00256         else ma->mode &= ~MA_RAMP_COL;
00257 
00258         if((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
00259                 ma->ramp_col= add_colorband(0);
00260 }
00261 
00262 static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
00263 {
00264         Material *ma= (Material*)ptr->data;
00265 
00266         if(value) ma->mode |= MA_RAMP_SPEC;
00267         else ma->mode &= ~MA_RAMP_SPEC;
00268 
00269         if((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
00270                 ma->ramp_spec= add_colorband(0);
00271 }
00272 
00273 static void rna_Material_use_nodes_set(PointerRNA *ptr, int value)
00274 {
00275         Material *ma= (Material*)ptr->data;
00276 
00277         ma->use_nodes= value;
00278         if(ma->use_nodes && ma->nodetree==NULL)
00279                 ED_node_shader_default(ma);
00280 }
00281 
00282 static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
00283 {
00284         Material *ma= (Material*)ptr->id.data;
00285         EnumPropertyItem *item= NULL;
00286         int totitem= 0;
00287         
00288         RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_GLOB);
00289         RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_OBJECT);
00290         RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_ORCO);
00291         
00292         if(ma->material_type == MA_TYPE_VOLUME) {
00293                 
00294         }
00295         else if (ELEM3(ma->material_type, MA_TYPE_SURFACE, MA_TYPE_HALO, MA_TYPE_WIRE)) {
00296                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_UV);
00297                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STRAND);
00298                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STICKY);
00299                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_WINDOW);
00300                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_NORM);
00301                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_REFL);
00302                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STRESS);
00303                 RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_TANGENT);
00304         }
00305         
00306         RNA_enum_item_end(&item, &totitem);
00307         *free= 1;
00308         
00309         return item;
00310 }
00311 
00312 MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports)
00313 {
00314         MTex *mtex= add_mtex_id(self_id, -1);
00315         if (mtex == NULL) {
00316                 BKE_reportf(reports, RPT_ERROR, "maximum number of textures added %d", MAX_MTEX);
00317                 return NULL;
00318         }
00319 
00320         /* for redraw only */
00321         WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
00322 
00323         return mtex;
00324 }
00325 
00326 MTex *rna_mtex_texture_slots_create(ID *self_id, struct bContext *C, ReportList *reports, int index)
00327 {
00328         MTex *mtex;
00329 
00330         if(index < 0 || index >= MAX_MTEX) {
00331                 BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
00332                 return NULL;
00333         }
00334 
00335         mtex= add_mtex_id(self_id, index);
00336 
00337         /* for redraw only */
00338         WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
00339 
00340         return mtex;
00341 }
00342 
00343 void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *reports, int index)
00344 {
00345         MTex **mtex_ar;
00346         short act;
00347 
00348         give_active_mtex(self_id, &mtex_ar, &act);
00349 
00350         if (mtex_ar == NULL) {
00351                 BKE_report(reports, RPT_ERROR, "mtex not found for this type");
00352                 return;
00353         }
00354         
00355         if(index < 0 || index >= MAX_MTEX) {
00356                 BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
00357                 return;
00358         }
00359 
00360         if(mtex_ar[index]) {
00361                 id_us_min((ID *)mtex_ar[index]->tex);
00362                 MEM_freeN(mtex_ar[index]);
00363                 mtex_ar[index]= NULL;
00364         }
00365 
00366         /* for redraw only */
00367         WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
00368 }
00369 
00370 #else
00371 
00372 static void rna_def_material_mtex(BlenderRNA *brna)
00373 {
00374         StructRNA *srna;
00375         PropertyRNA *prop;
00376 
00377         static EnumPropertyItem prop_mapping_items[] = {
00378                 {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"},
00379                 {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"},
00380                 {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"},
00381                 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"},
00382                 {0, NULL, 0, NULL, NULL}};
00383                 
00384         static EnumPropertyItem prop_x_mapping_items[] = {
00385                 {0, "NONE", 0, "None", ""},
00386                 {1, "X", 0, "X", ""},
00387                 {2, "Y", 0, "Y", ""},
00388                 {3, "Z", 0, "Z", ""},
00389                 {0, NULL, 0, NULL, NULL}};
00390                 
00391         static EnumPropertyItem prop_y_mapping_items[] = {
00392                 {0, "NONE", 0, "None", ""},
00393                 {1, "X", 0, "X", ""},
00394                 {2, "Y", 0, "Y", ""},
00395                 {3, "Z", 0, "Z", ""},
00396                 {0, NULL, 0, NULL, NULL}};
00397                 
00398         static EnumPropertyItem prop_z_mapping_items[] = {
00399                 {0, "NONE", 0, "None", ""},
00400                 {1, "X", 0, "X", ""},
00401                 {2, "Y", 0, "Y", ""},
00402                 {3, "Z", 0, "Z", ""},
00403                 {0, NULL, 0, NULL, NULL}};
00404 
00405         static EnumPropertyItem prop_normal_map_space_items[] = {
00406                 {MTEX_NSPACE_CAMERA, "CAMERA", 0, "Camera", ""},
00407                 {MTEX_NSPACE_WORLD, "WORLD", 0, "World", ""},
00408                 {MTEX_NSPACE_OBJECT, "OBJECT", 0, "Object", ""},
00409                 {MTEX_NSPACE_TANGENT, "TANGENT", 0, "Tangent", ""},
00410                 {0, NULL, 0, NULL, NULL}};
00411 
00412         static EnumPropertyItem prop_bump_method_items[] = {
00413                 {0, "BUMP_ORIGINAL", 0, "Original", ""},
00414                 {MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
00415                 {MTEX_3TAP_BUMP, "BUMP_DEFAULT", 0, "Default", ""},
00416                 {MTEX_5TAP_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", ""},
00417                 {0, NULL, 0, NULL, NULL}};
00418 
00419         static EnumPropertyItem prop_bump_space_items[] = {
00420                 {0, "BUMP_VIEWSPACE", 0, "ViewSpace", ""},
00421                 {MTEX_BUMP_OBJECTSPACE, "BUMP_OBJECTSPACE", 0, "ObjectSpace", ""},
00422                 {MTEX_BUMP_TEXTURESPACE, "BUMP_TEXTURESPACE", 0, "TextureSpace", ""},
00423                 {0, NULL, 0, NULL, NULL}};
00424         
00425         srna= RNA_def_struct(brna, "MaterialTextureSlot", "TextureSlot");
00426         RNA_def_struct_sdna(srna, "MTex");
00427         RNA_def_struct_ui_text(srna, "Material Texture Slot", "Texture slot for textures in a Material datablock");
00428 
00429         prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
00430         RNA_def_property_enum_sdna(prop, NULL, "texco");
00431         RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
00432         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Material_texture_coordinates_itemf");
00433         RNA_def_property_ui_text(prop, "Texture Coordinates", "");
00434         RNA_def_property_update(prop, 0, "rna_Material_update");
00435         
00436         prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
00437         RNA_def_property_pointer_sdna(prop, NULL, "object");
00438         RNA_def_property_struct_type(prop, "Object");
00439         RNA_def_property_flag(prop, PROP_EDITABLE);
00440         RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
00441         RNA_def_property_update(prop, 0, "rna_Material_update");
00442 
00443         prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
00444         RNA_def_property_string_sdna(prop, NULL, "uvname");
00445         RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates");
00446         RNA_def_property_update(prop, 0, "rna_Material_update");
00447 
00448         prop= RNA_def_property(srna, "use_from_dupli", PROP_BOOLEAN, PROP_NONE);
00449         RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO);
00450         RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent");
00451         RNA_def_property_update(prop, 0, "rna_Material_update");
00452 
00453         prop= RNA_def_property(srna, "use_from_original", PROP_BOOLEAN, PROP_NONE);
00454         RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG);
00455         RNA_def_property_ui_text(prop, "From Original", "Dupli's derive their object coordinates from the original objects transformation");
00456         RNA_def_property_update(prop, 0, "rna_Material_update");
00457 
00458         prop= RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE);
00459         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL);
00460         RNA_def_property_ui_text(prop, "Diffuse Color", "Causes the texture to affect basic color of the material");
00461         RNA_def_property_update(prop, 0, "rna_Material_update");
00462         
00463         prop= RNA_def_property(srna, "use_map_normal", PROP_BOOLEAN, PROP_NONE);
00464         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_NORM);
00465         RNA_def_property_ui_text(prop, "Normal", "Causes the texture to affect the rendered normal");
00466         RNA_def_property_update(prop, 0, "rna_Material_update");
00467         
00468         prop= RNA_def_property(srna, "use_map_color_spec", PROP_BOOLEAN, PROP_NONE);
00469         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLSPEC);
00470         RNA_def_property_ui_text(prop, "Specular Color", "Causes the texture to affect the specularity color");
00471         RNA_def_property_update(prop, 0, "rna_Material_update");
00472         
00473         prop= RNA_def_property(srna, "use_map_mirror", PROP_BOOLEAN, PROP_NONE);
00474         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLMIR);
00475         RNA_def_property_ui_text(prop, "Mirror", "Causes the texture to affect the mirror color");
00476         RNA_def_property_update(prop, 0, "rna_Material_update");
00477         
00478         prop= RNA_def_property(srna, "use_map_diffuse", PROP_BOOLEAN, PROP_NONE);
00479         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REF);
00480         RNA_def_property_ui_text(prop, "Diffuse", "Causes the texture to affect the value of the materials diffuse reflectivity");
00481         RNA_def_property_update(prop, 0, "rna_Material_update");
00482         
00483         prop= RNA_def_property(srna, "use_map_specular", PROP_BOOLEAN, PROP_NONE);
00484         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SPEC);
00485         RNA_def_property_ui_text(prop, "Specular", "Causes the texture to affect the value of specular reflectivity");
00486         RNA_def_property_update(prop, 0, "rna_Material_update");
00487         
00488         prop= RNA_def_property(srna, "use_map_ambient", PROP_BOOLEAN, PROP_NONE);
00489         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_AMB);
00490         RNA_def_property_ui_text(prop, "Ambient", "Causes the texture to affect the value of ambient");
00491         RNA_def_property_update(prop, 0, "rna_Material_update");
00492         
00493         prop= RNA_def_property(srna, "use_map_hardness", PROP_BOOLEAN, PROP_NONE);
00494         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_HAR);
00495         RNA_def_property_ui_text(prop, "Hardness", "Causes the texture to affect the hardness value");
00496         RNA_def_property_update(prop, 0, "rna_Material_update");
00497         
00498         prop= RNA_def_property(srna, "use_map_raymir", PROP_BOOLEAN, PROP_NONE);
00499         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_RAYMIRR);
00500         RNA_def_property_ui_text(prop, "Ray-Mirror", "Causes the texture to affect the ray-mirror value");
00501         RNA_def_property_update(prop, 0, "rna_Material_update");
00502         
00503         prop= RNA_def_property(srna, "use_map_alpha", PROP_BOOLEAN, PROP_NONE);
00504         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA);
00505         RNA_def_property_ui_text(prop, "Alpha", "Causes the texture to affect the alpha value");
00506         RNA_def_property_update(prop, 0, "rna_Material_update");
00507         
00508         prop= RNA_def_property(srna, "use_map_emit", PROP_BOOLEAN, PROP_NONE);
00509         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMIT);
00510         RNA_def_property_ui_text(prop, "Emit", "Causes the texture to affect the emit value");
00511         RNA_def_property_update(prop, 0, "rna_Material_update");
00512         
00513         prop= RNA_def_property(srna, "use_map_translucency", PROP_BOOLEAN, PROP_NONE);
00514         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSLU);
00515         RNA_def_property_ui_text(prop, "Translucency", "Causes the texture to affect the translucency value");
00516         RNA_def_property_update(prop, 0, "rna_Material_update");
00517         
00518         prop= RNA_def_property(srna, "use_map_displacement", PROP_BOOLEAN, PROP_NONE);
00519         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DISPLACE);
00520         RNA_def_property_ui_text(prop, "Displacement", "Let the texture displace the surface");
00521         RNA_def_property_update(prop, 0, "rna_Material_update");
00522         
00523         prop= RNA_def_property(srna, "use_map_warp", PROP_BOOLEAN, PROP_NONE);
00524         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_WARP);
00525         RNA_def_property_ui_text(prop, "Warp", "Let the texture warp texture coordinates of next channels");
00526         RNA_def_property_update(prop, 0, "rna_Material_update");
00527 
00528         prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
00529         RNA_def_property_enum_sdna(prop, NULL, "projx");
00530         RNA_def_property_enum_items(prop, prop_x_mapping_items);
00531         RNA_def_property_ui_text(prop, "X Mapping", "");
00532         RNA_def_property_update(prop, 0, "rna_Material_update");
00533         
00534         prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
00535         RNA_def_property_enum_sdna(prop, NULL, "projy");
00536         RNA_def_property_enum_items(prop, prop_y_mapping_items);
00537         RNA_def_property_ui_text(prop, "Y Mapping", "");
00538         RNA_def_property_update(prop, 0, "rna_Material_update");
00539         
00540         prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
00541         RNA_def_property_enum_sdna(prop, NULL, "projz");
00542         RNA_def_property_enum_items(prop, prop_z_mapping_items);
00543         RNA_def_property_ui_text(prop, "Z Mapping", "");
00544         RNA_def_property_update(prop, 0, "rna_Material_update");
00545 
00546         prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
00547         RNA_def_property_enum_items(prop, prop_mapping_items);
00548         RNA_def_property_ui_text(prop, "Mapping", "");
00549         RNA_def_property_update(prop, 0, "rna_Material_update");
00550 
00551         prop= RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE);
00552         RNA_def_property_enum_sdna(prop, NULL, "normapspace");
00553         RNA_def_property_enum_items(prop, prop_normal_map_space_items);
00554         RNA_def_property_ui_text(prop, "Normal Map Space", "Sets space of normal map image");
00555         RNA_def_property_update(prop, 0, "rna_Material_update");
00556 
00557         prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
00558         RNA_def_property_float_sdna(prop, NULL, "norfac");
00559         RNA_def_property_ui_range(prop, -5, 5, 10, 3);
00560         RNA_def_property_ui_text(prop, "Normal Factor", "Amount texture affects normal values");
00561         RNA_def_property_update(prop, 0, "rna_Material_update");
00562 
00563         prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE);
00564         RNA_def_property_float_sdna(prop, NULL, "dispfac");
00565         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00566         RNA_def_property_ui_text(prop, "Displacement Factor", "Amount texture displaces the surface");
00567         RNA_def_property_update(prop, 0, "rna_Material_update");
00568 
00569         prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_NONE);
00570         RNA_def_property_float_sdna(prop, NULL, "warpfac");
00571         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00572         RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects texture coordinates of next channels");
00573         RNA_def_property_update(prop, 0, "rna_Material_update");
00574 
00575         prop= RNA_def_property(srna, "specular_color_factor", PROP_FLOAT, PROP_NONE);
00576         RNA_def_property_float_sdna(prop, NULL, "colspecfac");
00577         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00578         RNA_def_property_ui_text(prop, "Specular Color Factor", "Amount texture affects specular color");
00579         RNA_def_property_update(prop, 0, "rna_Material_update");
00580 
00581         prop= RNA_def_property(srna, "diffuse_color_factor", PROP_FLOAT, PROP_NONE);
00582         RNA_def_property_float_sdna(prop, NULL, "colfac");
00583         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00584         RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color");
00585         RNA_def_property_update(prop, 0, "rna_Material_update");
00586 
00587         prop= RNA_def_property(srna, "mirror_factor", PROP_FLOAT, PROP_NONE);
00588         RNA_def_property_float_sdna(prop, NULL, "mirrfac");
00589         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00590         RNA_def_property_ui_text(prop, "Mirror Factor", "Amount texture affects mirror color");
00591         RNA_def_property_update(prop, 0, "rna_Material_update");
00592 
00593         prop= RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
00594         RNA_def_property_float_sdna(prop, NULL, "alphafac");
00595         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00596         RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha");
00597         RNA_def_property_update(prop, 0, "rna_Material_update");
00598 
00599         prop= RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE);
00600         RNA_def_property_float_sdna(prop, NULL, "difffac");
00601         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00602         RNA_def_property_ui_text(prop, "Diffuse Factor", "Amount texture affects diffuse reflectivity");
00603         RNA_def_property_update(prop, 0, "rna_Material_update");
00604 
00605         prop= RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE);
00606         RNA_def_property_float_sdna(prop, NULL, "specfac");
00607         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00608         RNA_def_property_ui_text(prop, "Specular Factor", "Amount texture affects specular reflectivity");
00609         RNA_def_property_update(prop, 0, "rna_Material_update");
00610 
00611         prop= RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE);
00612         RNA_def_property_float_sdna(prop, NULL, "emitfac");
00613         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00614         RNA_def_property_ui_text(prop, "Emit Factor", "Amount texture affects emission");
00615         RNA_def_property_update(prop, 0, "rna_Material_update");
00616 
00617         prop= RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE);
00618         RNA_def_property_float_sdna(prop, NULL, "hardfac");
00619         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00620         RNA_def_property_ui_text(prop, "Hardness Factor", "Amount texture affects hardness");
00621         RNA_def_property_update(prop, 0, "rna_Material_update");
00622 
00623         prop= RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE);
00624         RNA_def_property_float_sdna(prop, NULL, "raymirrfac");
00625         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00626         RNA_def_property_ui_text(prop, "Ray Mirror Factor", "Amount texture affects ray mirror");
00627         RNA_def_property_update(prop, 0, "rna_Material_update");
00628 
00629         prop= RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE);
00630         RNA_def_property_float_sdna(prop, NULL, "translfac");
00631         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00632         RNA_def_property_ui_text(prop, "Translucency Factor", "Amount texture affects translucency");
00633         RNA_def_property_update(prop, 0, "rna_Material_update");
00634 
00635         prop= RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE);
00636         RNA_def_property_float_sdna(prop, NULL, "ambfac");
00637         RNA_def_property_ui_range(prop, -1, 1, 10, 3);
00638         RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient");
00639         RNA_def_property_update(prop, 0, "rna_Material_update");
00640 
00641         /* volume material */
00642         prop= RNA_def_property(srna, "use_map_color_emission", PROP_BOOLEAN, PROP_NONE);
00643         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMISSION_COL);
00644         RNA_def_property_ui_text(prop, "Emission Color", "Causes the texture to affect the color of emission");
00645         RNA_def_property_update(prop, 0, "rna_Material_update");
00646         
00647         prop= RNA_def_property(srna, "use_map_color_reflection", PROP_BOOLEAN, PROP_NONE);
00648         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REFLECTION_COL);
00649         RNA_def_property_ui_text(prop, "Reflection Color", "Causes the texture to affect the color of scattered light");
00650         RNA_def_property_update(prop, 0, "rna_Material_update");
00651         
00652         prop= RNA_def_property(srna, "use_map_color_transmission", PROP_BOOLEAN, PROP_NONE);
00653         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSMISSION_COL);
00654         RNA_def_property_ui_text(prop, "Transmission Color", "Causes the texture to affect the result color after other light has been scattered/absorbed");
00655         RNA_def_property_update(prop, NC_TEXTURE, NULL);
00656         
00657         prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
00658         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DENSITY);
00659         RNA_def_property_ui_text(prop, "Density", "Causes the texture to affect the volume's density");
00660         RNA_def_property_update(prop, 0, "rna_Material_update");
00661         
00662         prop= RNA_def_property(srna, "use_map_emission", PROP_BOOLEAN, PROP_NONE);
00663         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMISSION);
00664         RNA_def_property_ui_text(prop, "Emission", "Causes the texture to affect the volume's emission");
00665         RNA_def_property_update(prop, 0, "rna_Material_update");
00666         
00667         prop= RNA_def_property(srna, "use_map_scatter", PROP_BOOLEAN, PROP_NONE);
00668         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SCATTERING);
00669         RNA_def_property_ui_text(prop, "Scattering", "Causes the texture to affect the volume's scattering");
00670         RNA_def_property_update(prop, 0, "rna_Material_update");
00671         
00672         prop= RNA_def_property(srna, "use_map_reflect", PROP_BOOLEAN, PROP_NONE);
00673         RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REFLECTION);
00674         RNA_def_property_ui_text(prop, "Reflection", "Causes the texture to affect the reflected light's brightness");
00675         RNA_def_property_update(prop, NC_TEXTURE, NULL);
00676         
00677         prop= RNA_def_property(srna, "emission_color_factor", PROP_FLOAT, PROP_NONE);
00678         RNA_def_property_float_sdna(prop, NULL, "colemitfac");
00679         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00680         RNA_def_property_ui_text(prop, "Emission Color Factor", "Amount texture affects emission color");
00681         RNA_def_property_update(prop, 0, "rna_Material_update");
00682         
00683         prop= RNA_def_property(srna, "reflection_color_factor", PROP_FLOAT, PROP_NONE);
00684         RNA_def_property_float_sdna(prop, NULL, "colreflfac");
00685         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00686         RNA_def_property_ui_text(prop, "Reflection Color Factor", "Amount texture affects color of out-scattered light");
00687         RNA_def_property_update(prop, 0, "rna_Material_update");
00688         
00689         prop= RNA_def_property(srna, "transmission_color_factor", PROP_FLOAT, PROP_NONE);
00690         RNA_def_property_float_sdna(prop, NULL, "coltransfac");
00691         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00692         RNA_def_property_ui_text(prop, "Transmission Color Factor", "Amount texture affects result color after light has been scattered/absorbed");
00693         RNA_def_property_update(prop, NC_TEXTURE, NULL);
00694         
00695         prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
00696         RNA_def_property_float_sdna(prop, NULL, "densfac");
00697         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00698         RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects density");
00699         RNA_def_property_update(prop, 0, "rna_Material_update");
00700         
00701         prop= RNA_def_property(srna, "emission_factor", PROP_FLOAT, PROP_NONE);
00702         RNA_def_property_float_sdna(prop, NULL, "emitfac");
00703         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00704         RNA_def_property_ui_text(prop, "Emission Factor", "Amount texture affects emission");
00705         RNA_def_property_update(prop, 0, "rna_Material_update");
00706         
00707         prop= RNA_def_property(srna, "scattering_factor", PROP_FLOAT, PROP_NONE);
00708         RNA_def_property_float_sdna(prop, NULL, "scatterfac");
00709         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00710         RNA_def_property_ui_text(prop, "Scattering Factor", "Amount texture affects scattering");
00711         RNA_def_property_update(prop, 0, "rna_Material_update");
00712                                                                   
00713         prop= RNA_def_property(srna, "reflection_factor", PROP_FLOAT, PROP_NONE);
00714         RNA_def_property_float_sdna(prop, NULL, "reflfac");
00715         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
00716         RNA_def_property_ui_text(prop, "Reflection Factor", "Amount texture affects brightness of out-scattered light");
00717         RNA_def_property_update(prop, 0, "rna_Material_update");
00718         
00719         /* end volume material */
00720         
00721         prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
00722         RNA_def_property_boolean_funcs(prop, "rna_MaterialTextureSlot_use_get", "rna_MaterialTextureSlot_use_set");
00723         RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot");
00724         RNA_def_property_update(prop, 0, "rna_Material_update");
00725 
00726         prop= RNA_def_property(srna, "bump_method", PROP_ENUM, PROP_NONE);
00727         RNA_def_property_enum_bitflag_sdna(prop, NULL, "texflag");
00728         RNA_def_property_enum_items(prop, prop_bump_method_items);
00729         RNA_def_property_ui_text(prop, "Bump Method", "Method to use for bump mapping");
00730         RNA_def_property_update(prop, 0, "rna_Material_update");
00731         
00732         prop= RNA_def_property(srna, "bump_objectspace", PROP_ENUM, PROP_NONE);
00733         RNA_def_property_enum_bitflag_sdna(prop, NULL, "texflag");
00734         RNA_def_property_enum_items(prop, prop_bump_space_items);
00735         RNA_def_property_ui_text(prop, "Bump Space", "Space to apply bump mapping in");
00736         RNA_def_property_update(prop, 0, "rna_Material_update");
00737 }
00738 
00739 static void rna_def_material_colors(StructRNA *srna)
00740 {
00741         PropertyRNA *prop;
00742 
00743         static EnumPropertyItem prop_ramp_input_items[] = {
00744                 {MA_RAMP_IN_SHADER, "SHADER", 0, "Shader", ""},
00745                 {MA_RAMP_IN_ENERGY, "ENERGY", 0, "Energy", ""},
00746                 {MA_RAMP_IN_NOR, "NORMAL", 0, "Normal", ""},
00747                 {MA_RAMP_IN_RESULT, "RESULT", 0, "Result", ""},
00748                 {0, NULL, 0, NULL, NULL}};
00749 
00750         prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
00751         RNA_def_property_float_sdna(prop, NULL, "r");
00752         RNA_def_property_array(prop, 3);
00753         RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
00754         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
00755         
00756         prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
00757         RNA_def_property_float_sdna(prop, NULL, "specr");
00758         RNA_def_property_array(prop, 3);
00759         RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
00760         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
00761         
00762         prop= RNA_def_property(srna, "mirror_color", PROP_FLOAT, PROP_COLOR);
00763         RNA_def_property_float_sdna(prop, NULL, "mirr");
00764         RNA_def_property_array(prop, 3);
00765         RNA_def_property_ui_text(prop, "Mirror Color", "Mirror color of the material");
00766         RNA_def_property_update(prop, 0, "rna_Material_update");
00767         
00768         prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
00769         RNA_def_property_range(prop, 0.0f, 1.0f);
00770         RNA_def_property_ui_text(prop, "Alpha", "Alpha transparency of the material");
00771         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
00772 
00773         prop= RNA_def_property(srna, "specular_alpha", PROP_FLOAT, PROP_FACTOR);
00774         RNA_def_property_float_sdna(prop, NULL, "spectra");
00775         RNA_def_property_range(prop, 0.0f, 1.0f);
00776         RNA_def_property_ui_text(prop, "Specular Alpha", "Alpha transparency for specular areas");
00777         RNA_def_property_update(prop, 0, "rna_Material_update");
00778         
00779         /* Color bands */
00780         prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE);
00781         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_COL);
00782         RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_diffuse_ramp_set");
00783         RNA_def_property_ui_text(prop, "Use Diffuse Ramp", "Toggle diffuse ramp operations");
00784         RNA_def_property_update(prop, 0, "rna_Material_update");
00785 
00786         prop= RNA_def_property(srna, "diffuse_ramp", PROP_POINTER, PROP_NONE);
00787         RNA_def_property_pointer_sdna(prop, NULL, "ramp_col");
00788         RNA_def_property_struct_type(prop, "ColorRamp");
00789         RNA_def_property_ui_text(prop, "Diffuse Ramp", "Color ramp used to affect diffuse shading");
00790         RNA_def_property_update(prop, 0, "rna_Material_update");
00791 
00792         prop= RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE);
00793         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_SPEC);
00794         RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_specular_ramp_set");
00795         RNA_def_property_ui_text(prop, "Use Specular Ramp", "Toggle specular ramp operations");
00796         RNA_def_property_update(prop, 0, "rna_Material_update");
00797 
00798         prop= RNA_def_property(srna, "specular_ramp", PROP_POINTER, PROP_NONE);
00799         RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec");
00800         RNA_def_property_struct_type(prop, "ColorRamp");
00801         RNA_def_property_ui_text(prop, "Specular Ramp", "Color ramp used to affect specular shading");
00802         RNA_def_property_update(prop, 0, "rna_Material_update");
00803         
00804         prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE);
00805         RNA_def_property_enum_sdna(prop, NULL, "rampblend_col");
00806         RNA_def_property_enum_items(prop, ramp_blend_items);
00807         RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the diffuse color");
00808         RNA_def_property_update(prop, 0, "rna_Material_update");
00809         
00810         prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE);
00811         RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec");
00812         RNA_def_property_enum_items(prop, ramp_blend_items);
00813         RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the specular color");
00814         RNA_def_property_update(prop, 0, "rna_Material_update");
00815 
00816         prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE);
00817         RNA_def_property_enum_sdna(prop, NULL, "rampin_col");
00818         RNA_def_property_enum_items(prop, prop_ramp_input_items);
00819         RNA_def_property_ui_text(prop, "Diffuse Ramp Input", "Determines how the ramp maps on the surface");
00820         RNA_def_property_update(prop, 0, "rna_Material_update");
00821         
00822         prop= RNA_def_property(srna, "specular_ramp_input", PROP_ENUM, PROP_NONE);
00823         RNA_def_property_enum_sdna(prop, NULL, "rampin_spec");
00824         RNA_def_property_enum_items(prop, prop_ramp_input_items);
00825         RNA_def_property_ui_text(prop, "Specular Ramp Input", "Determines how the ramp maps on the surface");
00826         RNA_def_property_update(prop, 0, "rna_Material_update");
00827 
00828         prop= RNA_def_property(srna, "diffuse_ramp_factor", PROP_FLOAT, PROP_FACTOR);
00829         RNA_def_property_float_sdna(prop, NULL, "rampfac_col");
00830         RNA_def_property_range(prop, 0.0f, 1.0f);
00831         RNA_def_property_ui_text(prop, "Diffuse Ramp Factor", "Blending factor (also uses alpha in Colorband)");
00832         RNA_def_property_update(prop, 0, "rna_Material_update");
00833 
00834         prop= RNA_def_property(srna, "specular_ramp_factor", PROP_FLOAT, PROP_FACTOR);
00835         RNA_def_property_float_sdna(prop, NULL, "rampfac_spec");
00836         RNA_def_property_range(prop, 0.0f, 1.0f);
00837         RNA_def_property_ui_text(prop, "Specular Ramp Factor", "Blending factor (also uses alpha in Colorband)");
00838         RNA_def_property_update(prop, 0, "rna_Material_update");
00839 }
00840 
00841 static void rna_def_material_diffuse(StructRNA *srna)
00842 {
00843         PropertyRNA *prop;
00844 
00845         static EnumPropertyItem prop_diff_shader_items[] = {
00846                 {MA_DIFF_LAMBERT, "LAMBERT", 0, "Lambert", "Use a Lambertian shader"},
00847                 {MA_DIFF_ORENNAYAR, "OREN_NAYAR", 0, "Oren-Nayar", "Use an Oren-Nayar shader"},
00848                 {MA_DIFF_TOON, "TOON", 0, "Toon", "Use a toon shader"},
00849                 {MA_DIFF_MINNAERT, "MINNAERT", 0, "Minnaert", "Use a Minnaert shader"},
00850                 {MA_DIFF_FRESNEL, "FRESNEL", 0, "Fresnel", "Use a Fresnel shader"},
00851                 {0, NULL, 0, NULL, NULL}};
00852         
00853         prop= RNA_def_property(srna, "diffuse_shader", PROP_ENUM, PROP_NONE);
00854         RNA_def_property_enum_sdna(prop, NULL, "diff_shader");
00855         RNA_def_property_enum_items(prop, prop_diff_shader_items);
00856         RNA_def_property_ui_text(prop, "Diffuse Shader Model", "");
00857         RNA_def_property_update(prop, 0, "rna_Material_update");
00858         
00859         prop= RNA_def_property(srna, "diffuse_intensity", PROP_FLOAT, PROP_FACTOR);
00860         RNA_def_property_float_sdna(prop, NULL, "ref");
00861         RNA_def_property_range(prop, 0.0f, 1.0f);
00862         RNA_def_property_ui_text(prop, "Diffuse Intensity", "Amount of diffuse reflection");
00863         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
00864         
00865         prop= RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_NONE);
00866         RNA_def_property_range(prop, 0.0f, 3.14f);
00867         RNA_def_property_ui_text(prop, "Roughness", "Oren-Nayar Roughness");
00868         RNA_def_property_update(prop, 0, "rna_Material_update");
00869 
00870         prop= RNA_def_property(srna, "diffuse_toon_size", PROP_FLOAT, PROP_NONE);
00871         RNA_def_property_float_sdna(prop, NULL, "param[0]");
00872         RNA_def_property_range(prop, 0.0f, 3.14f);
00873         RNA_def_property_ui_text(prop, "Diffuse Toon Size", "Size of diffuse toon area");
00874         RNA_def_property_update(prop, 0, "rna_Material_update");
00875 
00876         prop= RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_FACTOR);
00877         RNA_def_property_float_sdna(prop, NULL, "param[1]");
00878         RNA_def_property_range(prop, 0.0f, 1.0f);
00879         RNA_def_property_ui_text(prop, "Diffuse Toon Smooth", "Smoothness of diffuse toon area");
00880         RNA_def_property_update(prop, 0, "rna_Material_update");
00881 
00882         prop= RNA_def_property(srna, "diffuse_fresnel", PROP_FLOAT, PROP_NONE);
00883         RNA_def_property_float_sdna(prop, NULL, "param[1]");
00884         RNA_def_property_range(prop, 0.0f, 5.0f);
00885         RNA_def_property_ui_text(prop, "Diffuse Fresnel", "Power of Fresnel");
00886         RNA_def_property_update(prop, 0, "rna_Material_update");
00887 
00888         prop= RNA_def_property(srna, "diffuse_fresnel_factor", PROP_FLOAT, PROP_NONE);
00889         RNA_def_property_float_sdna(prop, NULL, "param[0]");
00890         RNA_def_property_range(prop, 0.0f, 5.0f);
00891         RNA_def_property_ui_text(prop, "Diffuse Fresnel Factor", "Blending factor of Fresnel");
00892         RNA_def_property_update(prop, 0, "rna_Material_update");
00893         
00894         prop= RNA_def_property(srna, "darkness", PROP_FLOAT, PROP_NONE);
00895         RNA_def_property_range(prop, 0.0f, 2.0f);
00896         RNA_def_property_ui_text(prop, "Darkness", "Minnaert darkness");
00897         RNA_def_property_update(prop, 0, "rna_Material_update");
00898 }
00899 
00900 static void rna_def_material_raymirror(BlenderRNA *brna)
00901 {
00902         StructRNA *srna;
00903         PropertyRNA *prop;
00904 
00905         static EnumPropertyItem prop_fadeto_mir_items[] = {
00906                 {MA_RAYMIR_FADETOSKY, "FADE_TO_SKY", 0, "Sky", ""},
00907                 {MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Material", ""},
00908                 {0, NULL, 0, NULL, NULL}};
00909 
00910         srna= RNA_def_struct(brna, "MaterialRaytraceMirror", NULL);
00911         RNA_def_struct_sdna(srna, "Material");
00912         RNA_def_struct_nested(brna, srna, "Material");
00913         RNA_def_struct_ui_text(srna, "Material Raytrace Mirror", "Raytraced reflection settings for a Material datablock");
00914 
00915         prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
00916         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYMIRROR); /* use bitflags */
00917         RNA_def_property_ui_text(prop, "Enabled", "Enable raytraced reflections");
00918         RNA_def_property_update(prop, 0, "rna_Material_update");
00919                 
00920         prop= RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_FACTOR);
00921         RNA_def_property_float_sdna(prop, NULL, "ray_mirror");
00922         RNA_def_property_range(prop, 0.0f, 1.0f);
00923         RNA_def_property_ui_text(prop, "Reflectivity", "Sets the amount mirror reflection for raytrace");
00924         RNA_def_property_update(prop, 0, "rna_Material_update");
00925         
00926         prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
00927         RNA_def_property_float_sdna(prop, NULL, "fresnel_mir");
00928         RNA_def_property_range(prop, 0.0f, 5.0f);
00929         RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for mirror reflection");
00930         RNA_def_property_update(prop, 0, "rna_Material_update");
00931         
00932         prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_FACTOR);
00933         RNA_def_property_float_sdna(prop, NULL, "fresnel_mir_i");
00934         RNA_def_property_range(prop, 0.0f, 5.0f);
00935         RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel");
00936         RNA_def_property_update(prop, 0, "rna_Material_update");
00937         
00938         prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_FACTOR);
00939         RNA_def_property_float_sdna(prop, NULL, "gloss_mir");
00940         RNA_def_property_range(prop, 0.0f, 1.0f);
00941         RNA_def_property_ui_text(prop, "Gloss Amount", "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections");
00942         RNA_def_property_update(prop, 0, "rna_Material_update");
00943         
00944         prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_FACTOR);
00945         RNA_def_property_float_sdna(prop, NULL, "aniso_gloss_mir");
00946         RNA_def_property_range(prop, 0.0f, 1.0f);
00947         RNA_def_property_ui_text(prop, "Gloss Anisotropy", "The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent");
00948         RNA_def_property_update(prop, 0, "rna_Material_update");
00949                 
00950         prop= RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
00951         RNA_def_property_int_sdna(prop, NULL, "samp_gloss_mir");
00952         RNA_def_property_range(prop, 0, 1024);
00953         RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry reflections");
00954         RNA_def_property_update(prop, 0, "rna_Material_update");
00955         
00956         prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_FACTOR);
00957         RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_mir");
00958         RNA_def_property_range(prop, 0.0f, 1.0f);
00959         RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
00960         RNA_def_property_update(prop, 0, "rna_Material_update");
00961         
00962         prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
00963         RNA_def_property_int_sdna(prop, NULL, "ray_depth");
00964         RNA_def_property_ui_range(prop, 0, 100, 1, 3);
00965         RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-reflections");
00966         RNA_def_property_update(prop, 0, "rna_Material_update");
00967         
00968         prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
00969         RNA_def_property_float_sdna(prop, NULL, "dist_mir");
00970         RNA_def_property_range(prop, 0.0f, 10000.0f);
00971         RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance of reflected rays. Reflections further than this range fade to sky color or material color");
00972         RNA_def_property_update(prop, 0, "rna_Material_update");
00973         
00974         prop= RNA_def_property(srna, "fade_to", PROP_ENUM, PROP_NONE);
00975         RNA_def_property_enum_sdna(prop, NULL, "fadeto_mir");
00976         RNA_def_property_enum_items(prop, prop_fadeto_mir_items);
00977         RNA_def_property_ui_text(prop, "Fade-out Color", "The color that rays with no intersection within the Max Distance take. Material color can be best for indoor scenes, sky color for outdoor");
00978         RNA_def_property_update(prop, 0, "rna_Material_update");
00979 }
00980 
00981 static void rna_def_material_raytra(BlenderRNA *brna)
00982 {
00983         StructRNA *srna;
00984         PropertyRNA *prop;
00985 
00986         srna= RNA_def_struct(brna, "MaterialRaytraceTransparency", NULL);
00987         RNA_def_struct_sdna(srna, "Material");
00988         RNA_def_struct_nested(brna, srna, "Material");
00989         RNA_def_struct_ui_text(srna, "Material Raytrace Transparency", "Raytraced refraction settings for a Material datablock");
00990 
00991         prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
00992         RNA_def_property_float_sdna(prop, NULL, "ang");
00993         RNA_def_property_range(prop, 0.25f, 4.0f);
00994         RNA_def_property_ui_text(prop, "IOR", "Sets angular index of refraction for raytraced refraction");
00995         RNA_def_property_update(prop, 0, "rna_Material_update");
00996         
00997         prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
00998         RNA_def_property_float_sdna(prop, NULL, "fresnel_tra");
00999         RNA_def_property_range(prop, 0.0f, 5.0f);
01000         RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for transparency (Ray or ZTransp)");
01001         RNA_def_property_update(prop, 0, "rna_Material_update");
01002         
01003         prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_FACTOR);
01004         RNA_def_property_float_sdna(prop, NULL, "fresnel_tra_i");
01005         RNA_def_property_range(prop, 1.0f, 5.0f);
01006         RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel");
01007         RNA_def_property_update(prop, 0, "rna_Material_update");
01008         
01009         prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_FACTOR);
01010         RNA_def_property_float_sdna(prop, NULL, "gloss_tra");
01011         RNA_def_property_range(prop, 0.0f, 1.0f);
01012         RNA_def_property_ui_text(prop, "Gloss Amount", "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions");
01013         RNA_def_property_update(prop, 0, "rna_Material_update");
01014         
01015         prop= RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
01016         RNA_def_property_int_sdna(prop, NULL, "samp_gloss_tra");
01017         RNA_def_property_range(prop, 0, 1024);
01018         RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry refractions");
01019         RNA_def_property_update(prop, 0, "rna_Material_update");
01020         
01021         prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_FACTOR);
01022         RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_tra");
01023         RNA_def_property_range(prop, 0.0f, 1.0f);
01024         RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
01025         RNA_def_property_update(prop, 0, "rna_Material_update");
01026         
01027         prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
01028         RNA_def_property_int_sdna(prop, NULL, "ray_depth_tra");
01029         RNA_def_property_ui_range(prop, 0, 100, 1, 3);
01030         RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-refractions");
01031         RNA_def_property_update(prop, 0, "rna_Material_update");
01032         
01033         prop= RNA_def_property(srna, "filter", PROP_FLOAT, PROP_FACTOR);
01034         RNA_def_property_float_sdna(prop, NULL, "filter");
01035         RNA_def_property_range(prop, 0.0f, 1.0f);
01036         RNA_def_property_ui_text(prop, "Filter", "Amount to blend in the material's diffuse color in raytraced transparency (simulating absorption)");
01037         RNA_def_property_update(prop, 0, "rna_Material_update");
01038         
01039         prop= RNA_def_property(srna, "depth_max", PROP_FLOAT, PROP_DISTANCE);
01040         RNA_def_property_float_sdna(prop, NULL, "tx_limit");
01041         RNA_def_property_range(prop, 0.0f, 100.0f);
01042         RNA_def_property_ui_text(prop, "Limit", "Maximum depth for light to travel through the transparent material before becoming fully filtered (0.0 is disabled)");
01043         RNA_def_property_update(prop, 0, "rna_Material_update");
01044         
01045         prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
01046         RNA_def_property_float_sdna(prop, NULL, "tx_falloff");
01047         RNA_def_property_range(prop, 0.1f, 10.0f);
01048         RNA_def_property_ui_text(prop, "Falloff", "Falloff power for transmissivity filter effect (1.0 is linear)");
01049         RNA_def_property_update(prop, 0, "rna_Material_update");
01050 }
01051 
01052 static void rna_def_material_volume(BlenderRNA *brna)
01053 {
01054         StructRNA *srna;
01055         PropertyRNA *prop;
01056 
01057         static EnumPropertyItem prop_lighting_items[] = {
01058                 {MA_VOL_SHADE_SHADELESS, "SHADELESS", 0, "Shadeless", "Do not calculate lighting and shadows"},
01059                 {MA_VOL_SHADE_SHADOWED, "SHADOWED", 0, "Shadowed", ""},
01060                 {MA_VOL_SHADE_SHADED, "SHADED", 0, "Shaded", ""},
01061                 {MA_VOL_SHADE_MULTIPLE, "MULTIPLE_SCATTERING", 0, "Multiple Scattering", ""},
01062                 {MA_VOL_SHADE_SHADEDPLUSMULTIPLE, "SHADED_PLUS_MULTIPLE_SCATTERING", 0, "Shaded + Multiple Scattering", ""},
01063                 {0, NULL, 0, NULL, NULL}};
01064 
01065         static EnumPropertyItem prop_stepsize_items[] = {
01066                 {MA_VOL_STEP_RANDOMIZED, "RANDOMIZED", 0, "Randomized", ""},
01067                 {MA_VOL_STEP_CONSTANT, "CONSTANT", 0, "Constant", ""},
01068                 //{MA_VOL_STEP_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", ""},
01069                 {0, NULL, 0, NULL, NULL}};
01070                 
01071         srna= RNA_def_struct(brna, "MaterialVolume", NULL);
01072         RNA_def_struct_sdna(srna, "VolumeSettings");
01073         RNA_def_struct_nested(brna, srna, "Material");
01074         RNA_def_struct_ui_text(srna, "Material Volume", "Volume rendering settings for a Material datablock");
01075         
01076         prop= RNA_def_property(srna, "step_method", PROP_ENUM, PROP_NONE);
01077         RNA_def_property_enum_sdna(prop, NULL, "stepsize_type");
01078         RNA_def_property_enum_items(prop, prop_stepsize_items);
01079         RNA_def_property_ui_text(prop, "Step Calculation", "Method of calculating the steps through the volume");
01080         RNA_def_property_update(prop, 0, "rna_Material_update");
01081         
01082         prop= RNA_def_property(srna, "step_size", PROP_FLOAT, PROP_NONE);
01083         RNA_def_property_float_sdna(prop, NULL, "stepsize");
01084         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01085         RNA_def_property_ui_range(prop, 0.001f, 1.0f, 1, 3);
01086         RNA_def_property_ui_text(prop, "Step Size", "Distance between subsequent volume depth samples");
01087         RNA_def_property_update(prop, 0, "rna_Material_update");
01088         
01089         prop= RNA_def_property(srna, "light_method", PROP_ENUM, PROP_NONE);
01090         RNA_def_property_enum_sdna(prop, NULL, "shade_type");
01091         RNA_def_property_enum_items(prop, prop_lighting_items);
01092         RNA_def_property_ui_text(prop, "Lighting Mode", "Method of shading, attenuating, and scattering light through the volume");
01093         RNA_def_property_update(prop, 0, "rna_Material_update");
01094         
01095         prop= RNA_def_property(srna, "use_external_shadows", PROP_BOOLEAN, PROP_NONE);
01096         RNA_def_property_boolean_sdna(prop, NULL, "shadeflag", MA_VOL_RECV_EXT_SHADOW); /* use bitflags */
01097         RNA_def_property_ui_text(prop, "External Shadows", "Receive shadows from sources outside the volume (temporary)");
01098         RNA_def_property_update(prop, 0, "rna_Material_update");
01099         
01100         prop= RNA_def_property(srna, "use_light_cache", PROP_BOOLEAN, PROP_NONE);
01101         RNA_def_property_boolean_sdna(prop, NULL, "shadeflag", MA_VOL_PRECACHESHADING); /* use bitflags */
01102         RNA_def_property_ui_text(prop, "Light Cache", "Pre-calculate the shading information into a voxel grid, speeds up shading at slightly less accuracy");
01103         RNA_def_property_update(prop, 0, "rna_Material_update");
01104         
01105         prop= RNA_def_property(srna, "cache_resolution", PROP_INT, PROP_NONE);
01106         RNA_def_property_int_sdna(prop, NULL, "precache_resolution");
01107         RNA_def_property_range(prop, 1, 1024);
01108         RNA_def_property_ui_text(prop, "Resolution", "Resolution of the voxel grid, low resolutions are faster, high resolutions use more memory");
01109         RNA_def_property_update(prop, 0, "rna_Material_update");
01110         
01111         prop= RNA_def_property(srna, "ms_diffusion", PROP_FLOAT, PROP_NONE);
01112         RNA_def_property_float_sdna(prop, NULL, "ms_diff");
01113         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01114         RNA_def_property_ui_text(prop, "Diffusion", "Diffusion factor, the strength of the blurring effect");
01115         RNA_def_property_update(prop, 0, "rna_Material_update");
01116         
01117         prop= RNA_def_property(srna, "ms_spread", PROP_FLOAT, PROP_NONE);
01118         RNA_def_property_float_sdna(prop, NULL, "ms_spread");
01119         RNA_def_property_range(prop, 0, FLT_MAX);
01120         RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
01121         RNA_def_property_ui_text(prop, "Spread", "Proportional distance over which the light is diffused");
01122         RNA_def_property_update(prop, 0, "rna_Material_update");
01123         
01124         prop= RNA_def_property(srna, "ms_intensity", PROP_FLOAT, PROP_NONE);
01125         RNA_def_property_float_sdna(prop, NULL, "ms_intensity");
01126         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01127         RNA_def_property_ui_text(prop, "Intensity", "Multiplier for multiple scattered light energy");
01128         RNA_def_property_update(prop, 0, "rna_Material_update");
01129         
01130         prop= RNA_def_property(srna, "depth_threshold", PROP_FLOAT, PROP_NONE);
01131         RNA_def_property_float_sdna(prop, NULL, "depth_cutoff");
01132         RNA_def_property_range(prop, 0.0f, 1.0f);
01133         RNA_def_property_ui_text(prop, "Depth Cutoff", "Stop ray marching early if transmission drops below this luminance - higher values give speedups in dense volumes at the expense of accuracy");
01134         RNA_def_property_update(prop, 0, "rna_Material_update");
01135         
01136         prop= RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
01137         RNA_def_property_float_sdna(prop, NULL, "density");
01138         RNA_def_property_range(prop, 0.0f, 1.0f);
01139         RNA_def_property_ui_text(prop, "Density", "The base density of the volume");
01140         RNA_def_property_update(prop, 0, "rna_Material_update");
01141 
01142         prop= RNA_def_property(srna, "density_scale", PROP_FLOAT, PROP_NONE);
01143         RNA_def_property_float_sdna(prop, NULL, "density_scale");
01144         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01145         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
01146         RNA_def_property_ui_text(prop, "Density Scale", "Multiplier for the material's density");
01147         RNA_def_property_update(prop, 0, "rna_Material_update");
01148         
01149         prop= RNA_def_property(srna, "scattering", PROP_FLOAT, PROP_NONE);
01150         RNA_def_property_float_sdna(prop, NULL, "scattering");
01151         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01152         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1 ,3);
01153         RNA_def_property_ui_text(prop, "Scattering", "Amount of light that gets scattered out by the volume - the more out-scattering, the shallower the light will penetrate ");
01154         RNA_def_property_update(prop, 0, "rna_Material_update");
01155         
01156         prop= RNA_def_property(srna, "transmission_color", PROP_FLOAT, PROP_COLOR);
01157         RNA_def_property_float_sdna(prop, NULL, "transmission_col");
01158         RNA_def_property_array(prop, 3);
01159         RNA_def_property_ui_text(prop, "Transmission Color", "Result color of the volume, after other light has been scattered/absorbed");
01160         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01161         
01162         prop= RNA_def_property(srna, "reflection_color", PROP_FLOAT, PROP_COLOR);
01163         RNA_def_property_float_sdna(prop, NULL, "reflection_col");
01164         RNA_def_property_array(prop, 3);
01165         RNA_def_property_ui_text(prop, "Reflection Color", "Color of light scattered out of the volume (does not affect transmission)");
01166         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01167         
01168         prop= RNA_def_property(srna, "reflection", PROP_FLOAT, PROP_NONE);
01169         RNA_def_property_float_sdna(prop, NULL, "reflection");
01170         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01171         RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1 ,3);
01172         RNA_def_property_ui_text(prop, "Reflection", "Multiplier to make out-scattered light brighter or darker (non-physically correct)");
01173         RNA_def_property_update(prop, 0, "rna_Material_update");
01174         
01175         prop= RNA_def_property(srna, "emission_color", PROP_FLOAT, PROP_COLOR);
01176         RNA_def_property_float_sdna(prop, NULL, "emission_col");
01177         RNA_def_property_array(prop, 3);
01178         RNA_def_property_ui_text(prop, "Emission Color", "Color of emitted light");
01179         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01180         
01181         prop= RNA_def_property(srna, "emission", PROP_FLOAT, PROP_NONE);
01182         RNA_def_property_float_sdna(prop, NULL, "emission");
01183         RNA_def_property_range(prop, 0.0f, FLT_MAX);
01184         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
01185         RNA_def_property_ui_text(prop, "Emission", "Amount of light that gets emitted by the volume");
01186         RNA_def_property_update(prop, 0, "rna_Material_update");
01187                 
01188         prop= RNA_def_property(srna, "asymmetry", PROP_FLOAT, PROP_NONE);
01189         RNA_def_property_float_sdna(prop, NULL, "asymmetry");
01190         RNA_def_property_range(prop, -1.0f, 1.0f);
01191         RNA_def_property_ui_text(prop, "Asymmetry", "Back scattering (-1.0) to Forward scattering (1.0) and the range in between");
01192         RNA_def_property_update(prop, 0, "rna_Material_update");
01193 }
01194 
01195 
01196 static void rna_def_material_halo(BlenderRNA *brna)
01197 {
01198         StructRNA *srna;
01199         PropertyRNA *prop;
01200 
01201         srna= RNA_def_struct(brna, "MaterialHalo", NULL);
01202         RNA_def_struct_sdna(srna, "Material");
01203         RNA_def_struct_nested(brna, srna, "Material");
01204         RNA_def_struct_ui_text(srna, "Material Halo", "Halo particle effect settings for a Material datablock");
01205 
01206         prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
01207         RNA_def_property_float_sdna(prop, NULL, "hasize");
01208         RNA_def_property_range(prop, 0.0f, 100.0f);
01209         RNA_def_property_ui_text(prop, "Size", "Sets the dimension of the halo");
01210         RNA_def_property_update(prop, 0, "rna_Material_update");
01211         
01212         prop= RNA_def_property(srna, "hardness", PROP_INT, PROP_NONE);
01213         RNA_def_property_int_sdna(prop, NULL, "har");
01214         RNA_def_property_range(prop, 0, 127);
01215         RNA_def_property_ui_text(prop, "Hardness", "Sets the hardness of the halo");
01216         RNA_def_property_update(prop, 0, "rna_Material_update");
01217         
01218         prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_FACTOR);
01219         RNA_def_property_float_sdna(prop, NULL, "add");
01220         RNA_def_property_range(prop, 0.0f, 1.0f);
01221         RNA_def_property_ui_text(prop, "Add", "Sets the strength of the add effect");
01222         RNA_def_property_update(prop, 0, "rna_Material_update");
01223         
01224         prop= RNA_def_property(srna, "ring_count", PROP_INT, PROP_NONE);
01225         RNA_def_property_int_sdna(prop, NULL, "ringc");
01226         RNA_def_property_range(prop, 0, 24);
01227         RNA_def_property_ui_text(prop, "Rings", "Sets the number of rings rendered over the halo");
01228         RNA_def_property_update(prop, 0, "rna_Material_update");
01229         
01230         prop= RNA_def_property(srna, "line_count", PROP_INT, PROP_NONE);
01231         RNA_def_property_int_sdna(prop, NULL, "linec");
01232         RNA_def_property_range(prop, 0, 250);
01233         RNA_def_property_ui_text(prop, "Line Number", "Sets the number of star shaped lines rendered over the halo");
01234         RNA_def_property_update(prop, 0, "rna_Material_update");
01235         
01236         prop= RNA_def_property(srna, "star_tip_count", PROP_INT, PROP_NONE);
01237         RNA_def_property_int_sdna(prop, NULL, "starc");
01238         RNA_def_property_range(prop, 3, 50);
01239         RNA_def_property_ui_text(prop, "Star Tips", "Sets the number of points on the star shaped halo");
01240         RNA_def_property_update(prop, 0, "rna_Material_update");
01241         
01242         prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
01243         RNA_def_property_int_sdna(prop, NULL, "seed1");
01244         RNA_def_property_range(prop, 0, 255);
01245         RNA_def_property_ui_text(prop, "Seed", "Randomizes ring dimension and line location");
01246         RNA_def_property_update(prop, 0, "rna_Material_update");
01247         
01248         prop= RNA_def_property(srna, "use_flare_mode", PROP_BOOLEAN, PROP_NONE);
01249         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_FLARE); /* use bitflags */
01250         RNA_def_property_ui_text(prop, "Flare", "Renders halo as a lens flare");
01251         RNA_def_property_update(prop, 0, "rna_Material_update");
01252         
01253         prop= RNA_def_property(srna, "flare_size", PROP_FLOAT, PROP_NONE);
01254         RNA_def_property_float_sdna(prop, NULL, "flaresize");
01255         RNA_def_property_range(prop, 0.1f, 25.0f);
01256         RNA_def_property_ui_text(prop, "Flare Size", "Sets the factor by which the flare is larger than the halo");
01257         RNA_def_property_update(prop, 0, "rna_Material_update");
01258         
01259         prop= RNA_def_property(srna, "flare_subflare_size", PROP_FLOAT, PROP_NONE);
01260         RNA_def_property_float_sdna(prop, NULL, "subsize");
01261         RNA_def_property_range(prop, 0.1f, 25.0f);
01262         RNA_def_property_ui_text(prop, "Flare Subsize", "Sets the dimension of the sub-flares, dots and circles");
01263         RNA_def_property_update(prop, 0, "rna_Material_update");
01264         
01265         prop= RNA_def_property(srna, "flare_boost", PROP_FLOAT, PROP_NONE);
01266         RNA_def_property_float_sdna(prop, NULL, "flareboost");
01267         RNA_def_property_range(prop, 0.1f, 10.0f);
01268         RNA_def_property_ui_text(prop, "Flare Boost", "Gives the flare extra strength");
01269         RNA_def_property_update(prop, 0, "rna_Material_update");
01270         
01271         prop= RNA_def_property(srna, "flare_seed", PROP_INT, PROP_NONE);
01272         RNA_def_property_int_sdna(prop, NULL, "seed2");
01273         RNA_def_property_range(prop, 0, 255);
01274         RNA_def_property_ui_text(prop, "Flare Seed", "Specifies an offset in the flare seed table");
01275         RNA_def_property_update(prop, 0, "rna_Material_update");
01276         
01277         prop= RNA_def_property(srna, "flare_subflare_count", PROP_INT, PROP_NONE);
01278         RNA_def_property_int_sdna(prop, NULL, "flarec");
01279         RNA_def_property_range(prop, 1, 32);
01280         RNA_def_property_ui_text(prop, "Flares Sub", "Sets the number of sub-flares");
01281         RNA_def_property_update(prop, 0, "rna_Material_update");
01282         
01283         prop= RNA_def_property(srna, "use_ring", PROP_BOOLEAN, PROP_NONE);
01284         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_RINGS);
01285         RNA_def_property_ui_text(prop, "Rings", "Renders rings over halo");
01286         RNA_def_property_update(prop, 0, "rna_Material_update");
01287         
01288         prop= RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE);
01289         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_LINES);
01290         RNA_def_property_ui_text(prop, "Lines", "Renders star shaped lines over halo");
01291         RNA_def_property_update(prop, 0, "rna_Material_update");
01292         
01293         prop= RNA_def_property(srna, "use_star", PROP_BOOLEAN, PROP_NONE);
01294         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STAR);
01295         RNA_def_property_ui_text(prop, "Star", "Renders halo as a star");
01296         RNA_def_property_update(prop, 0, "rna_Material_update");
01297         
01298         prop= RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
01299         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOTEX);
01300         RNA_def_property_ui_text(prop, "Texture", "Gives halo a texture");
01301         RNA_def_property_update(prop, 0, "rna_Material_update");
01302         
01303         prop= RNA_def_property(srna, "use_vertex_normal", PROP_BOOLEAN, PROP_NONE);
01304         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOPUNO);
01305         RNA_def_property_ui_text(prop, "Vertex Normal", "Uses the vertex normal to specify the dimension of the halo");
01306         RNA_def_property_update(prop, 0, "rna_Material_update");
01307         
01308         prop= RNA_def_property(srna, "use_extreme_alpha", PROP_BOOLEAN, PROP_NONE);
01309         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_XALPHA);
01310         RNA_def_property_ui_text(prop, "Extreme Alpha", "Uses extreme alpha");
01311         RNA_def_property_update(prop, 0, "rna_Material_update");
01312         
01313         prop= RNA_def_property(srna, "use_shaded", PROP_BOOLEAN, PROP_NONE);
01314         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SHADE);
01315         RNA_def_property_ui_text(prop, "Shaded", "Lets halo receive light and shadows from external objects");
01316         RNA_def_property_update(prop, 0, "rna_Material_update");
01317         
01318         prop= RNA_def_property(srna, "use_soft", PROP_BOOLEAN, PROP_NONE);
01319         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SOFT);
01320         RNA_def_property_ui_text(prop, "Soft", "Softens the edges of halos at intersections with other geometry");
01321         RNA_def_property_update(prop, 0, "rna_Material_update");
01322 }
01323 
01324 static void rna_def_material_sss(BlenderRNA *brna)
01325 {
01326         StructRNA *srna;
01327         PropertyRNA *prop;
01328 
01329         srna= RNA_def_struct(brna, "MaterialSubsurfaceScattering", NULL);
01330         RNA_def_struct_sdna(srna, "Material");
01331         RNA_def_struct_nested(brna, srna, "Material");
01332         RNA_def_struct_ui_text(srna, "Material Subsurface Scattering", "Diffuse subsurface scattering settings for a Material datablock");
01333 
01334         prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_COLOR|PROP_UNIT_LENGTH);
01335         RNA_def_property_float_sdna(prop, NULL, "sss_radius");
01336         RNA_def_property_range(prop, 0.001, FLT_MAX);
01337         RNA_def_property_ui_range(prop, 0.001, 10000, 1, 3);
01338         RNA_def_property_ui_text(prop, "Radius", "Mean red/green/blue scattering path length");
01339         RNA_def_property_update(prop, 0, "rna_Material_update");
01340 
01341         prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
01342         RNA_def_property_float_sdna(prop, NULL, "sss_col");
01343         RNA_def_property_ui_text(prop, "Color", "Scattering color");
01344         RNA_def_property_update(prop, 0, "rna_Material_update");
01345 
01346         prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
01347         RNA_def_property_float_sdna(prop, NULL, "sss_error");
01348         RNA_def_property_ui_range(prop, 0.0001, 10, 1, 3);
01349         RNA_def_property_ui_text(prop, "Error Tolerance", "Error tolerance (low values are slower and higher quality)");
01350         RNA_def_property_update(prop, 0, "rna_Material_update");
01351 
01352         prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
01353         RNA_def_property_float_sdna(prop, NULL, "sss_scale");
01354         RNA_def_property_ui_range(prop, 0.001, 1000, 1, 3);
01355         RNA_def_property_ui_text(prop, "Scale", "Object scale factor");
01356         RNA_def_property_update(prop, 0, "rna_Material_update");
01357 
01358         prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
01359         RNA_def_property_float_sdna(prop, NULL, "sss_ior");
01360         RNA_def_property_ui_range(prop, 0.1, 2, 1, 3);
01361         RNA_def_property_ui_text(prop, "IOR", "Index of refraction (higher values are denser)");
01362         RNA_def_property_update(prop, 0, "rna_Material_update");
01363 
01364         prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_FACTOR);
01365         RNA_def_property_float_sdna(prop, NULL, "sss_colfac");
01366         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01367         RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors");
01368         RNA_def_property_update(prop, 0, "rna_Material_update");
01369 
01370         prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_FACTOR);
01371         RNA_def_property_float_sdna(prop, NULL, "sss_texfac");
01372         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01373         RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor");
01374         RNA_def_property_update(prop, 0, "rna_Material_update");
01375 
01376         prop= RNA_def_property(srna, "front", PROP_FLOAT, PROP_NONE);
01377         RNA_def_property_float_sdna(prop, NULL, "sss_front");
01378         RNA_def_property_range(prop, 0, 2);
01379         RNA_def_property_ui_text(prop, "Front", "Front scattering weight");
01380         RNA_def_property_update(prop, 0, "rna_Material_update");
01381 
01382         prop= RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
01383         RNA_def_property_float_sdna(prop, NULL, "sss_back");
01384         RNA_def_property_range(prop, 0, 10);
01385         RNA_def_property_ui_text(prop, "Back", "Back scattering weight");
01386         RNA_def_property_update(prop, 0, "rna_Material_update");
01387 
01388         prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
01389         RNA_def_property_boolean_sdna(prop, NULL, "sss_flag", MA_DIFF_SSS);
01390         RNA_def_property_ui_text(prop, "Enabled", "Enable diffuse subsurface scatting effects in a material");
01391         RNA_def_property_update(prop, 0, "rna_Material_update");
01392 }
01393 
01394 static void rna_def_material_specularity(StructRNA *srna)
01395 {
01396         PropertyRNA *prop;
01397         
01398         static EnumPropertyItem prop_specular_shader_items[] = {
01399                 {MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", "Use a Cook-Torrance shader"},
01400                 {MA_SPEC_PHONG, "PHONG", 0, "Phong", "Use a Phong shader"},
01401                 {MA_SPEC_BLINN, "BLINN", 0, "Blinn", "Use a Blinn shader"},
01402                 {MA_SPEC_TOON, "TOON", 0, "Toon", "Use a toon shader"},
01403                 {MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", "Use a Ward anisotropic shader"},
01404                 {0, NULL, 0, NULL, NULL}};
01405         
01406         prop= RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE);
01407         RNA_def_property_enum_sdna(prop, NULL, "spec_shader");
01408         RNA_def_property_enum_items(prop, prop_specular_shader_items);
01409         RNA_def_property_ui_text(prop, "Specular Shader Model", "");
01410         RNA_def_property_update(prop, 0, "rna_Material_update");
01411         
01412         prop= RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
01413         RNA_def_property_float_sdna(prop, NULL, "spec");
01414         RNA_def_property_range(prop, 0, 1);
01415         RNA_def_property_ui_text(prop, "Specular Intensity", "How intense (bright) the specular reflection is");
01416         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01417 
01418         /* NOTE: "har", "param", etc are used for multiple purposes depending on
01419          * settings. This should be fixed in DNA once, for RNA we just expose them
01420          * multiple times, which may give somewhat strange changes in the outliner,
01421          * but in the UI they are never visible at the same time. */
01422 
01423         prop= RNA_def_property(srna, "specular_hardness", PROP_INT, PROP_NONE);
01424         RNA_def_property_int_sdna(prop, NULL, "har");
01425         RNA_def_property_range(prop, 1, 511);
01426         RNA_def_property_ui_text(prop, "Specular Hardness", "How hard (sharp) the specular reflection is");
01427         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01428 
01429         prop= RNA_def_property(srna, "specular_ior", PROP_FLOAT, PROP_NONE);
01430         RNA_def_property_float_sdna(prop, NULL, "refrac");
01431         RNA_def_property_range(prop, 1, 10);
01432         RNA_def_property_ui_text(prop, "Specular IOR", "Specular index of refraction");
01433         RNA_def_property_update(prop, 0, "rna_Material_update");
01434 
01435         prop= RNA_def_property(srna, "specular_toon_size", PROP_FLOAT, PROP_NONE);
01436         RNA_def_property_float_sdna(prop, NULL, "param[2]");
01437         RNA_def_property_range(prop, 0.0f, 1.53f);
01438         RNA_def_property_ui_text(prop, "Specular Toon Size", "Size of specular toon area");
01439         RNA_def_property_update(prop, 0, "rna_Material_update");
01440 
01441         prop= RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_FACTOR);
01442         RNA_def_property_float_sdna(prop, NULL, "param[3]");
01443         RNA_def_property_range(prop, 0.0f, 1.0f);
01444         RNA_def_property_ui_text(prop, "Specular Toon Smooth", "Smoothness of specular toon area");
01445         RNA_def_property_update(prop, 0, "rna_Material_update");
01446 
01447         prop= RNA_def_property(srna, "specular_slope", PROP_FLOAT, PROP_FACTOR);
01448         RNA_def_property_float_sdna(prop, NULL, "rms");
01449         RNA_def_property_range(prop, 0, 0.4);
01450         RNA_def_property_ui_text(prop, "Specular Slope", "The standard deviation of surface slope");
01451         RNA_def_property_update(prop, 0, "rna_Material_update");
01452 }
01453 
01454 static void rna_def_material_strand(BlenderRNA *brna)
01455 {
01456         StructRNA *srna;
01457         PropertyRNA *prop;
01458 
01459         srna= RNA_def_struct(brna, "MaterialStrand", NULL);
01460         RNA_def_struct_sdna(srna, "Material");
01461         RNA_def_struct_nested(brna, srna, "Material");
01462         RNA_def_struct_ui_text(srna, "Material Strand", "Strand settings for a Material datablock");
01463 
01464         prop= RNA_def_property(srna, "use_tangent_shading", PROP_BOOLEAN, PROP_NONE);
01465         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_STR);
01466         RNA_def_property_ui_text(prop, "Tangent Shading", "Uses direction of strands as normal for tangent-shading");
01467         RNA_def_property_update(prop, 0, "rna_Material_update");
01468         
01469         /* this flag is only set when rendering, not to be edited manually */
01470         prop= RNA_def_property(srna, "use_surface_diffuse", PROP_BOOLEAN, PROP_NONE);
01471         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STR_SURFDIFF);
01472         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01473         RNA_def_property_ui_text(prop, "Surface Diffuse", "Make diffuse shading more similar to shading the surface");
01474         RNA_def_property_update(prop, 0, "rna_Material_update");
01475 
01476         prop= RNA_def_property(srna, "blend_distance", PROP_FLOAT, PROP_DISTANCE);
01477         RNA_def_property_float_sdna(prop, NULL, "strand_surfnor");
01478         RNA_def_property_range(prop, 0, 10);
01479         RNA_def_property_ui_text(prop, "Blend Distance", "Worldspace distance over which to blend in the surface normal");
01480         RNA_def_property_update(prop, 0, "rna_Material_update");
01481 
01482         prop= RNA_def_property(srna, "use_blender_units", PROP_BOOLEAN, PROP_NONE);
01483         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STR_B_UNITS);
01484         RNA_def_property_ui_text(prop, "Blender Units", "Use Blender units for widths instead of pixels");
01485         RNA_def_property_update(prop, 0, "rna_Material_update");
01486 
01487         prop= RNA_def_property(srna, "root_size", PROP_FLOAT, PROP_UNSIGNED);
01488         RNA_def_property_float_sdna(prop, NULL, "strand_sta");
01489         RNA_def_property_float_funcs(prop, NULL, NULL, "rna_MaterialStrand_start_size_range");
01490         RNA_def_property_ui_range(prop, 0, 10.0f, 10, 5);
01491         RNA_def_property_ui_text(prop, "Root Size", "Start size of strands in pixels or Blender units");
01492         RNA_def_property_update(prop, 0, "rna_Material_update");
01493 
01494         prop= RNA_def_property(srna, "tip_size", PROP_FLOAT, PROP_UNSIGNED);
01495         RNA_def_property_float_sdna(prop, NULL, "strand_end");
01496         RNA_def_property_ui_range(prop, 0, 10.0f, 10, 5);
01497         RNA_def_property_float_funcs(prop, NULL, NULL, "rna_MaterialStrand_end_size_range");
01498         RNA_def_property_ui_text(prop, "Tip Size", "End size of strands in pixels or Blender units");
01499         RNA_def_property_update(prop, 0, "rna_Material_update");
01500 
01501         prop= RNA_def_property(srna, "size_min", PROP_FLOAT, PROP_UNSIGNED);
01502         RNA_def_property_float_sdna(prop, NULL, "strand_min");
01503         RNA_def_property_range(prop, 0.001, 10);
01504         RNA_def_property_ui_text(prop, "Minimum Size", "Minimum size of strands in pixels");
01505         RNA_def_property_update(prop, 0, "rna_Material_update");
01506 
01507         prop= RNA_def_property(srna, "shape", PROP_FLOAT, PROP_NONE);
01508         RNA_def_property_float_sdna(prop, NULL, "strand_ease");
01509         RNA_def_property_range(prop, -0.9, 0.9);
01510         RNA_def_property_ui_text(prop, "Shape", "Positive values make strands rounder, negative makes strands spiky");
01511         RNA_def_property_update(prop, 0, "rna_Material_update");
01512 
01513         prop= RNA_def_property(srna, "width_fade", PROP_FLOAT, PROP_NONE);
01514         RNA_def_property_float_sdna(prop, NULL, "strand_widthfade");
01515         RNA_def_property_range(prop, 0, 2);
01516         RNA_def_property_ui_text(prop, "Width Fade", "Transparency along the width of the strand");
01517         RNA_def_property_update(prop, 0, "rna_Material_update");
01518 
01519         prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
01520         RNA_def_property_string_sdna(prop, NULL, "strand_uvname");
01521         RNA_def_property_ui_text(prop, "UV Layer", "Name of UV layer to override");
01522         RNA_def_property_update(prop, 0, "rna_Material_update");
01523 }
01524 
01525 static void rna_def_material_physics(BlenderRNA *brna)
01526 {
01527         StructRNA *srna;
01528         PropertyRNA *prop;
01529         
01530         srna= RNA_def_struct(brna, "MaterialPhysics", NULL);
01531         RNA_def_struct_sdna(srna, "Material");
01532         RNA_def_struct_nested(brna, srna, "Material");
01533         RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material datablock");
01534         
01535         prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
01536         RNA_def_property_float_sdna(prop, NULL, "friction");
01537         RNA_def_property_range(prop, 0, 100);
01538         RNA_def_property_ui_text(prop, "Friction", "Coulomb friction coefficient, when inside the physics distance area");
01539 
01540         prop= RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE);
01541         RNA_def_property_float_sdna(prop, NULL, "reflect");
01542         RNA_def_property_range(prop, 0, 1);
01543         RNA_def_property_ui_text(prop, "Elasticity", "Elasticity of collisions");
01544 
01545         /* FH/Force Field Settings */
01546         prop= RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
01547         RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR);
01548         RNA_def_property_ui_text(prop, "Align to Normal", "Align dynamic game objects along the surface normal, when inside the physics distance area");
01549 
01550         prop= RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
01551         RNA_def_property_float_sdna(prop, NULL, "fh");
01552         RNA_def_property_range(prop, 0, 1);
01553         RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
01554         RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area");
01555         
01556         prop= RNA_def_property(srna, "fh_distance", PROP_FLOAT, PROP_NONE);
01557         RNA_def_property_float_sdna(prop, NULL, "fhdist");
01558         RNA_def_property_range(prop, 0, 20);
01559         RNA_def_property_ui_text(prop, "Distance", "Distance of the physics area");
01560         
01561         prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
01562         RNA_def_property_float_sdna(prop, NULL, "xyfrict");
01563         RNA_def_property_range(prop, 0, 1);
01564         RNA_def_property_ui_text(prop, "Damping", "Damping of the spring force, when inside the physics distance area");
01565 }
01566 
01567 void RNA_def_material(BlenderRNA *brna)
01568 {
01569         StructRNA *srna;
01570         PropertyRNA *prop;
01571 
01572         static EnumPropertyItem prop_type_items[] = {
01573                 {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface"},
01574                 {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)"},
01575                 {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume"},
01576                 {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"},
01577                 {0, NULL, 0, NULL, NULL}};
01578         static EnumPropertyItem transparency_items[] = {
01579                 {0, "MASK", 0, "Mask", "Mask the background"},
01580                 {MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces"},
01581                 {MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering"},
01582                 {0, NULL, 0, NULL, NULL}};
01583         
01584         /* Render Preview Types */
01585         static EnumPropertyItem preview_type_items[] = {
01586                 {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Preview type: Flat XY plane"},
01587                 {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Preview type: Sphere"},
01588                 {MA_CUBE, "CUBE", ICON_MATCUBE, "Flat", "Preview type: Cube"},
01589                 {MA_MONKEY, "MONKEY", ICON_MONKEY, "Flat", "Preview type: Monkey"},
01590                 {MA_HAIR, "HAIR", ICON_HAIR, "Flat", "Preview type: Hair strands"},
01591                 {MA_SPHERE_A, "SPHERE_A", ICON_MAT_SPHERE_SKY, "Flat", "Preview type: Large sphere with sky"},
01592                 {0, NULL, 0, NULL, NULL}};
01593 
01594         static EnumPropertyItem prop_shadows_only_items[] = {
01595                 {MA_SO_OLD, "SHADOW_ONLY_OLD", 0, "Shadow and Distance", "Old shadow only method"},
01596                 {MA_SO_SHADOW, "SHADOW_ONLY", 0, "Shadow Only", "Improved shadow only method"},
01597                 {MA_SO_SHADED, "SHADOW_ONLY_SHADED", 0, "Shadow and Shading", "Improved shadow only method which also renders lightless areas as shadows"},
01598                 {0, NULL, 0, NULL, NULL}};
01599 
01600         srna= RNA_def_struct(brna, "Material", "ID");
01601         RNA_def_struct_ui_text(srna, "Material", "Material datablock to defined the appearance of geometric objects for rendering");
01602         RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
01603         
01604         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
01605         RNA_def_property_enum_sdna(prop, NULL, "material_type");
01606         RNA_def_property_enum_items(prop, prop_type_items);
01607         RNA_def_property_ui_text(prop, "Type", "Material type defining how the object is rendered");
01608         RNA_def_property_enum_funcs(prop, NULL, "rna_Material_type_set", NULL);
01609         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01610 
01611         prop= RNA_def_property(srna, "use_transparency", PROP_BOOLEAN, PROP_NONE);
01612         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRANSP);
01613         RNA_def_property_ui_text(prop, "Transparency", "Render material as transparent");
01614         RNA_def_property_update(prop, 0, "rna_Material_update");
01615 
01616         prop= RNA_def_property(srna, "transparency_method", PROP_ENUM, PROP_NONE);
01617         RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
01618         RNA_def_property_enum_items(prop, transparency_items);
01619         RNA_def_property_ui_text(prop, "Transparency Method", "Method to use for rendering transparency");
01620         RNA_def_property_update(prop, 0, "rna_Material_update");
01621         
01622         /* For Preview Render */
01623         prop= RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
01624         RNA_def_property_enum_sdna(prop, NULL, "pr_type");
01625         RNA_def_property_enum_items(prop, preview_type_items);
01626         RNA_def_property_ui_text(prop, "Preview render type", "Type of preview render");
01627         RNA_def_property_update(prop, 0, "rna_Material_update");
01628         
01629         prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_FACTOR);
01630         RNA_def_property_float_sdna(prop, NULL, "amb");
01631         RNA_def_property_range(prop, 0, 1);
01632         RNA_def_property_ui_text(prop, "Ambient", "Amount of global ambient color the material receives");
01633         RNA_def_property_update(prop, 0, "rna_Material_update");
01634 
01635         prop= RNA_def_property(srna, "emit", PROP_FLOAT, PROP_NONE);
01636         RNA_def_property_range(prop, 0, FLT_MAX);
01637         RNA_def_property_ui_range(prop, 0, 2.0f, 1, 2);
01638         RNA_def_property_ui_text(prop, "Emit", "Amount of light to emit");
01639         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01640 
01641         prop= RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_FACTOR);
01642         RNA_def_property_range(prop, 0, 1);
01643         RNA_def_property_ui_text(prop, "Translucency", "Amount of diffuse shading on the back side");
01644         RNA_def_property_update(prop, 0, "rna_Material_update");
01645                 
01646         prop= RNA_def_property(srna, "use_cubic", PROP_BOOLEAN, PROP_NONE);
01647         RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_CUBIC);
01648         RNA_def_property_ui_text(prop, "Cubic Interpolation", "Use cubic interpolation for diffuse values, for smoother transitions");
01649         RNA_def_property_update(prop, 0, "rna_Material_update");
01650         
01651         prop= RNA_def_property(srna, "use_object_color", PROP_BOOLEAN, PROP_NONE);
01652         RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_OBCOLOR);
01653         RNA_def_property_ui_text(prop, "Object Color", "Modulate the result with a per-object color");
01654         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01655 
01656         prop= RNA_def_property(srna, "shadow_ray_bias", PROP_FLOAT, PROP_NONE);
01657         RNA_def_property_float_sdna(prop, NULL, "sbias");
01658         RNA_def_property_range(prop, 0, 0.25);
01659         RNA_def_property_ui_text(prop, "Shadow Ray Bias", "Shadow raytracing bias to prevent terminator problems on shadow boundary");
01660 
01661         prop= RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
01662         RNA_def_property_float_sdna(prop, NULL, "lbias");
01663         RNA_def_property_range(prop, 0, 10);
01664         RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Factor to multiply shadow buffer bias with (0 is ignore.)");
01665 
01666         prop= RNA_def_property(srna, "shadow_cast_alpha", PROP_FLOAT, PROP_FACTOR);
01667         RNA_def_property_float_sdna(prop, NULL, "shad_alpha");
01668         RNA_def_property_range(prop, 0.001, 1);
01669         RNA_def_property_ui_text(prop, "Shadow Casting Alpha", "Shadow casting alpha, in use for Irregular and Deep shadow buffer");
01670         RNA_def_property_update(prop, 0, "rna_Material_update");
01671 
01672         prop= RNA_def_property(srna, "light_group", PROP_POINTER, PROP_NONE);
01673         RNA_def_property_pointer_sdna(prop, NULL, "group");
01674         RNA_def_property_struct_type(prop, "Group");
01675         RNA_def_property_flag(prop, PROP_EDITABLE);
01676         RNA_def_property_ui_text(prop, "Light Group", "Limit lighting to lamps in this Group");
01677         RNA_def_property_update(prop, 0, "rna_Material_update");
01678 
01679         prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
01680         RNA_def_property_int_sdna(prop, NULL, "index");
01681         RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexMA render pass");
01682         RNA_def_property_update(prop, NC_OBJECT, NULL);
01683 
01684         /* flags */
01685         
01686         prop= RNA_def_property(srna, "use_light_group_exclusive", PROP_BOOLEAN, PROP_NONE);
01687         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_GROUP_NOLAY);
01688         RNA_def_property_ui_text(prop, "Light Group Exclusive", "Material uses the light group exclusively - these lamps are excluded from other scene lighting");
01689         RNA_def_property_update(prop, 0, "rna_Material_update");
01690         
01691         prop= RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE);
01692         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRACEBLE);
01693         RNA_def_property_ui_text(prop, "Traceable", "Include this material and geometry that uses it in ray tracing calculations");
01694         RNA_def_property_update(prop, 0, "rna_Material_update");
01695         
01696         prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE);
01697         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW);
01698         RNA_def_property_ui_text(prop, "Shadows", "Allows this material to receive shadows");
01699         RNA_def_property_update(prop, 0, "rna_Material_update");
01700         
01701         prop= RNA_def_property(srna, "use_shadeless", PROP_BOOLEAN, PROP_NONE);
01702         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHLESS);
01703         RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow");
01704         RNA_def_property_update(prop, 0, "rna_Material_draw_update");
01705         
01706         prop= RNA_def_property(srna, "use_vertex_color_light", PROP_BOOLEAN, PROP_NONE);
01707         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOL);
01708         RNA_def_property_ui_text(prop, "Vertex Color Light", "Add vertex colors as additional lighting");
01709         RNA_def_property_update(prop, 0, "rna_Material_update");
01710 
01711         prop= RNA_def_property(srna, "use_vertex_color_paint", PROP_BOOLEAN, PROP_NONE);
01712         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOLP);
01713         RNA_def_property_ui_text(prop, "Vertex Color Paint", "Replaces object base color with vertex colors (multiplies with 'texture face' face assigned textures)");
01714         RNA_def_property_update(prop, 0, "rna_Material_update");
01715         
01716         prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
01717         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZINV);
01718         RNA_def_property_ui_text(prop, "Invert Z Depth", "Renders material's faces with an inverted Z buffer (scanline only)");
01719         RNA_def_property_update(prop, 0, "rna_Material_update");
01720 
01721         prop= RNA_def_property(srna, "offset_z", PROP_FLOAT, PROP_NONE);
01722         RNA_def_property_float_sdna(prop, NULL, "zoffs");
01723         RNA_def_property_ui_text(prop, "Z Offset", "Gives faces an artificial offset in the Z buffer for Z transparency");
01724         RNA_def_property_update(prop, 0, "rna_Material_update");
01725         
01726         prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
01727         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ENV);
01728         RNA_def_property_ui_text(prop, "Sky", "Renders this material with zero alpha, with sky background in place (scanline only)");
01729         RNA_def_property_update(prop, 0, "rna_Material_update");
01730         
01731         prop= RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE);
01732         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYSHADOW);
01733         RNA_def_property_ui_text(prop, "Only Shadow", "Renders shadows as the material's alpha value, making materials transparent except for shadowed areas");
01734         RNA_def_property_update(prop, 0, "rna_Material_update");
01735 
01736         prop= RNA_def_property(srna, "shadow_only_type", PROP_ENUM, PROP_NONE);
01737         RNA_def_property_enum_bitflag_sdna(prop, NULL, "shadowonly_flag");
01738         RNA_def_property_enum_items(prop, prop_shadows_only_items);
01739         RNA_def_property_ui_text(prop, "Shadow Type", "How to draw shadows");
01740         RNA_def_property_update(prop, 0, "rna_Material_update");
01741         
01742         prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE);
01743         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE);
01744         RNA_def_property_ui_text(prop, "Face Textures", "Replaces the object's base color with color from face assigned image textures");
01745         RNA_def_property_update(prop, 0, "rna_Material_update");
01746         
01747         prop= RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE);
01748         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE_ALPHA);
01749         RNA_def_property_ui_text(prop, "Face Textures Alpha", "Replaces the object's base alpha value with alpha from face assigned image textures");
01750         RNA_def_property_update(prop, 0, "rna_Material_update");
01751         
01752         prop= RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE);
01753         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYCAST);
01754         RNA_def_property_ui_text(prop, "Cast Shadows Only", "Makes objects with this material appear invisible, only casting shadows (not rendered)");
01755         RNA_def_property_update(prop, 0, "rna_Material_update");
01756         
01757         prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
01758         RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", MA_NOMIST);
01759         RNA_def_property_ui_text(prop, "Use Mist", "Use mist with this material (in world settings)");
01760         RNA_def_property_update(prop, 0, "rna_Material_update");
01761         
01762         prop= RNA_def_property(srna, "use_transparent_shadows", PROP_BOOLEAN, PROP_NONE);
01763         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW_TRA);
01764         RNA_def_property_ui_text(prop, "Receive Transparent Shadows", "Allow this object to receive transparent shadows cast through other objects");
01765         RNA_def_property_update(prop, 0, "rna_Material_update");
01766         
01767         prop= RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE);
01768         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYBIAS);
01769         RNA_def_property_ui_text(prop, "Ray Shadow Bias", "Prevents raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)");
01770         RNA_def_property_update(prop, 0, "rna_Material_update");
01771         
01772         prop= RNA_def_property(srna, "use_full_oversampling", PROP_BOOLEAN, PROP_NONE);
01773         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FULL_OSA);
01774         RNA_def_property_ui_text(prop, "Full Oversampling", "Force this material to render full shading/textures for all anti-aliasing samples");
01775         RNA_def_property_update(prop, 0, "rna_Material_update");
01776 
01777         prop= RNA_def_property(srna, "use_cast_buffer_shadows", PROP_BOOLEAN, PROP_NONE);
01778         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADBUF);
01779         RNA_def_property_ui_text(prop, "Cast Buffer Shadows", "Allow this material to cast shadows from shadow buffer lamps");
01780         RNA_def_property_update(prop, 0, "rna_Material_update");
01781 
01782         prop= RNA_def_property(srna, "use_cast_approximate", PROP_BOOLEAN, PROP_NONE);
01783         RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_APPROX_OCCLUSION);
01784         RNA_def_property_ui_text(prop, "Cast Approximate", "Allow this material to cast shadows when using approximate ambient occlusion.");
01785         RNA_def_property_update(prop, 0, "rna_Material_update");
01786         
01787         prop= RNA_def_property(srna, "use_tangent_shading", PROP_BOOLEAN, PROP_NONE);
01788         RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_V);
01789         RNA_def_property_ui_text(prop, "Tangent Shading", "Use the material's tangent vector instead of the normal for shading - for anisotropic shading effects");
01790         RNA_def_property_update(prop, 0, "rna_Material_update");
01791         
01792         /* nested structs */
01793         prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NONE);
01794         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01795         RNA_def_property_struct_type(prop, "MaterialRaytraceMirror");
01796         RNA_def_property_pointer_funcs(prop, "rna_Material_mirror_get", NULL, NULL, NULL);
01797         RNA_def_property_ui_text(prop, "Raytrace Mirror", "Raytraced reflection settings for the material");
01798 
01799         prop= RNA_def_property(srna, "raytrace_transparency", PROP_POINTER, PROP_NONE);
01800         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01801         RNA_def_property_struct_type(prop, "MaterialRaytraceTransparency");
01802         RNA_def_property_pointer_funcs(prop, "rna_Material_transp_get", NULL, NULL, NULL);
01803         RNA_def_property_ui_text(prop, "Raytrace Transparency", "Raytraced transparency settings for the material");
01804 
01805         prop= RNA_def_property(srna, "volume", PROP_POINTER, PROP_NONE);
01806         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01807         RNA_def_property_pointer_sdna(prop, NULL, "vol");
01808         RNA_def_property_struct_type(prop, "MaterialVolume");
01809         RNA_def_property_ui_text(prop, "Volume", "Volume settings for the material");
01810 
01811         prop= RNA_def_property(srna, "halo", PROP_POINTER, PROP_NONE);
01812         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01813         RNA_def_property_struct_type(prop, "MaterialHalo");
01814         RNA_def_property_pointer_funcs(prop, "rna_Material_halo_get", NULL, NULL, NULL);
01815         RNA_def_property_ui_text(prop, "Halo", "Halo settings for the material");
01816 
01817         prop= RNA_def_property(srna, "subsurface_scattering", PROP_POINTER, PROP_NONE);
01818         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01819         RNA_def_property_struct_type(prop, "MaterialSubsurfaceScattering");
01820         RNA_def_property_pointer_funcs(prop, "rna_Material_sss_get", NULL, NULL, NULL);
01821         RNA_def_property_ui_text(prop, "Subsurface Scattering", "Subsurface scattering settings for the material");
01822 
01823         prop= RNA_def_property(srna, "strand", PROP_POINTER, PROP_NONE);
01824         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01825         RNA_def_property_struct_type(prop, "MaterialStrand");
01826         RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL, NULL, NULL);
01827         RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material");
01828         
01829         prop= RNA_def_property(srna, "physics", PROP_POINTER, PROP_NONE);
01830         RNA_def_property_flag(prop, PROP_NEVER_NULL);
01831         RNA_def_property_struct_type(prop, "MaterialPhysics");
01832         RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL);
01833         RNA_def_property_ui_text(prop, "Physics", "Game physics settings");
01834 
01835         /* nodetree */
01836         prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
01837         RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
01838         RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
01839 
01840         prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
01841         RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
01842         RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_nodes_set");
01843         RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
01844         RNA_def_property_update(prop, 0, "rna_Material_update");
01845 
01846         prop= RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE);
01847         RNA_def_property_struct_type(prop, "Material");
01848         RNA_def_property_flag(prop, PROP_EDITABLE);
01849         RNA_def_property_pointer_funcs(prop, "rna_Material_active_node_material_get", "rna_Material_active_node_material_set", NULL, NULL);
01850         RNA_def_property_ui_text(prop, "Material", "Active node material");
01851         RNA_def_property_update(prop, NC_MATERIAL, NULL);
01852 
01853         /* common */
01854         rna_def_animdata_common(srna);
01855         rna_def_mtex_common(brna, srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get",
01856                 "rna_Material_active_texture_set", "rna_Material_active_texture_editable",
01857                 "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update");
01858 
01859         /* only material has this one */
01860         prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
01861         RNA_def_property_boolean_negative_sdna(prop, NULL, "septex", 1);
01862         RNA_def_property_array(prop, 18);
01863         RNA_def_property_ui_text(prop, "Use Textures", "Enable/Disable each texture");
01864         RNA_def_property_update(prop, 0, "rna_Material_update");
01865 
01866         rna_def_material_colors(srna);
01867         rna_def_material_diffuse(srna);
01868         rna_def_material_specularity(srna);
01869 
01870         /* nested structs */
01871         rna_def_material_raymirror(brna);
01872         rna_def_material_raytra(brna);
01873         rna_def_material_volume(brna);
01874         rna_def_material_halo(brna);
01875         rna_def_material_sss(brna);
01876         rna_def_material_mtex(brna);
01877         rna_def_material_strand(brna);
01878         rna_def_material_physics(brna);
01879 
01880         RNA_api_material(srna);
01881 }
01882 
01883 
01884 static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
01885 {
01886         StructRNA *srna;
01887 
01888         FunctionRNA *func;
01889         PropertyRNA *parm;
01890 
01891         RNA_def_property_srna(cprop, structname_slots);
01892         srna= RNA_def_struct(brna, structname_slots, NULL);
01893         RNA_def_struct_sdna(srna, "ID");
01894         RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
01895 
01896         /* functions */
01897         func= RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
01898         RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
01899         parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
01900         RNA_def_function_return(func, parm);
01901         
01902         func= RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
01903         RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
01904         parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize.", 0, INT_MAX);
01905         RNA_def_property_flag(parm, PROP_REQUIRED);
01906         parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
01907         RNA_def_function_return(func, parm);
01908         
01909         func= RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
01910         RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
01911         parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear.", 0, INT_MAX);
01912         RNA_def_property_flag(parm, PROP_REQUIRED);
01913 }
01914 
01915 void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
01916         const char *activeget, const char *activeset, const char *activeeditable,
01917         const char *structname, const char *structname_slots, const char *update)
01918 {
01919         PropertyRNA *prop;
01920 
01921         /* mtex */
01922         prop= RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
01923         RNA_def_property_struct_type(prop, structname);
01924         RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0);
01925         RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures");
01926         rna_def_texture_slots(brna, prop, structname, structname_slots);
01927 
01928         prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
01929         RNA_def_property_struct_type(prop, "Texture");
01930         RNA_def_property_flag(prop, PROP_EDITABLE);
01931         if(activeeditable)
01932                 RNA_def_property_editable_func(prop, activeeditable);
01933         RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
01934         RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
01935         RNA_def_property_update(prop, 0, update);
01936 
01937         prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
01938         RNA_def_property_int_sdna(prop, NULL, "texact");
01939         RNA_def_property_range(prop, 0, MAX_MTEX-1);
01940         RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
01941         RNA_def_property_update(prop, 0, update);
01942 }
01943 
01944 #endif
01945 
01946