[Bf-blender-cvs] [a659027] gooseberry: Merge branch 'hair_immediate_fixes' into gooseberry

Lukas Tönne noreply at git.blender.org
Sun Nov 9 13:17:02 CET 2014


Commit: a659027d917e117a6f6c57ca64e0bfa18f80e009
Author: Lukas Tönne
Date:   Sun Nov 9 13:11:05 2014 +0100
Branches: gooseberry
https://developer.blender.org/rBa659027d917e117a6f6c57ca64e0bfa18f80e009

Merge branch 'hair_immediate_fixes' into gooseberry

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

M	release/scripts/startup/bl_ui/properties_particle.py
M	source/blender/blenkernel/BKE_effect.h
M	source/blender/blenkernel/intern/cloth.c
M	source/blender/blenkernel/intern/collision.c
M	source/blender/blenkernel/intern/effect.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/drawsimdebug.c
M	source/blender/makesdna/DNA_cloth_types.h
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesdna/DNA_particle_types.h
M	source/blender/makesrna/intern/rna_cloth.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_particle.c
M	source/blender/physics/BPH_mass_spring.h
M	source/blender/physics/CMakeLists.txt
M	source/blender/physics/intern/BPH_mass_spring.cpp
A	source/blender/physics/intern/eigen_utils.h
D	source/blender/physics/intern/hair_volume.c
A	source/blender/physics/intern/hair_volume.cpp
M	source/blender/physics/intern/implicit.h
M	source/blender/physics/intern/implicit_blender.c
M	source/blender/physics/intern/implicit_eigen.cpp
M	source/blender/render/CMakeLists.txt
M	source/blender/render/SConscript
M	source/blender/render/intern/source/voxeldata.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 2c59916..f8d1612 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -308,7 +308,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
         # XXX disabled due to stability issues
         #sub.prop(cloth, "pressure", slider=True, text="Pressure")
         #sub.prop(cloth, "pressure_threshold", slider=True, text="Threshold")
-        col.prop(cloth, "voxel_resolution")
+        col.prop(cloth, "voxel_cell_size")
 
         split.separator()
 
@@ -322,7 +322,9 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
         col.label(text="Quality:")
         col.prop(cloth, "quality", text="Steps", slider=True)
 
