2008-11-30 22:48:43 +00:00
/**
* $ Id $
*
* * * * * * BEGIN GPL LICENSE BLOCK * * * * *
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*
* Contributor ( s ) : Blender Foundation ( 2008 ) .
*
* * * * * * END GPL LICENSE BLOCK * * * * *
*/
2009-01-05 04:10:59 +00:00
# include <float.h>
2008-11-30 22:48:43 +00:00
# include <stdlib.h>
# include "RNA_define.h"
# include "RNA_types.h"
# include "rna_internal.h"
2009-01-10 22:57:33 +00:00
# include "DNA_material_types.h"
# include "DNA_texture_types.h"
2008-11-30 22:48:43 +00:00
# include "DNA_world_types.h"
2009-06-07 11:12:35 +00:00
# include "WM_types.h"
2008-11-30 22:48:43 +00:00
# ifdef RNA_RUNTIME
2009-07-15 19:20:59 +00:00
# include "MEM_guardedalloc.h"
# include "BKE_texture.h"
2009-02-02 19:57:57 +00:00
static PointerRNA rna_World_ambient_occlusion_get ( PointerRNA * ptr )
2009-01-05 03:44:19 +00:00
{
2009-02-02 19:57:57 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_WorldAmbientOcclusion , ptr - > id . data ) ;
2009-01-05 03:44:19 +00:00
}
2009-02-02 19:57:57 +00:00
static PointerRNA rna_World_stars_get ( PointerRNA * ptr )
2009-01-10 22:57:33 +00:00
{
2009-02-02 19:57:57 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_WorldStarsSettings , ptr - > id . data ) ;
2009-01-10 22:57:33 +00:00
}
2009-02-02 19:57:57 +00:00
static PointerRNA rna_World_mist_get ( PointerRNA * ptr )
2009-01-10 22:57:33 +00:00
{
2009-02-02 19:57:57 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_WorldMistSettings , ptr - > id . data ) ;
2009-01-10 22:57:33 +00:00
}
static void rna_World_mtex_begin ( CollectionPropertyIterator * iter , PointerRNA * ptr )
{
World * wo = ( World * ) ptr - > data ;
2009-07-13 19:33:59 +00:00
rna_iterator_array_begin ( iter , ( void * ) wo - > mtex , sizeof ( MTex * ) , MAX_MTEX , 0 , NULL ) ;
2009-01-10 22:57:33 +00:00
}
2009-02-02 19:57:57 +00:00
static PointerRNA rna_World_active_texture_get ( PointerRNA * ptr )
2009-01-10 22:57:33 +00:00
{
World * wo = ( World * ) ptr - > data ;
2009-02-02 19:57:57 +00:00
return rna_pointer_inherit_refine ( ptr , & RNA_TextureSlot , wo - > mtex [ ( int ) wo - > texact ] ) ;
2009-01-10 22:57:33 +00:00
}
2009-07-15 19:20:59 +00:00
static void rna_World_active_texture_index_set ( PointerRNA * ptr , int value )
{
World * wo = ( World * ) ptr - > data ;
int act = wo - > texact ;
if ( value = = act | | value < 0 | | value > = MAX_MTEX )
return ;
/* auto create/free mtex on activate/deactive, so we can edit
* the texture pointer in the buttons UI . */
if ( wo - > mtex [ act ] & & ! wo - > mtex [ act ] - > tex ) {
MEM_freeN ( wo - > mtex [ act ] ) ;
wo - > mtex [ act ] = NULL ;
}
wo - > texact = value ;
if ( ! wo - > mtex [ value ] ) {
wo - > mtex [ value ] = add_mtex ( ) ;
wo - > mtex [ value ] - > texco = TEXCO_VIEW ;
}
}
2008-11-30 22:48:43 +00:00
# else
2009-01-10 22:57:33 +00:00
static void rna_def_world_mtex ( BlenderRNA * brna )
2009-01-05 03:44:19 +00:00
{
StructRNA * srna ;
PropertyRNA * prop ;
2009-01-10 22:57:33 +00:00
static EnumPropertyItem texco_items [ ] = {
2009-06-16 00:52:21 +00:00
{ TEXCO_VIEW , " VIEW " , 0 , " View " , " Uses view vector for the texture coordinates. " } ,
{ TEXCO_GLOB , " GLOBAL " , 0 , " Global " , " Uses global coordinates for the texture coordinates (interior mist). " } ,
{ TEXCO_ANGMAP , " ANGMAP " , 0 , " AngMap " , " Uses 360 degree angular coordinates, e.g. for spherical light probes. " } ,
{ TEXCO_H_SPHEREMAP , " SPHERE " , 0 , " Sphere " , " For 360 degree panorama sky, spherical mapped, only top half. " } ,
{ TEXCO_H_TUBEMAP , " TUBE " , 0 , " Tube " , " For 360 degree panorama sky, cylindrical mapped, only top half. " } ,
{ TEXCO_OBJECT , " OBJECT " , 0 , " Object " , " Uses linked object's coordinates for texture coordinates. " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-10 22:57:33 +00:00
srna = RNA_def_struct ( brna , " WorldTextureSlot " , " TextureSlot " ) ;
RNA_def_struct_sdna ( srna , " MTex " ) ;
RNA_def_struct_ui_text ( srna , " World Texture Slot " , " Texture slot for textures in a World datablock. " ) ;
/* map to */
2009-07-15 19:20:59 +00:00
prop = RNA_def_property ( srna , " map_blend " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " mapto " , WOMAP_BLEND ) ;
2009-07-15 19:20:59 +00:00
RNA_def_property_ui_text ( prop , " Blend " , " Affect the color progression of the background. " ) ;
2009-01-10 22:57:33 +00:00
2009-07-15 19:20:59 +00:00
prop = RNA_def_property ( srna , " map_horizon " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " mapto " , WOMAP_HORIZ ) ;
2009-07-15 19:20:59 +00:00
RNA_def_property_ui_text ( prop , " Horizon " , " Affect the color of the horizon. " ) ;
2009-01-10 22:57:33 +00:00
2009-07-15 19:20:59 +00:00
prop = RNA_def_property ( srna , " map_zenith_up " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " mapto " , WOMAP_ZENUP ) ;
2009-07-15 19:20:59 +00:00
RNA_def_property_ui_text ( prop , " Zenith Up " , " Affect the color of the zenith above. " ) ;
2009-01-10 22:57:33 +00:00
2009-07-15 19:20:59 +00:00
prop = RNA_def_property ( srna , " map_zenith_down " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " mapto " , WOMAP_ZENDOWN ) ;
2009-07-15 19:20:59 +00:00
RNA_def_property_ui_text ( prop , " Zenith Down " , " Affect the color of the zenith below. " ) ;
2009-01-10 22:57:33 +00:00
/* unused
2009-07-15 19:20:59 +00:00
prop = RNA_def_property ( srna , " map_mist " , PROP_BOOLEAN , PROP_NONE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_boolean_sdna ( prop , NULL , " mapto " , WOMAP_MIST ) ;
2009-07-15 19:20:59 +00:00
RNA_def_property_ui_text ( prop , " Mist " , " Causes the texture to affect the intensity of the mist. " ) ; */
2009-01-10 22:57:33 +00:00
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 , texco_items ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Texture Coordinates " , " Texture coordinates used to map the texture onto the background. " ) ;
2009-01-10 22:57:33 +00:00
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 " ) ;
2009-05-28 23:23:47 +00:00
RNA_def_property_flag ( prop , PROP_EDITABLE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Object " , " Object to use for mapping with Object texture coordinates. " ) ;
}
static void rna_def_ambient_occlusion ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
static EnumPropertyItem blend_mode_items [ ] = {
2009-06-16 00:52:21 +00:00
{ WO_AOADD , " ADD " , 0 , " Add " , " Add light and shadow. " } ,
{ WO_AOSUB , " SUBTRACT " , 0 , " Subtract " , " Subtract light and shadow (needs a normal light to make anything visible.) " } ,
{ WO_AOADDSUB , " BOTH " , 0 , " Both " , " Both lighten and darken. " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-05 03:44:19 +00:00
static EnumPropertyItem prop_color_items [ ] = {
2009-06-16 00:52:21 +00:00
{ WO_AOPLAIN , " PLAIN " , 0 , " White " , " Plain diffuse energy (white.) " } ,
{ WO_AOSKYCOL , " SKY_COLOR " , 0 , " Sky Color " , " Use horizon and zenith color for diffuse energy. " } ,
{ WO_AOSKYTEX , " SKY_TEXTURE " , 0 , " Sky Texture " , " Does full Sky texture render for diffuse energy. " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-05 03:44:19 +00:00
static EnumPropertyItem prop_sample_method_items [ ] = {
2009-06-16 00:52:21 +00:00
{ WO_AOSAMP_CONSTANT , " CONSTANT_JITTERED " , 0 , " Constant Jittered " , " " } ,
{ WO_AOSAMP_HALTON , " ADAPTIVE_QMC " , 0 , " Adaptive QMC " , " Fast in high-contrast areas. " } ,
{ WO_AOSAMP_HAMMERSLEY , " CONSTANT_QMC " , 0 , " Constant QMC " , " Best quality. " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-05 03:44:19 +00:00
static EnumPropertyItem prop_gather_method_items [ ] = {
2009-06-16 00:52:21 +00:00
{ WO_AOGATHER_RAYTRACE , " RAYTRACE " , 0 , " Raytrace " , " Accurate, but slow when noise-free results are required. " } ,
{ WO_AOGATHER_APPROX , " APPROXIMATE " , 0 , " Approximate " , " Inaccurate, but faster and without noise. " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-05 03:44:19 +00:00
srna = RNA_def_struct ( brna , " WorldAmbientOcclusion " , NULL ) ;
RNA_def_struct_sdna ( srna , " World " ) ;
2009-01-10 22:57:33 +00:00
RNA_def_struct_nested ( brna , srna , " World " ) ;
RNA_def_struct_ui_text ( srna , " Ambient Occlusion " , " Ambient occlusion settings for a World datablock. " ) ;
2009-01-05 03:44:19 +00:00
2009-01-05 04:10:59 +00:00
prop = RNA_def_property ( srna , " enabled " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " mode " , WO_AMB_OCC ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Enabled " , " Use Ambient Occlusion to add light based on distance between elements, creating the illusion of omnipresent light " ) ;
2009-01-05 04:10:59 +00:00
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " distance " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " aodist " ) ;
RNA_def_property_ui_text ( prop , " Distance " , " Length of rays, defines how far away other faces give occlusion effect. " ) ;
prop = RNA_def_property ( srna , " strength " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " aodistfac " ) ;
RNA_def_property_ui_text ( prop , " Strength " , " Distance attenuation factor, the higher, the 'shorter' the shadows. " ) ;
2009-06-16 01:51:51 +00:00
prop = RNA_def_property ( srna , " energy " , PROP_FLOAT , PROP_NONE ) ;
2009-01-05 03:44:19 +00:00
RNA_def_property_float_sdna ( prop , NULL , " aoenergy " ) ;
2009-05-20 13:56:22 +00:00
RNA_def_property_ui_range ( prop , 0 , 10 , 0.1 , 3 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Energy " , " Amount of enerygy generated by ambient occlusion. " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " bias " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " aobias " ) ;
RNA_def_property_range ( prop , 0 , 0.5 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Bias " , " Bias (in radians) to prevent smoothed faces from showing banding (for Raytrace Constant Jittered). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " threshold " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " ao_adapt_thresh " ) ;
RNA_def_property_range ( prop , 0 , 1 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Threshold " , " Samples below this threshold will be considered fully shadowed/unshadowed and skipped (for Raytrace Adaptive QMC). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " adapt_to_speed " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " ao_adapt_speed_fac " ) ;
RNA_def_property_range ( prop , 0 , 1 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Adapt To Speed " , " Use the speed vector pass to reduce AO samples in fast moving pixels. Higher values result in more aggressive sample reduction. Requires Vec pass enabled (for Raytrace Adaptive QMC). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " error_tolerance " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " ao_approx_error " ) ;
2009-04-12 17:28:41 +00:00
RNA_def_property_range ( prop , 0.0001 , 10 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Error Tolerance " , " Low values are slower and higher quality (for Approximate). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " correction " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " ao_approx_correction " ) ;
RNA_def_property_range ( prop , 0 , 1 ) ;
2009-05-20 13:56:22 +00:00
RNA_def_property_ui_range ( prop , 0 , 1 , 0.1 , 2 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Correction " , " Ad-hoc correction for over-occlusion due to the approximation (for Approximate). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " falloff " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " aomode " , WO_AODIST ) ;
RNA_def_property_ui_text ( prop , " Falloff " , " " ) ;
prop = RNA_def_property ( srna , " pixel_cache " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " aomode " , WO_AOCACHE ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Pixel Cache " , " Cache AO results in pixels and interpolate over neighbouring pixels for speedup (for Approximate). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " samples " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " aosamp " ) ;
2009-04-12 17:28:41 +00:00
RNA_def_property_range ( prop , 1 , 32 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Samples " , " Amount of ray samples. Higher values give smoother results and longer rendering times " ) ;
2009-01-05 03:44:19 +00:00
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " blend_mode " , PROP_ENUM , PROP_NONE ) ;
2009-01-05 03:44:19 +00:00
RNA_def_property_enum_sdna ( prop , NULL , " aomix " ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_enum_items ( prop , blend_mode_items ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Blend Mode " , " Defines how AO mixes with material shading. " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " color " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " aocolor " ) ;
RNA_def_property_enum_items ( prop , prop_color_items ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Color " , " Defines the color of the AO light " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " sample_method " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " ao_samp_method " ) ;
RNA_def_property_enum_items ( prop , prop_sample_method_items ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Sample Method " , " Method for generating shadow samples (for Raytrace). " ) ;
2009-01-05 03:44:19 +00:00
prop = RNA_def_property ( srna , " gather_method " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " ao_gather_method " ) ;
RNA_def_property_enum_items ( prop , prop_gather_method_items ) ;
RNA_def_property_ui_text ( prop , " Gather Method " , " " ) ;
prop = RNA_def_property ( srna , " passes " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " ao_approx_passes " ) ;
RNA_def_property_range ( prop , 0 , 10 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Passes " , " Number of preprocessing passes to reduce overocclusion (for Approximate). " ) ;
}
static void rna_def_world_mist ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
2009-04-24 11:36:48 +00:00
static EnumPropertyItem falloff_items [ ] = {
2009-06-16 00:52:21 +00:00
{ 0 , " QUADRATIC " , 0 , " Quadratic " , " Mist uses quadratic progression. " } ,
{ 1 , " LINEAR " , 0 , " Linear " , " Mist uses linear progression. " } ,
{ 2 , " INVERSE_QUADRATIC " , 0 , " Inverse Quadratic " , " Mist uses inverse quadratic progression. " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-10 22:57:33 +00:00
srna = RNA_def_struct ( brna , " WorldMistSettings " , NULL ) ;
RNA_def_struct_sdna ( srna , " World " ) ;
RNA_def_struct_nested ( brna , srna , " World " ) ;
2009-03-28 11:44:07 +00:00
RNA_def_struct_ui_text ( srna , " World Mist " , " Mist settings for a World data-block. " ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " enabled " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " mode " , WO_MIST ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Enabled " , " Occlude objects with the environment color as they are further away. " ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " intensity " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " misi " ) ;
RNA_def_property_range ( prop , 0 , 1 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Intensity " , " Intensity of the mist effect. " ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " start " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " miststa " ) ;
RNA_def_property_range ( prop , 0 , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , 0 , 10000 , 10 , 2 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Start " , " Starting distance of the mist, measured from the camera " ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " depth " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " mistdist " ) ;
RNA_def_property_range ( prop , 0 , FLT_MAX ) ;
RNA_def_property_ui_range ( prop , 0 , 10000 , 10 , 2 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Depth " , " The distance over which the mist effect fades in " ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " height " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " misthi " ) ;
RNA_def_property_range ( prop , 0 , 100 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Height " , " Control how much mist density decreases with height " ) ;
2009-04-24 11:36:48 +00:00
prop = RNA_def_property ( srna , " falloff " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " mistype " ) ;
RNA_def_property_enum_items ( prop , falloff_items ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Falloff " , " Type of transition used to fade mist " ) ;
2009-01-10 22:57:33 +00:00
}
static void rna_def_world_stars ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
srna = RNA_def_struct ( brna , " WorldStarsSettings " , NULL ) ;
RNA_def_struct_sdna ( srna , " World " ) ;
RNA_def_struct_nested ( brna , srna , " World " ) ;
2009-03-28 11:44:07 +00:00
RNA_def_struct_ui_text ( srna , " World Stars " , " Stars setting for a World data-block. " ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " enabled " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " mode " , WO_STARS ) ;
RNA_def_property_ui_text ( prop , " Enabled " , " Enable starfield generation. " ) ;
2009-06-07 13:35:39 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " size " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " starsize " ) ;
RNA_def_property_range ( prop , 0 , 10 ) ;
RNA_def_property_ui_text ( prop , " Size " , " Average screen dimension of stars. " ) ;
2009-06-07 13:35:39 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " min_distance " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " starmindist " ) ;
RNA_def_property_range ( prop , 0 , 1000 ) ;
RNA_def_property_ui_text ( prop , " Minimum Distance " , " Minimum distance to the camera for stars. " ) ;
2009-06-07 13:35:39 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " average_separation " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " stardist " ) ;
RNA_def_property_range ( prop , 2 , 1000 ) ;
RNA_def_property_ui_text ( prop , " Average Separation " , " Average distance between any two stars. " ) ;
2009-06-07 13:35:39 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " color_randomization " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " starcolnoise " ) ;
RNA_def_property_range ( prop , 0 , 1 ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Color Randomization " , " Randomize star colors. " ) ;
2009-06-07 13:35:39 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2009-04-24 11:36:48 +00:00
2009-01-10 22:57:33 +00:00
/* unused
prop = RNA_def_property ( srna , " color " , PROP_FLOAT , PROP_COLOR ) ;
RNA_def_property_float_sdna ( prop , NULL , " starr " ) ;
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_ui_text ( prop , " Color " , " Stars color. " ) ; */
2009-01-05 03:44:19 +00:00
}
2008-11-30 22:48:43 +00:00
void RNA_def_world ( BlenderRNA * brna )
{
StructRNA * srna ;
PropertyRNA * prop ;
2009-01-10 22:57:33 +00:00
static EnumPropertyItem physics_engine_items [ ] = {
2009-06-16 00:52:21 +00:00
{ WOPHY_NONE , " NONE " , 0 , " None " , " " } ,
//{WOPHY_ENJI, "ENJI", 0, "Enji", ""},
2009-06-21 16:18:38 +00:00
//{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""},
2009-06-16 00:52:21 +00:00
//{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""},
//{WOPHY_ODE, "ODE", 0, "ODE", ""},
{ WOPHY_BULLET , " BULLET " , 0 , " Bullet " , " " } ,
{ 0 , NULL , 0 , NULL , NULL } } ;
2009-01-10 22:57:33 +00:00
2008-12-19 04:06:24 +00:00
srna = RNA_def_struct ( brna , " World " , " ID " ) ;
2009-01-10 22:57:33 +00:00
RNA_def_struct_ui_text ( srna , " World " , " World datablock describing the environment and ambient lighting of a scene. " ) ;
2009-06-03 23:16:51 +00:00
RNA_def_struct_ui_icon ( srna , ICON_WORLD_DATA ) ;
2008-11-30 22:48:43 +00:00
2009-02-02 11:51:10 +00:00
rna_def_animdata_common ( srna ) ;
2009-07-15 19:20:59 +00:00
rna_def_mtex_common ( srna , " rna_World_mtex_begin " , " rna_World_active_texture_get " , " rna_World_active_texture_index_set " , " WorldTextureSlot " ) ;
2008-11-30 22:48:43 +00:00
2008-12-02 23:45:11 +00:00
/* colors */
prop = RNA_def_property ( srna , " horizon_color " , PROP_FLOAT , PROP_COLOR ) ;
2008-11-30 22:48:43 +00:00
RNA_def_property_float_sdna ( prop , NULL , " horr " ) ;
2008-12-02 23:45:11 +00:00
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_ui_text ( prop , " Horizon Color " , " Color at the horizon. " ) ;
2009-06-07 11:12:35 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2008-12-02 23:45:11 +00:00
prop = RNA_def_property ( srna , " zenith_color " , PROP_FLOAT , PROP_COLOR ) ;
RNA_def_property_float_sdna ( prop , NULL , " zenr " ) ;
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_ui_text ( prop , " Zenith Color " , " Color at the zenith. " ) ;
2009-06-07 11:12:35 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2008-11-30 22:48:43 +00:00
2008-12-02 23:45:11 +00:00
prop = RNA_def_property ( srna , " ambient_color " , PROP_FLOAT , PROP_COLOR ) ;
RNA_def_property_float_sdna ( prop , NULL , " ambr " ) ;
RNA_def_property_array ( prop , 3 ) ;
RNA_def_property_ui_text ( prop , " Ambient Color " , " " ) ;
2008-11-30 22:48:43 +00:00
/* exp, range */
prop = RNA_def_property ( srna , " exposure " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " exp " ) ;
RNA_def_property_range ( prop , 0.0 , 1.0 ) ;
RNA_def_property_ui_text ( prop , " Exposure " , " Amount of exponential color correction for light. " ) ;
prop = RNA_def_property ( srna , " range " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " range " ) ;
RNA_def_property_range ( prop , 0.2 , 5.0 ) ;
2009-07-08 15:34:41 +00:00
RNA_def_property_ui_text ( prop , " Range " , " The color range that will be mapped to 0-1. " ) ;
2008-11-30 22:48:43 +00:00
/* sky type */
prop = RNA_def_property ( srna , " blend_sky " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " skytype " , WO_SKYBLEND ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Blend Sky " , " Render background with natural progression from horizon to zenith. " ) ;
2009-06-07 11:12:35 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2008-11-30 22:48:43 +00:00
prop = RNA_def_property ( srna , " paper_sky " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " skytype " , WO_SKYPAPER ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Paper Sky " , " Flatten blend or texture coordinates. " ) ;
2009-06-07 13:35:39 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2008-11-30 22:48:43 +00:00
prop = RNA_def_property ( srna , " real_sky " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " skytype " , WO_SKYREAL ) ;
2009-06-11 18:19:08 +00:00
RNA_def_property_ui_text ( prop , " Real Sky " , " Render background with a real horizon, relative to the camera angle. " ) ;
2009-06-07 11:12:35 +00:00
RNA_def_property_update ( prop , NC_WORLD , NULL ) ;
2009-01-05 04:10:59 +00:00
2009-07-20 16:21:55 +00:00
/* game settings */
/* should go in a fake substruct however not sure if they move about */
prop = RNA_def_property ( srna , " game_fps " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " ticrate " ) ;
RNA_def_property_range ( prop , 1 , 120 ) ;
RNA_def_property_ui_text ( prop , " Frames Per Second " , " The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate. " ) ;
prop = RNA_def_property ( srna , " game_logic_step_max " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " maxlogicstep " ) ;
RNA_def_property_range ( prop , 1 , 5 ) ;
RNA_def_property_ui_text ( prop , " Max Logic Steps " , " The maxmimum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics. " ) ;
prop = RNA_def_property ( srna , " game_physics_substep " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " physubstep " ) ;
RNA_def_property_range ( prop , 1 , 5 ) ;
RNA_def_property_ui_text ( prop , " Physics Sub Steps " , " The maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime. " ) ;
prop = RNA_def_property ( srna , " game_physics_step_max " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " maxphystep " ) ;
RNA_def_property_range ( prop , 1 , 5 ) ;
RNA_def_property_ui_text ( prop , " Max Physics Steps " , " The number of simulation substep per physic timestep, higher value give better physics precision. " ) ;
prop = RNA_def_property ( srna , " game_use_occlusion_culling " , PROP_BOOLEAN , PROP_NONE ) ;
RNA_def_property_boolean_sdna ( prop , NULL , " mode " , WO_DBVT_CULLING ) ;
RNA_def_property_ui_text ( prop , " Enabled " , " Use optimized Bullet DBVT tree for view frustrum and occlusion culling " ) ;
prop = RNA_def_property ( srna , " game_occlusion_culling_resolution " , PROP_INT , PROP_NONE ) ;
RNA_def_property_int_sdna ( prop , NULL , " occlusionRes " ) ;
RNA_def_property_range ( prop , 128 , 1024 ) ;
RNA_def_property_ui_text ( prop , " Occlusion Resolution " , " The size of the occlusion buffer in pixel, use higher value for better precsion (slower). " ) ;
2009-01-10 22:57:33 +00:00
/* physics */
prop = RNA_def_property ( srna , " physics_engine " , PROP_ENUM , PROP_NONE ) ;
RNA_def_property_enum_sdna ( prop , NULL , " physicsEngine " ) ;
RNA_def_property_enum_items ( prop , physics_engine_items ) ;
RNA_def_property_ui_text ( prop , " Physics Engine " , " Physics engine used for physics simulation in the game engine. " ) ;
2009-01-05 04:10:59 +00:00
2009-01-10 22:57:33 +00:00
prop = RNA_def_property ( srna , " physics_gravity " , PROP_FLOAT , PROP_NONE ) ;
RNA_def_property_float_sdna ( prop , NULL , " gravity " ) ;
2009-04-12 17:28:41 +00:00
RNA_def_property_range ( prop , 0.0 , 25.0 ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Physics Gravity " , " Gravitational constant used for physics simulation in the game engine. " ) ;
2009-01-05 04:10:59 +00:00
2009-01-10 22:57:33 +00:00
/* nested structs */
prop = RNA_def_property ( srna , " ambient_occlusion " , PROP_POINTER , PROP_NEVER_NULL ) ;
RNA_def_property_struct_type ( prop , " WorldAmbientOcclusion " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_World_ambient_occlusion_get " , NULL , NULL ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Ambient Occlusion " , " World ambient occlusion settings. " ) ;
prop = RNA_def_property ( srna , " mist " , PROP_POINTER , PROP_NEVER_NULL ) ;
RNA_def_property_struct_type ( prop , " WorldMistSettings " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_World_mist_get " , NULL , NULL ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Mist " , " World mist settings. " ) ;
prop = RNA_def_property ( srna , " stars " , PROP_POINTER , PROP_NEVER_NULL ) ;
RNA_def_property_struct_type ( prop , " WorldStarsSettings " ) ;
2009-06-07 13:09:18 +00:00
RNA_def_property_pointer_funcs ( prop , " rna_World_stars_get " , NULL , NULL ) ;
2009-01-10 22:57:33 +00:00
RNA_def_property_ui_text ( prop , " Stars " , " World stars settings. " ) ;
prop = RNA_def_property ( srna , " script_link " , PROP_POINTER , PROP_NEVER_NULL ) ;
RNA_def_property_pointer_sdna ( prop , NULL , " scriptlink " ) ;
RNA_def_property_ui_text ( prop , " Script Link " , " Scripts linked to this object. " ) ;
rna_def_ambient_occlusion ( brna ) ;
rna_def_world_mist ( brna ) ;
rna_def_world_stars ( brna ) ;
rna_def_world_mtex ( brna ) ;
2008-11-30 22:48:43 +00:00
}
# endif