[Bf-blender-cvs] [73a09f2] hair_system: Merge branch 'hair_immediate_fixes' into hair_system

Lukas Tönne noreply at git.blender.org
Sun Oct 5 14:56:30 CEST 2014


Commit: 73a09f2dcdfc8d52418ceb77d5c401140d56b51f
Author: Lukas Tönne
Date:   Wed Sep 24 11:36:59 2014 +0200
Branches: hair_system
https://developer.blender.org/rB73a09f2dcdfc8d52418ceb77d5c401140d56b51f

Merge branch 'hair_immediate_fixes' into hair_system

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

M	build_files/cmake/macros.cmake
M	release/scripts/startup/bl_ui/properties_particle.py
M	release/scripts/startup/bl_ui/properties_texture.py
M	source/blender/CMakeLists.txt
M	source/blender/SConscript
M	source/blender/blenkernel/BKE_cloth.h
M	source/blender/blenkernel/BKE_collision.h
M	source/blender/blenkernel/BKE_effect.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/SConscript
M	source/blender/blenkernel/intern/cloth.c
M	source/blender/blenkernel/intern/collision.c
M	source/blender/blenkernel/intern/effect.c
D	source/blender/blenkernel/intern/implicit.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenlib/BLI_math_matrix.h
M	source/blender/blenlib/intern/math_matrix.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/object/object_bake_api.c
M	source/blender/editors/space_view3d/CMakeLists.txt
M	source/blender/editors/space_view3d/drawobject.c
A	source/blender/editors/space_view3d/drawsimdebug.c
M	source/blender/editors/space_view3d/view3d_intern.h
M	source/blender/makesdna/DNA_cloth_types.h
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesdna/DNA_texture_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
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/makesrna/intern/rna_texture.c
M	source/blender/modifiers/intern/MOD_cloth.c
A	source/blender/physics/BPH_mass_spring.h
A	source/blender/physics/CMakeLists.txt
A	source/blender/physics/SConscript
A	source/blender/physics/intern/BPH_mass_spring.cpp
A	source/blender/physics/intern/ConstrainedConjugateGradient.h
A	source/blender/physics/intern/hair_volume.c
A	source/blender/physics/intern/implicit.h
A	source/blender/physics/intern/implicit_blender.c
A	source/blender/physics/intern/implicit_eigen.cpp
M	source/blender/render/intern/source/voxeldata.c

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 788a359..f6438c7 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -499,6 +499,7 @@ macro(SETUP_BLENDER_SORTED_LIBS)
 		bf_hair
 		bf_bmesh
 		bf_blenkernel
+		bf_physics
 		bf_nodes
 		bf_rna
 		bf_gpu
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 4eb68a9..6c1317a 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -277,6 +277,9 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
             return
 
         params = psys.params
+        cloth_md = psys.cloth
+        cloth = cloth_md.settings
+        result = cloth_md.solver_result
 
         layout.enabled = psys.use_hair_dynamics
 
@@ -284,6 +287,12 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
 
         col = split.column()
         col.prop(params, "substeps_forces")
+        sub.prop(cloth, "pressure", slider=True)
+        sub.prop(cloth, "pressure_threshold", slider=True)
+
+        sub.separator()
+        
+        sub.prop(cloth, "voxel_resolution")
 
         col = split.column()
         col.prop(params, "substeps_damping")
@@ -299,6 +308,27 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
         col.prop(params, "stretch_damping")
         col.prop(params, "bend_damping")
 
+        layout.prop(cloth_md, "show_debug_data", text="Debug")
+
+        if result:
+            box = layout.box()
+
+            if not result.status:
+                label = " "
+                icon = 'NONE'
+            elif result.status == {'SUCCESS'}:
+                label = "Success"
+                icon = 'NONE'
+            elif result.status - {'SUCCESS'} == {'NO_CONVERGENCE'}:
+                label = "No Convergence"
+                icon = 'ERROR'
+            else:
+                label = "ERROR"
+                icon = 'ERROR'
+            box.label(label, icon=icon)
+            box.label("Iterations: %d .. %d (avg. %d)" % (result.min_iterations, result.max_iterations, result.avg_iterations))
+            box.label("Error: %.5f .. %.5f (avg. %.5f)" % (result.min_error, result.max_error, result.avg_error))
+
 
 class PARTICLE_PT_hair_collision(ParticleButtonsPanel, Panel):
     bl_label = "Hair Collision"
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index faf0d4c..4f5d22d 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -771,6 +771,9 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, Panel):
         elif vd.file_format == 'SMOKE':
             layout.prop(vd, "domain_object")
             layout.prop(vd, "smoke_data_type")