-        col.prop(cloth_md, "show_debug_data", text="Debug")
+        row = col.row()
+        row.prop(psys.settings, "show_hair_grid", text="HairGrid")
+        row.prop(cloth_md, "show_debug_data", text="Debug")
 
         if result:
             box = layout.box()
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 04853bb..6688cd3 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -150,6 +150,7 @@ typedef struct SimDebugElement {
 
 typedef enum eSimDebugElement_Type {
 	SIM_DEBUG_ELEM_DOT,
+	SIM_DEBUG_ELEM_CIRCLE,
 	SIM_DEBUG_ELEM_LINE,
 	SIM_DEBUG_ELEM_VECTOR,
 } eSimDebugElement_Type;
@@ -160,6 +161,7 @@ typedef struct SimDebugData {
 
 struct SimDebugData *BKE_sim_debug_data_new(void);
 void BKE_sim_debug_data_add_dot(struct SimDebugData *debug_data, const float p[3], float r, float g, float b, const char *category, int hash);
+void BKE_sim_debug_data_add_circle(struct SimDebugData *debug_data, const float p[3], const float radius, float r, float g, float b, const char *category, int hash);
 void BKE_sim_debug_data_add_line(struct SimDebugData *debug_data, const float p1[3], const float p2[3], float r, float g, float b, const char *category, int hash);
 void BKE_sim_debug_data_add_vector(struct SimDebugData *debug_data, const float p[3], const float d[3], float r, float g, float b, const char *category, int hash);
 void BKE_sim_debug_data_remove(struct SimDebugData *debug_data, int hash);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index eff2fad..e9752ff 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -153,7 +153,7 @@ void cloth_init(ClothModifierData *clmd )
 	clmd->sim_parms->goalfrict = 0.0f;
 	clmd->sim_parms->velocity_smooth = 0.0f;
 
-	clmd->sim_parms->voxel_res = 32;
+	clmd->sim_parms->voxel_cell_size = 0.1f;
 
 	if (!clmd->sim_parms->effector_weights)
 		clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 0f9ca3b..95d5730 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1061,6 +1061,7 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll
 				bounce = 0.0f;
 				mul_v3_v3fl(impulse, collpair->normal, repulse);
 			}
+#if 0
 			{
 				float d[3], md[3];
 				mul_v3_v3fl(d, collpair->normal, -collpair->distance);
@@ -1072,8 +1073,9 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll
 				BKE_sim_debug_data_add_line(clmd->debug_data, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, 0, 0, 1, "collision", hash_collpair(86, collpair));
 				BKE_sim_debug_data_add_line(clmd->debug_data, collmd->current_x[collpair->bp3].co, collmd->current_x[collpair->bp1].co, 0, 0, 1, "collision", hash_collpair(87, collpair));
 			}
+#endif
 			cloth1->verts[collpair->ap1].impulse_count++;
-			BKE_sim_debug_data_add_vector(clmd->debug_data, collpair->pa, impulse, 1.0, 1.0, 1.0, "collision", hash_collpair(873, collpair));
+//			BKE_sim_debug_data_add_vector(clmd->debug_data, collpair->pa, impulse, 1.0, 1.0, 1.0, "collision", hash_collpair(873, collpair));
 			
 			result = true;
 		}
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index c18726e..b07d972 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1089,6 +1089,27 @@ void BKE_sim_debug_data_add_dot(struct SimDebugData *debug_data, const float p[3
 	debug_data_insert(debug_data, elem);
 }
 
+void BKE_sim_debug_data_add_circle(struct SimDebugData *debug_data, const float p[3], float radius, float r, float g, float b, const char *category, int hash)
+{
+	int category_hash = (int)BLI_ghashutil_strhash_p(category);
+	SimDebugElement *elem;
+	if (!debug_data)
+		return;
+	
+	elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
+	elem->type = SIM_DEBUG_ELEM_CIRCLE;
+	elem->category_hash = category_hash;
+	elem->hash = hash;
+	elem->color[0] = r;
+	elem->color[1] = g;
+	elem->color[2] = b;
+	copy_v3_v3(elem->v1, p);
+	elem->v2[0] = radius;
+	elem->v2[1] = elem->v2[2] = 0.0f;
+	
+	debug_data_insert(debug_data, elem);
+}
+
 void BKE_sim_debug_data_add_line(struct SimDebugData *debug_data, const float p1[3], const float p2[3], float r, float g, float b, const char *category, int hash)
 {
 	int category_hash = (int)BLI_ghashutil_strhash_p(category);
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 2733047..884f59c 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -439,25 +439,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 	}
-
-	if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "int", "voxel_res")) {
-		Object *ob;
-		ModifierData *md;
-		for (ob = main->object.first; ob; ob = ob->id.next) {
-			for (md = ob->modifiers.first; md; md = md->next) {
-				if (md->type == eModifierType_Cloth) {
-					ClothModifierData *clmd = (ClothModifierData*) md;
-					clmd->sim_parms->voxel_res = 32;
-				}
-				else if (md->type == eModifierType_ParticleSystem) {
-					ParticleSystemModifierData *pmd = (ParticleSystemModifierData*) md;
-					if (pmd->psys->clmd) {
-						pmd->psys->clmd->sim_parms->voxel_res = 32;
-					}
-				}
-			}
-		}
-	}
 	
 	if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
 		Object *ob;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6e698c4..51d6fb6 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5185,6 +5185,79 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 					if (part->draw_col == PART_DRAW_COL_MAT)
 						glEnableClientState(GL_COLOR_ARRAY);
 			}
