[Bf-blender-cvs] [c8cc992] hair_system: Added an interpolation steps property.

Lukas Tönne noreply at git.blender.org
Thu Aug 14 19:09:50 CEST 2014


Commit: c8cc9923883b1bce8fc4cbada861dc7b0577298d
Author: Lukas Tönne
Date:   Thu Aug 14 16:35:17 2014 +0200
Branches: hair_system
https://developer.blender.org/rBc8cc9923883b1bce8fc4cbada861dc7b0577298d

Added an interpolation steps property.

Currently interpolation has no visible effect, since it's just linear.

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_hair.py
M	source/blender/blenkernel/intern/hair.c
M	source/blender/makesdna/DNA_hair_types.h
M	source/blender/makesrna/intern/rna_hair.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_hair.py b/release/scripts/startup/bl_ui/properties_physics_hair.py
index 85ac249..d30fe96 100644
--- a/release/scripts/startup/bl_ui/properties_physics_hair.py
+++ b/release/scripts/startup/bl_ui/properties_physics_hair.py
@@ -109,6 +109,7 @@ class PHYSICS_PT_hair_render(PhysicButtonsPanel, Panel):
 
         col = layout.column()
         col.prop(render, "render_hairs")
+        col.prop(render, "interpolation_steps")
 
         col.label("Curl:")
         col.prop(render, "curl_smoothing")
diff --git a/source/blender/blenkernel/intern/hair.c b/source/blender/blenkernel/intern/hair.c
index 8425417..853f9f8 100644
--- a/source/blender/blenkernel/intern/hair.c
+++ b/source/blender/blenkernel/intern/hair.c
@@ -59,6 +59,8 @@ HairSystem *BKE_hairsys_new(void)
 	
 	render->flag = HAIR_RENDER_CLOSE_TIP;
 	render->num_render_hairs = 100;
+	render->interpolation_steps = 4;
+	
 	render->curl_smoothing = 1.0f;
 	render->radius_scale = 0.01f;
 	render->root_width = 1.0f;
@@ -341,7 +343,7 @@ void BKE_hair_render_iter_init(HairRenderIterator *iter, HairSystem *hsys)
 	int maxpoints = hair_maxpoints(hsys);
 	
 	iter->hsys = hsys;
-	iter->steps_per_point = 1; // XXX TODO!
+	iter->steps_per_point = render->interpolation_steps;
 	iter->maxsteps = (maxpoints - 1) * iter->steps_per_point + 1;
 	iter->hair_cache = MEM_mallocN(sizeof(HairPointRenderCache) * maxpoints, "hair render cache data");
 	
diff --git a/source/blender/makesdna/DNA_hair_types.h b/source/blender/makesdna/DNA_hair_types.h
index 6118f7f..cafa2cf 100644
--- a/source/blender/makesdna/DNA_hair_types.h
+++ b/source/blender/makesdna/DNA_hair_types.h
@@ -59,13 +59,14 @@ typedef struct HairRenderSettings {
 	
 	int num_render_hairs;       /* render hairs per simulation hair */
 	
+	int interpolation_steps;
+	
 	float radius_scale;
 	float root_width;
 	float tip_width;
 	float shape;
 	
 	float curl_smoothing;
-	int pad;
 } HairRenderSettings;
 
 typedef enum eHairRenderSettings_Flag {
diff --git a/source/blender/makesrna/intern/rna_hair.c b/source/blender/makesrna/intern/rna_hair.c
index 16a3916..1815374 100644
--- a/source/blender/makesrna/intern/rna_hair.c
+++ b/source/blender/makesrna/intern/rna_hair.c
@@ -268,6 +268,14 @@ static void rna_def_hair_render_settings(BlenderRNA *brna) {
 	RNA_def_property_ui_text(prop, "Render Hairs", "Number of hairs rendered around each simulated hair");
 	RNA_def_property_update(prop, 0, "rna_HairParams_render_update");
 
+	prop = RNA_def_property(srna, "interpolation_steps", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "interpolation_steps");
+	RNA_def_property_range(prop, 1, 10000);
+	RNA_def_property_ui_range(prop, 1, 128, 1, 1);
+	RNA_def_property_int_default(prop, 4);
+	RNA_def_property_ui_text(prop, "Interpolation Steps", "Number of interpolated segments to use for rendering");
+	RNA_def_property_update(prop, 0, "rna_HairParams_render_update");
+
 	prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 0.01f, 3);




More information about the Bf-blender-cvs mailing list