diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 342 |
1 files changed, 305 insertions, 37 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 93d6b0283bd..44098e96547 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -35,6 +35,20 @@ #include "WM_types.h" +static EnumPropertyItem prop_texture_coordinates_items[] = { +{TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates."}, +{TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates."}, +{TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates."}, +{TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object."}, +{TEXCO_STRAND, "STRAND", 0, "Strand", "Uses normalized strand texture coordinate (1D)."}, +{TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates."}, +{TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates."}, +{TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates."}, +{TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates."}, +{TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh."}, +{TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates."}, +{0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" @@ -207,6 +221,42 @@ void rna_Material_use_nodes_set(PointerRNA *ptr, int value) ED_node_shader_default(ma); } +static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + Material *ma= (Material*)ptr->id.data; + EnumPropertyItem *item= NULL; + int totitem= 0; + + if(C==NULL) { + return prop_texture_coordinates_items; + } + + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_GLOB); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_OBJECT); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_ORCO); + + if(ma->material_type == MA_TYPE_VOLUME) { + + } + else if (ELEM3(ma->material_type, MA_TYPE_SURFACE, MA_TYPE_HALO, MA_TYPE_WIRE)) { + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_UV); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STRAND); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STICKY); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_WINDOW); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_NORM); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_REFL); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_STRESS); + RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_TANGENT); + } + + RNA_enum_item_end(&item, &totitem); + + *free= 1; + + return item; +} + + #else static void rna_def_material_mtex(BlenderRNA *brna) @@ -214,21 +264,6 @@ static void rna_def_material_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_texture_coordinates_items[] = { - {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates."}, - {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates."}, - {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates."}, - {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object."}, - {TEXCO_STRAND, "STRAND", 0, "Strand", "Uses normalized strand texture coordinate (1D)."}, - {TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates."}, - {TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates."}, - {TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates."}, - {TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates."}, - {TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh."}, - {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates."}, - - {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem prop_mapping_items[] = { {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly."}, {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector."}, @@ -271,9 +306,10 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_coordinates", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "texco"); RNA_def_property_enum_items(prop, prop_texture_coordinates_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Material_texture_coordinates_itemf"); RNA_def_property_ui_text(prop, "Texture Coordinates", ""); RNA_def_property_update(prop, NC_TEXTURE, NULL); - + prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); RNA_def_property_struct_type(prop, "Object"); @@ -479,6 +515,75 @@ static void rna_def_material_mtex(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient."); RNA_def_property_update(prop, NC_TEXTURE, NULL); + /* volume material */ + prop= RNA_def_property(srna, "map_coloremission", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMISSION_COL); + RNA_def_property_ui_text(prop, "Emission Color", "Causes the texture to affect the colour of emission"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "map_colorabsorption", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ABSORPTION_COL); + RNA_def_property_ui_text(prop, "Absorption Color", "Causes the texture to affect the result colour after absorption"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "map_density", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DENSITY); + RNA_def_property_ui_text(prop, "Density", "Causes the texture to affect the volume's density"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "map_emission", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMISSION); + RNA_def_property_ui_text(prop, "Emission", "Causes the texture to affect the volume's emission"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "map_absorption", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ABSORPTION); + RNA_def_property_ui_text(prop, "Absorption", "Causes the texture to affect the volume's absorption"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "map_scattering", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SCATTERING); + RNA_def_property_ui_text(prop, "Scattering", "Causes the texture to affect the volume's scattering"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "coloremission_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Emission Color Factor", "Amount texture affects emission color."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "colorabsorption_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Absorpion Color Factor", "Amount texture affects diffuse color."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects density."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "emission_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Emission Factor", "Amount texture affects emission."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "absorption_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Absorption Factor", "Amount texture affects absorption."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "scattering_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Scattering Factor", "Amount texture affects scattering."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + /* end volume material */ + prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_MaterialTextureSlot_enabled_get", "rna_MaterialTextureSlot_enabled_set"); RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot."); @@ -511,6 +616,8 @@ static void rna_def_material_colors(StructRNA *srna) {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""}, {MA_RAMP_VAL, "VALUE", 0, "Value", ""}, {MA_RAMP_COLOR, "COLOR", 0, "Color", ""}, + {MA_RAMP_SOFT, "SOFT LIGHT", 0, "Soft Light", ""}, + {MA_RAMP_LINEAR, "LINEAR LIGHT", 0, "Linear Light", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_ramp_input_items[] = { @@ -616,10 +723,10 @@ static void rna_def_material_diffuse(StructRNA *srna) RNA_def_property_ui_text(prop, "Diffuse Shader Model", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "diffuse_reflection", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "diffuse_intensity", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "ref"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Diffuse Reflection", "Amount of diffuse reflection."); + RNA_def_property_ui_text(prop, "Diffuse Intensity", "Amount of diffuse reflection."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); prop= RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_NONE); @@ -677,10 +784,10 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Enabled", "Enable raytraced reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "reflect", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "ray_mirror"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Reflect", "Sets the amount mirror reflection for raytrace."); + RNA_def_property_ui_text(prop, "Reflectivity", "Sets the amount mirror reflection for raytrace."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE); @@ -695,10 +802,10 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "gloss_mir"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Gloss", "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections."); + RNA_def_property_ui_text(prop, "Gloss Amount", "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_PERCENTAGE); @@ -766,10 +873,10 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "gloss_tra"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Gloss", "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions."); + RNA_def_property_ui_text(prop, "Gloss Amount", "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE); @@ -809,6 +916,159 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); } +static void rna_def_material_volume(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_scattering_items[] = { + {MA_VOL_SHADE_NONE, "NONE", 0, "None", ""}, + {MA_VOL_SHADE_SINGLE, "SINGLE_SCATTERING", 0, "Single Scattering", ""}, + {MA_VOL_SHADE_MULTIPLE, "MULTIPLE_SCATTERING", 0, "Multiple Scattering", ""}, + {MA_VOL_SHADE_SINGLEPLUSMULTIPLE, "SINGLE_PLUS_MULTIPLE_SCATTERING", 0, "Single + Multiple Scattering", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_stepsize_items[] = { + {MA_VOL_STEP_RANDOMIZED, "RANDOMIZED", 0, "Randomized", ""}, + {MA_VOL_STEP_CONSTANT, "CONSTANT", 0, "Constant", ""}, + //{MA_VOL_STEP_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_phasefunction_items[] = { + {MA_VOL_PH_ISOTROPIC, "ISOTROPIC", 0, "Isotropic", ""}, + {MA_VOL_PH_MIEHAZY, "MIE_HAZY", 0, "Mie Hazy", ""}, + {MA_VOL_PH_MIEMURKY, "MIE_MURKY", 0, "Mie Murky", ""}, + {MA_VOL_PH_RAYLEIGH, "RAYLEIGH", 0, "Rayleigh", ""}, + {MA_VOL_PH_HG, "HENYEY-GREENSTEIN", 0, "Henyey-Greenstein", ""}, + {MA_VOL_PH_SCHLICK, "SCHLICK", 0, "Schlick", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaterialVolume", NULL); + RNA_def_struct_sdna(srna, "VolumeSettings"); + RNA_def_struct_nested(brna, srna, "Material"); + RNA_def_struct_ui_text(srna, "Material Volume", "Volume rendering settings for a Material datablock."); + + prop= RNA_def_property(srna, "step_calculation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "stepsize_type"); + RNA_def_property_enum_items(prop, prop_stepsize_items); + RNA_def_property_ui_text(prop, "Step Calculation", "Method of calculating the steps through the volume"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "step_size", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "stepsize"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3); + RNA_def_property_ui_text(prop, "Step Size", "Distance between subsequent volume depth samples."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "shading_step_size", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "shade_stepsize"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3); + RNA_def_property_ui_text(prop, "Shading Step Size", "Distance between subsequent volume shading samples."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "scattering_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shade_type"); + RNA_def_property_enum_items(prop, prop_scattering_items); + RNA_def_property_ui_text(prop, "Scattering Mode", "Method of shading, attenuating, and scattering light through the volume"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "light_cache", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "shadeflag", MA_VOL_PRECACHESHADING); /* use bitflags */ + RNA_def_property_ui_text(prop, "Light Cache", "Pre-calculate the shading information into a voxel grid, speeds up shading at slightly less accuracy"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "cache_resolution", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "precache_resolution"); + RNA_def_property_range(prop, 0, 1024); + RNA_def_property_ui_text(prop, "Resolution", "Resolution of the voxel grid, low resolutions are faster, high resolutions use more memory."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "ms_diffusion", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ms_diff"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_text(prop, "Diffusion", "Diffusion factor, the strength of the blurring effect"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "ms_spread", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "ms_steps"); + RNA_def_property_range(prop, 0, 1024); + RNA_def_property_ui_text(prop, "Spread", "Simulation steps, the effective distance over which the light is diffused"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "ms_intensity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ms_intensity"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_text(prop, "Intensity", "Multiplier for multiple scattered light energy"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "depth_cutoff", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "depth_cutoff"); + RNA_def_property_range(prop, 0.0f, 1.0f); + 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."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "density", PROP_FLOAT, PROP_PERCENTAGE); + RNA_def_property_float_sdna(prop, NULL, "density"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Density", "The base density of the volume"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "density_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "density_scale"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Density Scale", "Multiplier for the material's density"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "absorption"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Absorption", "Amount of light that gets absorbed by the volume - higher values mean light travels less distance"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "absorption_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "absorption_col"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Absorption Color", ""); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + prop= RNA_def_property(srna, "scattering", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "scattering"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1 ,3); + RNA_def_property_ui_text(prop, "Scattering", "Amount of light that gets scattered by the volume - values > 1.0 are non-physical"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "emission", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "emission"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Emission", "Amount of light that gets emitted by the volume"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "emission_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "emission_col"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Emission Color", ""); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + prop= RNA_def_property(srna, "phase_function", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "phasefunc_type"); + RNA_def_property_enum_items(prop, prop_phasefunction_items); + RNA_def_property_ui_text(prop, "Phase Function", "Isotropic/Anisotropic scattering"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "asymmetry", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "phasefunc_g"); + RNA_def_property_range(prop, -1.0f, 1.0f); + RNA_def_property_ui_text(prop, "Asymmetry", "Continuum between forward scattering and back scattering"); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); +} + + static void rna_def_material_halo(BlenderRNA *brna) { StructRNA *srna; @@ -911,14 +1171,14 @@ static void rna_def_material_halo(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Star", "Renders halo as a star."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOTEX); - RNA_def_property_ui_text(prop, "Use Texture", "Gives halo a texture."); + RNA_def_property_ui_text(prop, "Texture", "Gives halo a texture."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "use_vertex_normal", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "vertex_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOPUNO); - RNA_def_property_ui_text(prop, "Use Vertex Normal", "Uses the vertex normal to specify the dimension of the halo."); + RNA_def_property_ui_text(prop, "Vertex Normal", "Uses the vertex normal to specify the dimension of the halo."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "xalpha", PROP_BOOLEAN, PROP_NONE); @@ -1025,10 +1285,10 @@ void rna_def_material_specularity(StructRNA *srna) RNA_def_property_ui_text(prop, "Specular Shader Model", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "specular_reflection", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "spec"); RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Specularity Intensity", ""); + RNA_def_property_ui_text(prop, "Specular Intensity", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); /* NOTE: "har", "param", etc are used for multiple purposes depending on @@ -1098,16 +1358,16 @@ void rna_def_material_strand(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Blender Units", "Use Blender units for widths instead of pixels."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "start_size", PROP_FLOAT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "root_size", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "strand_sta"); RNA_def_property_float_funcs(prop, NULL, NULL, "rna_MaterialStrand_start_size_range"); - RNA_def_property_ui_text(prop, "Start Size", "Start size of strands in pixels Blender units."); + RNA_def_property_ui_text(prop, "Root Size", "Start size of strands in pixels Blender units."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "end_size", PROP_FLOAT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "tip_size", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "strand_end"); RNA_def_property_float_funcs(prop, NULL, NULL, "rna_MaterialStrand_end_size_range"); - RNA_def_property_ui_text(prop, "End Size", "Start size of strands in pixels or Blender units."); + RNA_def_property_ui_text(prop, "Tip Size", "Start size of strands in pixels or Blender units."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "min_size", PROP_FLOAT, PROP_UNSIGNED); @@ -1182,7 +1442,7 @@ void RNA_def_material(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface."}, {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)."}, - // {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."}, + {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."}, {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles."}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem transparency_items[] = { @@ -1329,9 +1589,9 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Exclude Mist", "Excludes this material from mist effects (in world settings)"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "transparent_shadows", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "receive_transparent_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW_TRA); - RNA_def_property_ui_text(prop, "Transparent Shadows", "Allow this object to receive transparent shadows casted through other objects"); + RNA_def_property_ui_text(prop, "Receive Transparent Shadows", "Allow this object to receive transparent shadows casted through other objects"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "ray_shadow_bias", PROP_BOOLEAN, PROP_NONE); @@ -1365,6 +1625,11 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_Material_transp_get", NULL, NULL); RNA_def_property_ui_text(prop, "Raytrace Transparency", "Raytraced reflection settings for the material."); + prop= RNA_def_property(srna, "volume", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "vol"); + RNA_def_property_struct_type(prop, "MaterialVolume"); + RNA_def_property_ui_text(prop, "Volume", "Volume settings for the material."); + prop= RNA_def_property(srna, "halo", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialHalo"); RNA_def_property_pointer_funcs(prop, "rna_Material_halo_get", NULL, NULL); @@ -1408,6 +1673,7 @@ void RNA_def_material(BlenderRNA *brna) /* nested structs */ rna_def_material_raymirror(brna); rna_def_material_raytra(brna); + rna_def_material_volume(brna); rna_def_material_halo(brna); rna_def_material_sss(brna); rna_def_material_mtex(brna); @@ -1432,11 +1698,13 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL); RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed."); + RNA_def_property_update(prop, NC_TEXTURE|ND_SHADING_DRAW, NULL); prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "texact"); RNA_def_property_range(prop, 0, MAX_MTEX-1); RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot."); + RNA_def_property_update(prop, NC_TEXTURE|ND_SHADING_DRAW, NULL); } #endif |