+			
+			if (part->draw & PART_DRAW_HAIR_GRID) {
+				ClothModifierData *clmd = psys->clmd;
+				if (clmd) {
+					float *a = clmd->hair_grid_min;
+					float *b = clmd->hair_grid_max;
+					int *res = clmd->hair_grid_res;
+					int i;
+					
+					glDisable(GL_LIGHTING);
+					glDisable(GL_COLOR_MATERIAL);
+					glDisableClientState(GL_NORMAL_ARRAY);
+					glDisableClientState(GL_COLOR_ARRAY);
+					
+					if (select)
+						UI_ThemeColor(TH_ACTIVE);
+					else
+						UI_ThemeColor(TH_WIRE);
+					glBegin(GL_LINES);
+					glVertex3f(a[0], a[1], a[2]); glVertex3f(b[0], a[1], a[2]);
+					glVertex3f(b[0], a[1], a[2]); glVertex3f(b[0], b[1], a[2]);
+					glVertex3f(b[0], b[1], a[2]); glVertex3f(a[0], b[1], a[2]);
+					glVertex3f(a[0], b[1], a[2]); glVertex3f(a[0], a[1], a[2]);
+					
+					glVertex3f(a[0], a[1], b[2]); glVertex3f(b[0], a[1], b[2]);
+					glVertex3f(b[0], a[1], b[2]); glVertex3f(b[0], b[1], b[2]);
+					glVertex3f(b[0], b[1], b[2]); glVertex3f(a[0], b[1], b[2]);
+					glVertex3f(a[0], b[1], b[2]); glVertex3f(a[0], a[1], b[2]);
+					
+					glVertex3f(a[0], a[1], a[2]); glVertex3f(a[0], a[1], b[2]);
+					glVertex3f(b[0], a[1], a[2]); glVertex3f(b[0], a[1], b[2]);
+					glVertex3f(a[0], b[1], a[2]); glVertex3f(a[0], b[1], b[2]);
+					glVertex3f(b[0], b[1], a[2]); glVertex3f(b[0], b[1], b[2]);
+					glEnd();
+					
+					if (select)
+						UI_ThemeColorShadeAlpha(TH_ACTIVE, 0, -100);
+					else
+						UI_ThemeColorShadeAlpha(TH_WIRE, 0, -100);
+					glEnable(GL_BLEND);
+					glBegin(GL_LINES);
+					for (i = 1; i < res[0]-1; ++i) {
+						float f = interpf(b[0], a[0], (float)i / (float)(res[0]-1));
+						glVertex3f(f, a[1], a[2]); glVertex3f(f, b[1], a[2]);
+						glVertex3f(f, b[1], a[2]); glVertex3f(f, b[1], b[2]);
+						glVertex3f(f, b[1], b[2]); glVertex3f(f, a[1], b[2]);
+						glVertex3f(f, a[1], b[2]); glVertex3f(f, a[1], a[2]);
+					}
+					for (i = 1; i < res[1]-1; ++i) {
+						float f = interpf(b[1], a[1], (float)i / (float)(res[1]-1));
+						glVertex3f(a[0], f, a[2]); glVertex3f(b[0], f, a[2]);
+						glVertex3f(b[0], f, a[2]); glVertex3f(b[0], f, b[2]);
+						glVertex3f(b[0], f, b[2]); glVertex3f(a[0], f, b[2]);
+						glVertex3f(a[0], f, b[2]); glVertex3f(a[0], f, a[2]);
+					}
+					for (i = 1; i < res[2]-1; ++i) {
+						float f = interpf(b[2], a[2], (float)i / (float)(res[2]-1));
+						glVertex3f(a[0], a[1], f); glVertex3f(b[0], a[1], f);
+						glVertex3f(b[0], a[1], f); glVertex3f(b[0], b[1], f);
+						glVertex3f(b[0], b[1], f); glVertex3f(a[0], b[1], f);
+						glVertex3f(a[0], b[1], f); glVertex3f(a[0], a[1], f);
+					}
+					glEnd();
+					glDisable(GL_BLEND);
+					
+					glEnable(GL_LIGHTING);
+					glEnable(GL_COLOR_MATERIAL);
+					glEnableClientState(GL_NORMAL_ARRAY);
+					if ((dflag & DRAW_CONSTCOLOR) == 0)
+						if (part->draw_col == PART_DRAW_COL_MAT)
+							glEnableClientState(GL_COLOR_ARRAY);
+				}
+			}
 		}
 		
 		/* draw child particles */
diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c
index 83fee94..5f3779d 100644
--- a/source/blender/editors/space_view3d/drawsimdebug.c
+++ b/sou

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list