+        elif vd.file_format == 'HAIR':
+            layout.prop(vd, "domain_object")
+            layout.prop(vd, "hair_data_type")
         elif vd.file_format == 'IMAGE_SEQUENCE':
             layout.template_ID(tex, "image", open="image.open")
             layout.template_image(tex, "image", tex.image_user, compact=True)
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index cdbadc1..eab2de7 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -103,6 +103,7 @@ add_subdirectory(render)
 add_subdirectory(blenfont)
 add_subdirectory(blenloader)
 add_subdirectory(ikplugin)
+add_subdirectory(physics)
 add_subdirectory(gpu)
 add_subdirectory(imbuf)
 add_subdirectory(nodes)
diff --git a/source/blender/SConscript b/source/blender/SConscript
index 9146794..16ca05a 100644
--- a/source/blender/SConscript
+++ b/source/blender/SConscript
@@ -41,6 +41,7 @@ SConscript(['avi/SConscript',
             'nodes/SConscript',
             'modifiers/SConscript',
             'ikplugin/SConscript',
+            'physics/SConscript',
             'windowmanager/SConscript',
             'blenfont/SConscript',
             'hair/SConscript'])
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 757d63e..acda9e1 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -41,7 +41,10 @@ struct Scene;
 struct MFace;
 struct DerivedMesh;
 struct ClothModifierData;
+struct CollisionModifierData;
 struct CollisionTree;
+struct VoxelData;
+struct PartDeflect;
 
 #define DO_INLINE MALWAYS_INLINE
 
@@ -56,6 +59,19 @@ struct CollisionTree;
 #define CLOTH_VERT_FLAG_PINNED 1
 #define CLOTH_VERT_FLAG_NOSELFCOLL 2 /* vertex NOT used for self collisions */
 
+typedef struct ClothHairRoot {
+	float loc[3];
+	float rot[3][3];
+} ClothHairRoot;
+
+typedef struct ClothSolverResult {
+	int status;
+	
+	int max_iterations, min_iterations;
+	float avg_iterations;
+	float max_error, min_error, avg_error;
+} ClothSolverResult;
+
 /**
  * This structure describes a cloth object against which the
  * simulation can run.
@@ -116,8 +132,12 @@ ClothVertex;
 typedef struct ClothSpring {
 	int	ij;		/* Pij from the paper, one end of the spring.	*/
 	int	kl;		/* Pkl from the paper, one end of the spring.	*/
+	int mn;
 	float	restlen;	/* The original length of the spring.	*/
-	int	matrix_index; 	/* needed for implicit solver (fast lookup) */
+	/* needed for implicit solver (fast lookup) */
+	int	matrix_ij_kl;
+	int	matrix_kl_mn;
+	int	matrix_ij_mn;
 	int	type;		/* types defined in BKE_cloth.h ("springType") */
 	int	flags; 		/* defined in BKE_cloth.h, e.g. deactivated due to tearing */
 	float dfdx[3][3];
