diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_lamp.c | 21 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 402 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree_types.h | 42 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 167 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 21 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 80 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 20 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 22 |
17 files changed, 796 insertions, 42 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 194c3e8d18e..71b34d31e96 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -326,12 +326,6 @@ int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assig } } -void rna_Library_filepath_set(PointerRNA *ptr, const char *value) -{ - Library *lib= (Library*)ptr->data; - BKE_library_filepath_set(lib, value); -} - #else static void rna_def_ID_properties(BlenderRNA *brna) @@ -486,6 +480,16 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); RNA_def_property_ui_text(prop, "Tag", "Tools can use this to tag data (initial state is undefined)"); + prop= RNA_def_property(srna, "recalc", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Recalc", "Datablock is tagged for recalculation"); + + prop= RNA_def_property(srna, "recalc_data", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC_DATA); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Recalc Data", "Datablock data is tagged for recalculation"); + prop= RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "lib"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -527,7 +531,7 @@ static void rna_def_library(BlenderRNA *brna) prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file"); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set"); + /* TODO - lib->filename isnt updated, however the outliner also skips this, probably only needed on read. */ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Library"); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index c651dca4b31..08a71e0cd4f 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -621,7 +621,7 @@ static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTri static void rna_fcurve_range(FCurve *fcu, float range[2]) { - calc_fcurve_range(fcu, range, range+1, FALSE, FALSE); + calc_fcurve_range(fcu, range, range+1, FALSE); } #else diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 572559546c8..629711fcf96 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -46,6 +46,7 @@ #include "BKE_main.h" #include "BKE_texture.h" +#include "ED_node.h" #include "WM_api.h" #include "WM_types.h" @@ -145,6 +146,15 @@ static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value) la->spotsize= RAD2DEGF(value); } +static void rna_Lamp_use_nodes_update(Main *blain, Scene *scene, PointerRNA *ptr) +{ + Lamp *la= (Lamp*)ptr->data; + + if(la->use_nodes && la->nodetree==NULL) + ED_node_shader_default(scene, &la->id); + + rna_Lamp_update(blain, scene, ptr); +} #else @@ -366,6 +376,17 @@ static void rna_def_lamp(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_DIFF); RNA_def_property_ui_text(prop, "Diffuse", "Lamp does diffuse shading"); RNA_def_property_update(prop, 0, "rna_Lamp_update"); + + /* nodes */ + prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); + RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lamps"); + + prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the lamp"); + RNA_def_property_update(prop, 0, "rna_Lamp_use_nodes_update"); /* common */ rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 3f7cdf8d204..6e5b7d68ea9 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -62,6 +62,7 @@ #include "BKE_particle.h" #include "BKE_font.h" #include "BKE_node.h" +#include "BKE_depsgraph.h" #include "BKE_speaker.h" #include "DNA_armature_types.h" @@ -548,6 +549,8 @@ void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); } void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); } +static int rna_Main_objects_recalc_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB); } + #else void RNA_api_main(StructRNA *srna) @@ -630,6 +633,7 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; + PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataObjects"); srna= RNA_def_struct(brna, "BlendDataObjects", NULL); @@ -657,6 +661,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "tag", "rna_Main_objects_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); + + prop= RNA_def_property(srna, "recalc", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Main_objects_recalc_get", NULL); } void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 990d3b89bce..57770be57eb 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -269,13 +269,14 @@ static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value) ma->ramp_spec= add_colorband(0); } -static void rna_Material_use_nodes_set(PointerRNA *ptr, int value) +static void rna_Material_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Material *ma= (Material*)ptr->data; - ma->use_nodes= value; if(ma->use_nodes && ma->nodetree==NULL) - ED_node_shader_default(ma); + ED_node_shader_default(scene, &ma->id); + + rna_Material_update(bmain, scene, ptr); } static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, @@ -1954,9 +1955,9 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material"); - RNA_def_property_update(prop, 0, "rna_Material_update"); + RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update"); prop= RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Material"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 96c23effdfb..55432511730 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -56,7 +56,7 @@ #include "MEM_guardedalloc.h" EnumPropertyItem nodetree_type_items[] = { - {NTREE_SHADER, "MATERIAL", ICON_MATERIAL, "Material", "Material nodes" }, + {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes" }, {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes" }, {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes" }, {0, NULL, 0, NULL, NULL} @@ -108,6 +108,27 @@ EnumPropertyItem node_filter_items[] = { {6, "SHADOW", 0, "Shadow", ""}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem prop_noise_basis_items[] = { + {SHD_NOISE_PERLIN, "PERLIN", 0, "Perlin", ""}, + {SHD_NOISE_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1", ""}, + {SHD_NOISE_VORONOI_F2, "VORONOI_F2", 0, "Voronoi F2", ""}, + {SHD_NOISE_VORONOI_F3, "VORONOI_F3", 0, "Voronoi F3", ""}, + {SHD_NOISE_VORONOI_F4, "VORONOI_F4", 0, "Voronoi F4", ""}, + {SHD_NOISE_VORONOI_F2_F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", ""}, + {SHD_NOISE_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", ""}, + {SHD_NOISE_CELL_NOISE, "CELL_NOISE", 0, "Cell Noise", ""}, + {0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem prop_noise_type_items[] = { + {SHD_NOISE_SOFT, "SOFT", 0, "Soft", ""}, + {SHD_NOISE_HARD, "HARD", 0, "Hard", ""}, + {0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem prop_wave_items[] = { + {SHD_WAVE_SINE, "SINE", 0, "Sine", "Uses a sine wave to produce bands"}, + {SHD_WAVE_SAW, "SAW", 0, "Saw", "Uses a saw wave to produce bands"}, + {SHD_WAVE_TRI, "TRI", 0, "Tri", "Uses a triangle wave to produce bands"}, + {0, NULL, 0, NULL, NULL}}; /* Add any new socket value subtype here. * When adding a new subtype here, make sure you also add it @@ -189,7 +210,7 @@ static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr) case NTREE_TEXTURE: return &RNA_TextureNodeTree; default: - return &RNA_UnknownType; + return &RNA_NodeTree; } } @@ -232,6 +253,8 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr) case SOCK_RGBA: return &RNA_NodeSocketRGBA; break; + case SOCK_SHADER: + return &RNA_NodeSocketShader; } #undef SUBTYPE @@ -769,6 +792,12 @@ static EnumPropertyItem node_ycc_items[] = { { 2, "JFIF", 0, "Jpeg", ""}, {0, NULL, 0, NULL, NULL}}; +static EnumPropertyItem node_glossy_items[] = { +{SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""}, +{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""}, +{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""}, +{0, NULL, 0, NULL, NULL}}; + #define MaxNodes 50000 enum @@ -1136,6 +1165,357 @@ static void def_sh_geometry(StructRNA *srna) RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } +static void def_sh_attribute(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage"); + + prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Attribute Name", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); +} + +static void def_sh_tex_sky(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage"); + + prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION); + RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Turbidity", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); +} + +static void def_sh_tex_environment(StructRNA *srna) +{ + static const EnumPropertyItem prop_color_space_items[]= { + {SHD_COLORSPACE_SRGB, "SRGB", 0, "sRGB", "Image is in sRGB color space"}, + {SHD_COLORSPACE_LINEAR, "LINEAR", 0, "Linear", "Image is in scene linear color space"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "id"); + RNA_def_property_struct_type(prop, "Image"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Image", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage"); + + prop= RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_color_space_items); + RNA_def_property_ui_text(prop, "Color Space", "Image file color space"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_image(StructRNA *srna) +{ + static const EnumPropertyItem prop_color_space_items[]= { + {SHD_COLORSPACE_LINEAR, "LINEAR", 0, "Linear", "Image is in scene linear color space"}, + {SHD_COLORSPACE_SRGB, "SRGB", 0, "sRGB", "Image is in sRGB color space"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "id"); + RNA_def_property_struct_type(prop, "Image"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Image", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage"); + + prop= RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_color_space_items); + RNA_def_property_ui_text(prop, "Color Space", "Image file color space"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_blend(StructRNA *srna) +{ + static EnumPropertyItem prop_blend_progression[] = { + {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Creates a linear progression"}, + {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Creates a quadratic progression"}, + {SHD_BLEND_EASING, "EASING", 0, "Easing", "Creates a progression easing from one step to the next"}, + {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Creates a diagonal progression"}, + {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Creates a spherical progression"}, + {SHD_BLEND_QUADRATIC_SPHERE, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Creates a quadratic progression in the shape of a sphere"}, + {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Creates a radial progression"}, + {0, NULL, 0, NULL, NULL}}; + + static const EnumPropertyItem prop_axis_items[]= { + {SHD_BLEND_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", "Flips the texture's X and Y axis"}, + {SHD_BLEND_VERTICAL, "VERTICAL", 0, "Vertical", "Flips the texture's X and Y axis"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexBlend", "storage"); + + prop= RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "progression"); + RNA_def_property_enum_items(prop, prop_blend_progression); + RNA_def_property_ui_text(prop, "Progression", "Sets the style of the color blending"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "axis"); + RNA_def_property_enum_items(prop, prop_axis_items); + RNA_def_property_ui_text(prop, "Axis", "Flips the texture's X and Y axis"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_clouds(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexClouds", "storage"); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "hard"); + RNA_def_property_enum_items(prop, prop_noise_type_items); + RNA_def_property_ui_text(prop, "Noise Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "depth"); + RNA_def_property_range(prop, 0, 30); + RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_distnoise(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexDistortedNoise", "storage"); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "distortion_basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Distortion", "Sets the noise basis used for distortion"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_magic(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage"); + + prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "depth"); + RNA_def_property_range(prop, 0, 10); + RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_marble(StructRNA *srna) +{ + static EnumPropertyItem prop_marble_stype[] = { + {SHD_MARBLE_SOFT, "SOFT", 0, "Soft", "Uses soft marble"}, + {SHD_MARBLE_SHARP, "SHARP", 0, "Sharp", "Uses more clearly defined marble"}, + {SHD_MARBLE_SHARPER, "SHARPER", 0, "Sharper", "Uses very clearly defined marble"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexMarble", "storage"); + + prop= RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_marble_stype); + RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "hard"); + RNA_def_property_enum_items(prop, prop_noise_type_items); + RNA_def_property_ui_text(prop, "Noise Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "depth"); + RNA_def_property_range(prop, 0, 30); + RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "wave"); + RNA_def_property_enum_items(prop, prop_wave_items); + RNA_def_property_ui_text(prop, "Wave Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_musgrave(StructRNA *srna) +{ + static EnumPropertyItem prop_musgrave_type[] = { + {SHD_MUSGRAVE_MULTIFRACTAL, "MULTIFRACTAL", 0, "Multifractal", ""}, + {SHD_MUSGRAVE_RIDGED_MULTIFRACTAL, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", ""}, + {SHD_MUSGRAVE_HYBRID_MULTIFRACTAL, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""}, + {SHD_MUSGRAVE_FBM, "FBM", 0, "fBM", ""}, + {SHD_MUSGRAVE_HETERO_TERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", ""}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexMusgrave", "storage"); + + prop= RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_musgrave_type); + RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_stucci(StructRNA *srna) +{ + static EnumPropertyItem prop_stucci_stype[] = { + {SHD_STUCCI_PLASTIC, "PLASTIC", 0, "Plastic", "Uses standard stucci"}, + {SHD_STUCCI_WALL_IN, "WALL_IN", 0, "Wall in", "Creates Dimples"}, + {SHD_STUCCI_WALL_OUT, "WALL_OUT", 0, "Wall out", "Creates Ridges"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexStucci", "storage"); + + prop= RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_stucci_stype); + RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "hard"); + RNA_def_property_enum_items(prop, prop_noise_type_items); + RNA_def_property_ui_text(prop, "Noise Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_voronoi(StructRNA *srna) +{ + static EnumPropertyItem prop_distance_metric_items[] = { + {SHD_VORONOI_ACTUAL_DISTANCE, "DISTANCE", 0, "Actual Distance", ""}, + {SHD_VORONOI_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", ""}, + {SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", ""}, + {SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", ""}, + {SHD_VORONOI_MINKOVSKY_H, "MINKOVSKY_HALF", 0, "Minkovsky 1/2", ""}, + {SHD_VORONOI_MINKOVSKY_4, "MINKOVSKY_FOUR", 0, "Minkovsky 4", ""}, + {SHD_VORONOI_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_coloring_items[] = { + {SHD_VORONOI_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"}, + {SHD_VORONOI_POSITION, "POSITION", 0, "Position", "Color cells by position"}, + {SHD_VORONOI_POSITION_OUTLINE, "POSITION_OUTLINE", 0, "Position and Outline", "Use position plus an outline based on F2-F.1"}, + {SHD_VORONOI_POSITION_OUTLINE_INTENSITY, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity", "Multiply position and outline by intensity"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage"); + + prop= RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "distance_metric"); + RNA_def_property_enum_items(prop, prop_distance_metric_items); + RNA_def_property_ui_text(prop, "Distance Metric", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "coloring", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "coloring"); + RNA_def_property_enum_items(prop, prop_coloring_items); + RNA_def_property_ui_text(prop, "Coloring", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_sh_tex_wood(StructRNA *srna) +{ + static EnumPropertyItem prop_wood_type_items[] = { + {SHD_WOOD_BANDS, "BANDS", 0, "Bands", "Uses standard wood texture in bands"}, + {SHD_WOOD_RINGS, "RINGS", 0, "Rings", "Uses wood texture in rings"}, + {SHD_WOOD_BAND_NOISE, "BAND_NOISE", 0, "Band Noise", "Adds noise to standard wood"}, + {SHD_WOOD_RING_NOISE, "RING_NOISE", 0, "Ring Noise", "Adds noise to rings"}, + {0, NULL, 0, NULL, NULL}}; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeTexWood", "storage"); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Sets the noise basis used for turbulence"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "hard"); + RNA_def_property_enum_items(prop, prop_noise_type_items); + RNA_def_property_ui_text(prop, "Noise Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_wood_type_items); + RNA_def_property_ui_text(prop, "Wood Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); + + prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "wave"); + RNA_def_property_enum_items(prop, prop_wave_items); + RNA_def_property_ui_text(prop, "Wave Type", ""); + RNA_def_property_update(prop, 0, "rna_Node_update"); +} + +static void def_glossy(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, node_glossy_items); + RNA_def_property_ui_text(prop, "Distribution", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); +} /* -- Compositor Nodes ------------------------------------------------------ */ @@ -2672,6 +3052,16 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", "Socket name"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroupSocket_update"); + + prop = RNA_def_property(srna, "group_socket", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "groupsock"); + RNA_def_property_struct_type(prop, "NodeSocket"); + RNA_def_property_ui_text(prop, "Group Socket", "For group nodes, the group input or output socket this corresponds to"); + + prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED); + RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, NULL); } static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype, const char *name, const char *ui_name) @@ -2680,7 +3070,7 @@ static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype, PropertyRNA *prop=NULL; PropertySubType propsubtype= PROP_NONE; - #define SUBTYPE(socktype, stypename, id, idname) { PROP_##id, #id, 0, #idname, ""}, + #define SUBTYPE(socktype, stypename, id, idname) { PROP_##id, #socktype "_" #id, 0, #idname, ""}, static EnumPropertyItem subtype_items[] = { NODE_DEFINE_SUBTYPES {0, NULL, 0, NULL, NULL} @@ -2807,6 +3197,11 @@ static void rna_def_node(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Node"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to"); + + prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_ACTIVE_TEXTURE); + RNA_def_property_ui_text(prop, "Show Texture", "Draw node in viewport textured draw mode"); + RNA_def_property_update(prop, 0, "rna_Node_update"); } static void rna_def_node_link(BlenderRNA *brna) @@ -2998,6 +3393,7 @@ void RNA_def_nodetree(BlenderRNA *brna) #undef SUBTYPE rna_def_node_socket_subtype(brna, SOCK_BOOLEAN, 0, "NodeSocketBoolean", "Boolean Node Socket"); rna_def_node_socket_subtype(brna, SOCK_RGBA, 0, "NodeSocketRGBA", "RGBA Node Socket"); + rna_def_node_socket_subtype(brna, SOCK_SHADER, 0, "NodeSocketShader", "Shader Closure Node Socket"); rna_def_node(brna); rna_def_node_link(brna); diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h index 1bbf47db094..6744dc77469 100644 --- a/source/blender/makesrna/intern/rna_nodetree_types.h +++ b/source/blender/makesrna/intern/rna_nodetree_types.h @@ -40,7 +40,7 @@ DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTO DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ) -DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" ) +DefNode( ShaderNode, SH_NODE_GEOM, def_sh_geometry, "GEOM", Geom, "Geometry", "" ) DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" ) DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" ) DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" ) @@ -53,7 +53,45 @@ DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVER DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" ) DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" ) DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ) - +DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, 0, "OUTPUT_MATERIAL",OutputMaterial, "Material Output", "" ) +DefNode( ShaderNode, SH_NODE_OUTPUT_LAMP, 0, "OUTPUT_LAMP", OutputLamp, "Lamp Output", "" ) +//DefNode( ShaderNode, SH_NODE_OUTPUT_TEXTURE, 0, "OUTPUT_TEXTURE", OutputTexture, "Texture Output", "" ) +DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, 0, "OUTPUT_WORLD", OutputWorld, "World Output", "" ) +DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" ) +DefNode( ShaderNode, SH_NODE_BLEND_WEIGHT, 0, "BLEND_WEIGHT", BlendWeight, "BlendWeight", "" ) +DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" ) +DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" ) + +DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "") +DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "") +DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "") +DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, 0, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Bsdf Anisotropic", "") +DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse Bsdf", "") +DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy Bsdf", "") +DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass Bsdf", "") +DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "") +DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "") +DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "") +DefNode( ShaderNode, SH_NODE_VOLUME_TRANSPARENT, 0, "VOLUME_TRANSPARENT", VolumeTransparent, "Transparent Volume", "") +DefNode( ShaderNode, SH_NODE_VOLUME_ISOTROPIC, 0, "VOLUME_ISOTROPIC", VolumeIsotropic, "Isotropic Volume", "") +DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "") +DefNode( ShaderNode, SH_NODE_GEOMETRY, 0, "GEOMETRY", Geometry, "Geometry", "") +DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", Light_path, "Light_path", "") +DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_BLEND, def_sh_tex_blend, "TEX_BLEND", TexBlend, "Blend Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_CLOUDS, def_sh_tex_clouds, "TEX_CLOUDS", TexClouds, "Clouds Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_DISTNOISE, def_sh_tex_distnoise, "TEX_DISTORTED_NOISE", TexDistortedNoise, "Distorted Noise Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_MARBLE, def_sh_tex_marble, "TEX_MARBLE", TexMarble, "Marble Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_STUCCI, def_sh_tex_stucci, "TEX_STUCCI", TexStucci, "Stucci Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_WOOD, def_sh_tex_wood, "TEX_WOOD", TexWood, "Wood Texture", "") +DefNode( ShaderNode, SH_NODE_TEX_COORD, 0, "TEX_COORD", TexCoord, "Texture Coordinate", "") + DefNode( CompositorNode, CMP_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ) DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" ) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f0ba435954b..0fa63671951 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -286,6 +286,8 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b else { DAG_scene_sort(bmain, scene); } + + DAG_id_type_tag(bmain, ID_OB); } static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -1793,7 +1795,6 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"}, {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"}, - // disabled {OB_SHADED, "SHADED", 0, "Shaded", ""}, {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 0acff2a5790..c4508c718e5 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -76,7 +76,7 @@ /* copied from Mesh_getFromObject and adapted to RNA interface */ /* settings: 0 - preview, 1 - render */ -static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) +Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) { Mesh *tmpmesh; Curve *tmpcu = NULL; @@ -284,7 +284,7 @@ static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int e dupli_render_particle_set(scene, go->ob, level+1, enable); } /* When no longer needed, duplilist should be freed with Object.free_duplilist */ -static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce) +void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce) { if (!(ob->transflag & OB_DUPLI)) { BKE_report(reports, RPT_ERROR, "Object does not have duplis"); @@ -306,7 +306,7 @@ static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene * /* ob->duplilist should now be freed with Object.free_duplilist */ } -static void rna_Object_free_duplilist(Object *ob) +void rna_Object_free_duplilist(Object *ob) { if (ob->duplilist) { free_object_duplilist(ob->duplilist); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 1498d161209..da6cd02cfbc 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -48,26 +48,121 @@ #include "BKE_context.h" #include "BKE_report.h" -/* RenderEngine */ +void engine_tag_redraw(RenderEngine *engine) +{ + engine->do_draw = 1; +} -static void engine_render(RenderEngine *engine, struct Scene *scene) +void engine_tag_update(RenderEngine *engine) { - extern FunctionRNA rna_RenderEngine_render_func; + engine->do_update = 1; +} + +/* RenderEngine Callbacks */ +static void engine_update(RenderEngine *engine, Main *bmain, Scene *scene) +{ + extern FunctionRNA rna_RenderEngine_update_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func= &rna_RenderEngine_render_func; + func= &rna_RenderEngine_update_func; RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "data", &bmain); RNA_parameter_set_lookup(&list, "scene", &scene); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); } +static void engine_render(RenderEngine *engine) +{ + extern FunctionRNA rna_RenderEngine_render_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_render_func; + + RNA_parameter_list_create(&list, &ptr, func); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void engine_preview_update(RenderEngine *engine, const struct bContext *context, struct ID *id) +{ + extern FunctionRNA rna_RenderEngine_preview_update_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_preview_update_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "context", &context); + RNA_parameter_set_lookup(&list, "id", &id); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void engine_preview_render(RenderEngine *engine) +{ + extern FunctionRNA rna_RenderEngine_preview_render_func; + + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_preview_render_func; + + RNA_parameter_list_create(&list, &ptr, func); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void engine_view_update(RenderEngine *engine, const struct bContext *context) +{ + extern FunctionRNA rna_RenderEngine_view_update_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_view_update_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "context", &context); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void engine_view_draw(RenderEngine *engine, const struct bContext *context) +{ + extern FunctionRNA rna_RenderEngine_view_draw_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= &rna_RenderEngine_view_draw_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "context", &context); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + /* RenderEngine registration */ static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type) @@ -87,7 +182,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo RenderEngineType *et, dummyet = {NULL}; RenderEngine dummyengine= {NULL}; PointerRNA dummyptr; - int have_function[1]; + int have_function[6]; /* setup dummy engine & engine type to store static properties in */ dummyengine.type= &dummyet; @@ -122,13 +217,24 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo et->ext.free= free; RNA_struct_blender_type_set(et->ext.srna, et); - et->render= (have_function[0])? engine_render: NULL; + et->update= (have_function[0])? engine_update: NULL; + et->render= (have_function[1])? engine_render: NULL; + et->preview_update= (have_function[2])? engine_preview_update: NULL; + et->preview_render= (have_function[3])? engine_preview_render: NULL; + et->view_update= (have_function[4])? engine_view_update: NULL; + et->view_draw= (have_function[5])? engine_view_draw: NULL; BLI_addtail(&R_engines, et); return et->ext.srna; } +static void **rna_RenderEngine_instance(PointerRNA *ptr) +{ + RenderEngine *engine = ptr->data; + return &engine->py_instance; +} + static StructRNA* rna_RenderEngine_refine(PointerRNA *ptr) { RenderEngine *engine= (RenderEngine*)ptr->data; @@ -163,7 +269,7 @@ static void rna_RenderLayer_rect_get(PointerRNA *ptr, float *values) memcpy(values, rl->rectf, sizeof(float)*rl->rectx*rl->recty*4); } -static void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values) +void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values) { RenderLayer *rl= (RenderLayer*)ptr->data; memcpy(rl->rectf, values, sizeof(float)*rl->rectx*rl->recty*4); @@ -185,7 +291,7 @@ static void rna_RenderPass_rect_get(PointerRNA *ptr, float *values) memcpy(values, rpass->rect, sizeof(float)*rpass->rectx*rpass->recty*rpass->channels); } -static void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values) +void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values) { RenderPass *rpass= (RenderPass*)ptr->data; memcpy(rpass->rect, values, sizeof(float)*rpass->rectx*rpass->recty*rpass->channels); @@ -203,14 +309,47 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_struct_sdna(srna, "RenderEngine"); RNA_def_struct_ui_text(srna, "Render Engine", "Render engine"); RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine"); - RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", NULL); + RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance"); - /* render */ - func= RNA_def_function(srna, "render", NULL); - RNA_def_function_ui_description(func, "Render scene into an image"); + /* final render callbacks */ + func= RNA_def_function(srna, "update", NULL); + RNA_def_function_ui_description(func, "Export scene data for render"); RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_pointer(func, "data", "BlendData", "", ""); RNA_def_pointer(func, "scene", "Scene", "", ""); + func= RNA_def_function(srna, "render", NULL); + RNA_def_function_ui_description(func, "Execute render"); + RNA_def_function_flag(func, FUNC_REGISTER); + + /* preview render callbacks */ + func= RNA_def_function(srna, "preview_update", NULL); + RNA_def_function_ui_description(func, "Export scene data for preview render of the given datablock"); + RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_pointer(func, "id", "ID", "", ""); + + func= RNA_def_function(srna, "preview_render", NULL); + RNA_def_function_ui_description(func, "Execute preview render"); + RNA_def_function_flag(func, FUNC_REGISTER); + + /* viewport render callbacks */ + func= RNA_def_function(srna, "view_update", NULL); + RNA_def_function_ui_description(func, "Update on data changes for viewport render"); + RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_pointer(func, "context", "Context", "", ""); + + func= RNA_def_function(srna, "view_draw", NULL); + RNA_def_function_ui_description(func, "Draw viewport render"); + RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_pointer(func, "context", "Context", "", ""); + + /* tag for redraw */ + RNA_def_function(srna, "tag_redraw", "engine_tag_redraw"); + + /* tag for update */ + RNA_def_function(srna, "tag_update", "engine_tag_update"); + func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result"); prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); @@ -270,6 +409,10 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_define_verify_sdna(1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index fc3e7d96be7..0fa27be251d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -40,6 +40,7 @@ #include "BLI_math.h" /* Include for Bake Options */ +#include "RE_engine.h" #include "RE_pipeline.h" #ifdef WITH_QUICKTIME @@ -55,6 +56,8 @@ #include <libavformat/avformat.h> #endif +#include "ED_render.h" + #include "WM_api.h" #include "WM_types.h" @@ -773,6 +776,11 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr) return 0; } +static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) +{ + ED_render_engine_changed(bmain); +} + static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene= (Scene*)ptr->id.data; @@ -830,6 +838,12 @@ static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) return (BLI_countlist(&R_engines) > 1); } +static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) +{ + Scene *scene= (Scene*)ptr->id.data; + return scene_use_new_shading_nodes(scene); +} + static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr) { RenderData *rd= (RenderData*)ptr->data; @@ -3212,13 +3226,18 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", "rna_RenderSettings_engine_itemf"); RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); - RNA_def_property_update(prop, NC_WINDOW, NULL); + RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update"); prop= RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); + prop= RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_shading_nodes_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system"); + prop= RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_game_engine_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 345ebb2cd80..250c61ed5f4 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -69,6 +69,7 @@ static void rna_Scene_frame_set(Scene *scene, int frame, float subframe) static void rna_Scene_update_tagged(Scene *scene) { scene_update_tagged(G.main, scene); + scene_clear_tagged(G.main, scene); } static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 29a2723182b..ce84fbeacf9 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -47,6 +47,9 @@ #include "WM_api.h" #include "WM_types.h" +#include "RE_engine.h" +#include "RE_pipeline.h" + #include "RNA_enum_types.h" EnumPropertyItem space_type_items[] = { @@ -101,8 +104,9 @@ EnumPropertyItem viewport_shade_items[] = { {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"}, {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"}, - //{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"}, - {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"}, + {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Texture", "Display the object solid, with a texture"}, + {OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Display objects solid, with GLSL material"}, + {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -322,6 +326,25 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin DAG_on_visible_update(bmain, FALSE); } +static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + View3D *v3d= (View3D*)(ptr->data); + ScrArea *sa= rna_area_from_space(ptr); + + if(v3d->drawtype != OB_RENDER) { + ARegion *ar; + + for(ar=sa->regionbase.first; ar; ar=ar->next) { + RegionView3D *rv3d = ar->regiondata; + + if(rv3d && rv3d->render_engine) { + RE_engine_free(rv3d->render_engine); + rv3d->render_engine= NULL; + } + } + } +} + static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (U.uiflag & USER_LOCKAROUND) { @@ -432,6 +455,30 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value ED_view3d_from_m4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist); } +static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +{ + Scene *scene = ((bScreen*)ptr->id.data)->scene; + RenderEngineType *type = RE_engines_find(scene->r.engine); + + EnumPropertyItem *item= NULL; + int totitem= 0; + + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_BOUNDBOX); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_WIRE); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_SOLID); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_TEXTURE); + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_MATERIAL); + + if(type->view_draw) { + RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_RENDER); + } + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; +} + /* Space Image Editor */ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) @@ -1236,8 +1283,9 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "drawtype"); RNA_def_property_enum_items(prop, viewport_shade_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_viewport_shade_itemf"); RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View"); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update"); prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "localvd"); @@ -1505,6 +1553,17 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "dist"); RNA_def_property_ui_text(prop, "Distance", "Distance to the view location"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "view_camera_zoom", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "camzoom"); + RNA_def_property_ui_text(prop, "Camera Zoom", "Zoom factor in camera view"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "camdx"); + RNA_def_property_array(prop, 2); + RNA_def_property_ui_text(prop, "Camera Offset", "View shift in camera view"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); } static void rna_def_space_buttons(BlenderRNA *brna) @@ -2401,9 +2460,9 @@ static void rna_def_space_filebrowser(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "params"); RNA_def_property_ui_text(prop, "Filebrowser Parameter", "Parameters and Settings for the Filebrowser"); - prop= RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE); + prop= RNA_def_property(srna, "active_operator", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "op"); - RNA_def_property_ui_text(prop, "Operator", ""); + RNA_def_property_ui_text(prop, "Active Operator", ""); } static void rna_def_space_info(BlenderRNA *brna) @@ -2468,6 +2527,11 @@ static void rna_def_space_node(BlenderRNA *brna) {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem shader_type_items[] = { + {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"}, + {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem backdrop_channels_items[] = { {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", @@ -2491,6 +2555,12 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL); + prop= RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shaderfrom"); + RNA_def_property_enum_items(prop, shader_type_items); + RNA_def_property_ui_text(prop, "Shader Type", "Type of data to take shader from"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL); + prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index c420ecefdae..b7a5b6f5216 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -345,6 +345,16 @@ static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v) ED_node_texture_default(tex); } +static void rna_Texture_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Tex *tex= (Tex*)ptr->data; + + if(tex->use_nodes && tex->nodetree==NULL) + ED_node_shader_default(scene, &tex->id); + + rna_Texture_nodes_update(bmain, scene, ptr); +} + static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value) { Tex *tex= (Tex*)ptr->data; @@ -1829,8 +1839,9 @@ static void rna_def_texture(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture"); - RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); + RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update"); prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 659346974fa..df766d7919c 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -426,6 +426,26 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink"); + parm= RNA_def_pointer(func, "ntree", "NodeTree", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "node", "Node", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "socket", "NodeSocket", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "template_node_view", "uiTemplateNodeView"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm= RNA_def_pointer(func, "ntree", "NodeTree", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "node", "Node", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "socket", "NodeSocket", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + func= RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties"); parm= RNA_def_pointer(func, "item", "KeyMapItem", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 898ee2b2623..fbb8218bc85 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2539,7 +2539,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) /*{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},*/ /* using the utf8 flipped form of Persian (فارسی) */ {26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"}, - {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 22570460093..ab5371aeaad 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -46,6 +46,8 @@ #include "BKE_main.h" #include "BKE_texture.h" +#include "ED_node.h" + #include "WM_api.h" static PointerRNA rna_World_lighting_get(PointerRNA *ptr) @@ -119,6 +121,15 @@ static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo); } +static void rna_World_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + World *wrld= (World*)ptr->data; + + if(wrld->use_nodes && wrld->nodetree==NULL) + ED_node_shader_default(scene, &wrld->id); + + rna_World_update(bmain, scene, ptr); +} #else @@ -564,6 +575,17 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Stars", "World stars settings"); + /* nodes */ + prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); + RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based worlds"); + + prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world"); + RNA_def_property_update(prop, 0, "rna_World_use_nodes_update"); + rna_def_lighting(brna); rna_def_world_mist(brna); rna_def_world_stars(brna); |