diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_texture.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index bdf9fa4e436..e8f812506e2 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -24,16 +24,10 @@ * \ingroup RNA */ - #include <float.h> #include <stdio.h> #include <stdlib.h> -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - #include "DNA_brush_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -44,8 +38,15 @@ #include "DNA_particle_types.h" #include "DNA_scene_types.h" /* MAXFRAME only */ +#include "BLI_utildefines.h" + #include "BKE_node.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + #include "WM_api.h" #include "WM_types.h" @@ -71,12 +72,12 @@ EnumPropertyItem texture_type_items[] = { {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - highly flexible fractal noise texture"}, {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", "Procedural - random noise, gives a different result every time, for every frame, for every pixel"}, + {TEX_OCEAN, "OCEAN", ICON_TEXTURE, "Ocean", "Use a texture generated by an Ocean modifier"}, {TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""}, {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"}, {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - create cell-like patterns based on Worley noise"}, {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Create a 3D texture based on volumetric data"}, {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - wave generated bands or rings, with optional noise"}, - {TEX_OCEAN, "OCEAN", ICON_TEXTURE, "Ocean", "Use a texture generated by an Ocean modifier"}, {0, NULL, 0, NULL, NULL} }; @@ -106,6 +107,7 @@ EnumPropertyItem blend_type_items[] = { #include "RNA_access.h" +#include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_image.h" #include "BKE_texture.h" @@ -166,7 +168,7 @@ static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *pt } else if (GS(id->name) == ID_NT) { bNodeTree *ntree = ptr->id.data; - ED_node_generic_update(bmain, ntree, NULL); + ED_node_tag_update_nodetree(bmain, ntree); } } @@ -380,18 +382,21 @@ static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value) else tex->flag &= ~TEX_COLORBAND; if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL) - tex->coba = add_colorband(0); + tex->coba = add_colorband(false); } -static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v) +static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr) { Tex *tex = (Tex *)ptr->data; - tex->use_nodes = v; - tex->type = 0; + if (tex->use_nodes) { + tex->type = 0; + + if (tex->nodetree == NULL) + ED_node_texture_default(C, tex); + } - if (v && tex->nodetree == NULL) - ED_node_texture_default(tex); + rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr); } static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value) @@ -563,7 +568,7 @@ static void rna_def_colormapping(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Color_mapping_update"); prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 5); + RNA_def_property_range(prop, 0.0, 5); RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture"); RNA_def_property_update(prop, 0, "rna_Color_mapping_update"); @@ -1845,7 +1850,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "file_format"); RNA_def_property_enum_items(prop, file_format_items); - RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render "); + RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render"); RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update"); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); @@ -1983,7 +1988,7 @@ static void rna_def_texture(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Texture_update"); prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 5); + RNA_def_property_range(prop, 0.0, 5); RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); @@ -2020,9 +2025,9 @@ static void rna_def_texture(BlenderRNA *brna) /* nodetree */ 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_flag(prop, PROP_CONTEXT_UPDATE); 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"); |