@@ -158,6 +178,7 @@ typedef enum {
 typedef enum {
 	CLOTH_COLLSETTINGS_FLAG_ENABLED = ( 1 << 1 ), /* enables cloth - object collisions */
 	CLOTH_COLLSETTINGS_FLAG_SELF = ( 1 << 2 ), /* enables selfcollisions */
+	CLOTH_COLLSETTINGS_FLAG_POINTS = ( 1 << 3 ), /* enables point collisions (hair) */
 } CLOTH_COLLISIONSETTINGS_FLAGS;
 
 /* Spring types as defined in the paper.*/
@@ -166,7 +187,8 @@ typedef enum {
 	CLOTH_SPRING_TYPE_SHEAR       = (1 << 2),
 	CLOTH_SPRING_TYPE_BENDING     = (1 << 3),
 	CLOTH_SPRING_TYPE_GOAL        = (1 << 4),
-	CLOTH_SPRING_TYPE_SEWING      = (1 << 5)
+	CLOTH_SPRING_TYPE_SEWING      = (1 << 5),
+	CLOTH_SPRING_TYPE_BENDING_ANG = (1 << 6),
 } CLOTH_SPRING_TYPES;
 
 /* SPRING FLAGS */
@@ -180,22 +202,26 @@ typedef enum {
 // collision.c
 ////////////////////////////////////////////////
 
+struct CollPair;
+
+typedef struct ColliderContacts {
+	struct Object *ob;
+	struct CollisionModifierData *collmd;
+	
+	struct CollPair *collisions;
+	int totcollisions;
+} ColliderContacts;
+
 // needed for implicit.c
 int cloth_bvh_objcollision (struct Object *ob, struct ClothModifierData *clmd, float step, float dt );
+int cloth_points_objcollision(struct Object *ob, struct ClothModifierData *clmd, float step, float dt);
 
-////////////////////////////////////////////////
+void cloth_find_point_contacts(struct Object *ob, struct ClothModifierData *clmd, float step, float dt,
+                               ColliderContacts **r_collider_contacts, int *r_totcolliders);
+void cloth_free_contacts(ColliderContacts *collider_contacts, int totcolliders);
 
-
-////////////////////////////////////////////////
-// implicit.c
 ////////////////////////////////////////////////
 
-// needed for cloth.c
-int implicit_init (struct Object *ob, struct ClothModifierData *clmd );
-int implicit_free (struct ClothModifierData *clmd );
-int implicit_solver (struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors );
-void implicit_set_positions (struct ClothModifierData *clmd );
-
 /////////////////////////////////////////////////
 // cloth.c
 ////////////////////////////////////////////////
@@ -233,9 +259,9 @@ typedef enum {
 typedef struct {
 	const char		*name;
 	CM_SOLVER_ID	id;
-	int	( *init ) (struct Object *ob, struct ClothModifierData *clmd );
-	int	( *solver ) (struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
-	int	( *free ) (struct ClothModifierData *clmd );
+	int ( *init ) (struct Object *ob, struct ClothModifierData *clmd );
+	int ( *solver ) (struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
+	void ( *free ) (struct ClothModifierData *clmd );
 }
 CM_SOLVER_DEF;
 
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h
index ec257a2..b81b8f0 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -81,6 +81,8 @@ typedef struct CollPair {
 	float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
 	int flag;
 	float time; // collision time, from 0 up to 1
+
+	/* mesh-mesh collision */
 #ifdef WITH_ELTOPO /*either ap* or bp* can be set, but not both*/
 	float bary[3];
 	int ap1, ap2, ap3, collp, bp1, bp2, bp3;
@@ -135,6 +137,8 @@ void bvhtree_update_from_mvert(BVHTree *bvhtree, struct MFace *faces, int numfac
 // defined in collisions.c
 void collision_move_object(struct CollisionModifierData *collmd, float step, float prevstep);
 
+void collision_get_collider_velocity(float vel_old[3], float vel_new[3], struct CollisionModifierData *collmd, struct CollPair *collpair);
+
 /////////////////////////////////////////////////
 // used in effect.c
 /////////////////////////////////////////////////
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index d5e54d8..04853bb 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -136,6 +136,36 @@ int get_effector_data(struct EffectorCache *eff, struct EffectorData *efd, struc
 /* EffectorData->flag */
 #define PE_VELOCITY_TO_IMPULSE  1
 
+/* ======== Simulation Debugging ======== */
+
+typedef struct SimDebugElement {
+	int category_hash;
+	int hash;
+	
+	int type;
+	float color[3];
+	
+	float v1[3], v2[3];
+} SimDebugElement;
+
+typedef enum eSimDebugElement_Type {
+	SIM_DEBUG_ELEM_DOT,
+	SIM_DEBUG_ELEM_LINE,
+	SIM_DEBUG_ELEM_VECTOR,
+} eSimDebugElement_Type;
+
+typedef struct SimDebugData {
+	struct GHash *gh;
+} SimDebugData;
+
+struct SimDebugData *BKE_sim_debug_da

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list