From 9c1cf53e9ab023e281697e2810ba45031c024101 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 27 Aug 2009 18:24:12 +0000 Subject: [PATCH] 2.5 Volumetric: * Wrapped some missing Point Density RNA and added the options to the UI. * Some UI changes (greying out...) Matt: Please check. :) --- release/ui/buttons_texture.py | 49 +++++++++++++---- source/blender/makesrna/intern/rna_texture.c | 56 ++++++++++++++++++-- 2 files changed, 91 insertions(+), 14 deletions(-) diff --git a/release/ui/buttons_texture.py b/release/ui/buttons_texture.py index 4827f677336..c9f1585ec81 100644 --- a/release/ui/buttons_texture.py +++ b/release/ui/buttons_texture.py @@ -623,6 +623,7 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel): def draw(self, context): layout = self.layout + tex = context.texture vd = tex.voxeldata @@ -631,12 +632,13 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel): layout.itemR(vd, "source_path") if vd.file_format == 'RAW_8BIT': layout.itemR(vd, "resolution") - if vd.file_format == 'SMOKE': + elif vd.file_format == 'SMOKE': layout.itemR(vd, "domain_object") layout.itemR(vd, "still") - if vd.still: - layout.itemR(vd, "still_frame_number") + row = layout.row() + row.active = vd.still + row.itemR(vd, "still_frame_number") layout.itemR(vd, "interpolation") layout.itemR(vd, "intensity") @@ -651,27 +653,51 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel): def draw(self, context): layout = self.layout + tex = context.texture pd = tex.pointdensity + ob = context.object - layout.itemR(pd, "point_source") - layout.itemR(pd, "object") + layout.itemR(pd, "point_source", expand=True) if pd.point_source == 'PARTICLE_SYSTEM': - layout.item_pointerR(pd, "particle_system", pd.object, "particle_systems", text="") + layout.item_pointerR(pd, "particle_system", ob, "particle_systems", text="System") + layout.itemR(pd, "particle_cache", text="Cache") + else: + layout.itemR(pd, "object") + layout.itemR(pd, "vertices_cache", text="Cache") + + layout.itemS() + layout.itemR(pd, "radius") layout.itemR(pd, "falloff") if pd.falloff == 'SOFT': layout.itemR(pd, "falloff_softness") - layout.itemR(pd, "color_source") + + layout.itemS() + layout.itemR(pd, "turbulence") - layout.itemR(pd, "turbulence_size") - layout.itemR(pd, "turbulence_depth") - layout.itemR(pd, "turbulence_influence") + col = layout.column() + col.active = pd.turbulence + sub = col.column_flow() + sub.itemR(pd, "turbulence_size") + sub.itemR(pd, "turbulence_depth") + sub.itemR(pd, "turbulence_strength") + col.itemR(pd, "turbulence_influence", text="Influence") + col.itemR(pd, "noise_basis") + + layout.itemS() + + layout.itemR(pd, "color_source") + if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_VELOCITY'): + layout.itemR(pd, "speed_scale") + if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'): + layout.template_color_ramp(pd.color_ramp, expand=True) bpy.types.register(TEXTURE_PT_context_texture) bpy.types.register(TEXTURE_PT_preview) -bpy.types.register(TEXTURE_PT_clouds) + +bpy.types.register(TEXTURE_PT_clouds) # Texture Type Panels bpy.types.register(TEXTURE_PT_wood) bpy.types.register(TEXTURE_PT_marble) bpy.types.register(TEXTURE_PT_magic) @@ -687,6 +713,7 @@ bpy.types.register(TEXTURE_PT_voronoi) bpy.types.register(TEXTURE_PT_distortednoise) bpy.types.register(TEXTURE_PT_voxeldata) bpy.types.register(TEXTURE_PT_pointdensity) + bpy.types.register(TEXTURE_PT_colors) bpy.types.register(TEXTURE_PT_mapping) bpy.types.register(TEXTURE_PT_influence) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index a949d26f51a..f899d52543e 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -1333,8 +1333,21 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) static EnumPropertyItem point_source_items[] = { {TEX_PD_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"}, {TEX_PD_OBJECT, "OBJECT", 0, "Object Vertices", "Generate point density from an object's vertices"}, + //{TEX_PD_FILE, "FILE", 0 , "File", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem particle_cache_items[] = { + {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Emit Object Location", ""}, + {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Emit Object Space", ""}, + {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0 , "Global Space", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem vertice_cache_items[] = { + {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Object Location", ""}, + {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Object Space", ""}, + {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0 , "Global Space", ""}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem falloff_items[] = { {TEX_PD_FALLOFF_STD, "STANDARD", 0, "Standard", ""}, {TEX_PD_FALLOFF_SMOOTH, "SMOOTH", 0, "Smooth", ""}, @@ -1354,7 +1367,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static", "Noise patterns will remain unchanged, faster and suitable for stills"}, {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "Turbulent noise driven by particle velocity"}, {TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age", "Turbulent noise driven by the particle's age between birth and death"}, - {TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"}, + {TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "PointDensity", NULL); @@ -1380,6 +1393,18 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_TEXTURE, NULL); + prop= RNA_def_property(srna, "particle_cache", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space"); + RNA_def_property_enum_items(prop, particle_cache_items); + RNA_def_property_ui_text(prop, "Particle Cache", "Co-ordinate system to cache particles in"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "vertices_cache", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space"); + RNA_def_property_enum_items(prop, vertice_cache_items); + RNA_def_property_ui_text(prop, "Vertices Cache", "Co-ordinate system to cache vertices in"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0.01, FLT_MAX); @@ -1404,6 +1429,19 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from"); RNA_def_property_update(prop, NC_TEXTURE, NULL); + prop= RNA_def_property(srna, "speed_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "speed_scale"); + RNA_def_property_range(prop, 0.001, 100.0); + RNA_def_property_ui_text(prop, "Scale", "Multipler to bring particle speed within an acceptable range"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "coba"); + RNA_def_property_struct_type(prop, "ColorRamp"); + RNA_def_property_ui_text(prop, "Color Ramp", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + /* Turbulence */ prop= RNA_def_property(srna, "turbulence", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_TURBULENCE); RNA_def_property_ui_text(prop, "Turbulence", "Add directed noise to the density at render-time"); @@ -1415,6 +1453,12 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Size", "Scale of the added turbulent noise"); RNA_def_property_update(prop, NC_TEXTURE, NULL); + prop= RNA_def_property(srna, "turbulence_strength", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "noise_fac"); + RNA_def_property_range(prop, 0.01, FLT_MAX); + RNA_def_property_ui_text(prop, "Strength", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "noise_depth"); RNA_def_property_range(prop, 0, INT_MAX); @@ -1426,9 +1470,14 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) RNA_def_property_enum_items(prop, turbulence_influence_items); RNA_def_property_ui_text(prop, "Turbulence Influence", "Method for driving added turbulent noise"); RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "noise_basis"); + RNA_def_property_enum_items(prop, prop_noise_basis_items); + RNA_def_property_ui_text(prop, "Noise Basis", "Noise formula used for tubulence"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + - - srna= RNA_def_struct(brna, "PointDensityTexture", "Texture"); RNA_def_struct_sdna(srna, "Tex"); RNA_def_struct_ui_text(srna, "Point Density", "Settings for the Point Density texture"); @@ -1454,6 +1503,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) static EnumPropertyItem file_format_items[] = { {TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"}, {TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit greyscale binary data"}, + //{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""}, {TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence", "Generate voxels from a sequence of image slices"}, {TEX_VD_SMOKE, "SMOKE", 0, "Smoke", "Render voxels from a Blender smoke simulation"}, {0, NULL, 0, NULL, NULL}};