Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Genrich <daniel.genrich@gmx.net>2008-01-30 02:13:31 +0300
committerDaniel Genrich <daniel.genrich@gmx.net>2008-01-30 02:13:31 +0300
commit7a7a52226f52952534c93832c3e7b0492ec0ad30 (patch)
treeeef652aeff416bc8a3857172984d786c76861666
parent2e697f3b9395eb0eb1649997588f3e73a4e1ba8b (diff)
makes bullet independant from gameengine for cmake, introduces esc-key during sim, disables collisions when no bullet there
-rw-r--r--CMakeLists.txt3
-rw-r--r--extern/CMakeLists.txt6
-rw-r--r--source/blender/blenkernel/BKE_cloth.h21
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
-rw-r--r--source/blender/blenkernel/intern/collision.c6
-rw-r--r--source/blender/blenkernel/intern/implicit.c14
-rw-r--r--source/blender/blenkernel/intern/modifier.c1
-rw-r--r--source/blender/src/buttons_object.c7
-rw-r--r--tools/Blender.py2
9 files changed, 54 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 905fb6a2673..933203a459e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -408,6 +408,9 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
IF(WITH_GAMEENGINE)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DGAMEBLENDER ")
ENDIF(WITH_GAMEENGINE)
+IF(WITH_BULLET)
+ SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWITH_BULLET ")
+ENDIF(WITH_BULLET)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index db2584d012e..8d2e1f9dc9b 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -29,11 +29,11 @@
IF(WITH_GAMEENGINE)
SUBDIRS(qhull solid)
+ENDIF(WITH_GAMEENGINE)
- IF(WITH_BULLET)
+IF(WITH_BULLET)
SUBDIRS(bullet2)
- ENDIF(WITH_BULLET)
-ENDIF(WITH_GAMEENGINE)
+ENDIF(WITH_BULLET)
IF(WITH_INTERNATIONAL)
SUBDIRS(bFTGL)
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 530601fe5af..430a8fd50a6 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -130,14 +130,14 @@ ClothSpring;
typedef enum
{
CLOTH_SIMSETTINGS_FLAG_RESET = ( 1 << 1 ), // The CM object requires a reinitializaiton.
- CLOTH_SIMSETTINGS_FLAG_COLLOBJ = ( 1 << 2 ),// object is only collision object, no cloth simulation is done
- CLOTH_SIMSETTINGS_FLAG_GOAL = ( 1 << 3 ), // we have goals enabled
- CLOTH_SIMSETTINGS_FLAG_TEARING = ( 1 << 4 ),// true if tearing is enabled
- CLOTH_SIMSETTINGS_FLAG_CCACHE_PROTECT = ( 1 << 5 ), // true if tearing is enabled
- CLOTH_SIMSETTINGS_FLAG_EDITMODE = ( 1 << 6 ), // are we in editmode? -several things disabled
- CLOTH_SIMSETTINGS_FLAG_CCACHE_FFREE = (1 << 7), /* force cache freeing */
- CLOTH_SIMSETTINGS_FLAG_SCALING = (1 << 8), /* is advanced scaling active? */
- CLOTH_SIMSETTINGS_FLAG_LOADED = (1 << 9), /* did we just got load? */
+ CLOTH_SIMSETTINGS_FLAG_COLLOBJ = ( 1 << 2 ),// object is only collision object, no cloth simulation is done
+ CLOTH_SIMSETTINGS_FLAG_GOAL = ( 1 << 3 ), // we have goals enabled
+ CLOTH_SIMSETTINGS_FLAG_TEARING = ( 1 << 4 ),// true if tearing is enabled
+ CLOTH_SIMSETTINGS_FLAG_CCACHE_PROTECT = ( 1 << 5 ), // true if tearing is enabled
+ CLOTH_SIMSETTINGS_FLAG_EDITMODE = ( 1 << 6 ), // are we in editmode? -several things disabled
+ CLOTH_SIMSETTINGS_FLAG_CCACHE_FFREE = (1 << 7), /* force cache freeing */
+ CLOTH_SIMSETTINGS_FLAG_SCALING = (1 << 8), /* is advanced scaling active? */
+ CLOTH_SIMSETTINGS_FLAG_LOADED = (1 << 9), /* did we just got load? */
} CLOTH_SIMSETTINGS_FLAGS;
/* COLLISION FLAGS */
@@ -159,7 +159,7 @@ typedef enum
typedef enum
{
CLOTH_SPRING_FLAG_DEACTIVATE = ( 1 << 1 ),
- CLOTH_SPRING_FLAG_NEEDED = ( 1 << 2 ), // springs has values to be applied
+ CLOTH_SPRING_FLAG_NEEDED = ( 1 << 2 ), // springs has values to be applied
} CLOTH_SPRINGS_FLAGS;
/* Bits to or into the ClothVertex.flags. */
@@ -190,6 +190,9 @@ int implicit_init ( Object *ob, ClothModifierData *clmd );
int implicit_free ( ClothModifierData *clmd );
int implicit_solver ( Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors );
void implicit_set_positions ( ClothModifierData *clmd );
+
+// globally needed
+void clmdSetInterruptCallBack(int (*f)(void));
////////////////////////////////////////////////
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index f871a307325..dac77381175 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -639,6 +639,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *d
MEdge *medge = NULL;
MFace *mface = NULL;
DerivedMesh *result = NULL;
+ int ret = 0;
if(G.rt > 0)
printf("clothModifier_do start\n");
@@ -782,12 +783,17 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *d
// Call the solver.
if ( solvers [clmd->sim_parms->solver_type].solver )
- solvers [clmd->sim_parms->solver_type].solver ( ob, framenr, clmd, effectors );
+ {
+ ret = solvers [clmd->sim_parms->solver_type].solver ( ob, framenr, clmd, effectors );
+ }
tend();
// printf ( "Cloth simulation time: %f\n", ( float ) tval() );
-
- cloth_write_cache(ob, clmd, framenr);
+
+ if(ret)
+ cloth_write_cache(ob, clmd, framenr);
+ else
+ clmd->sim_parms->sim_time--;
// check for autoprotection
if(framenr >= clmd->sim_parms->autoprotect)
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 5946b842d85..7d2284e3193 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -680,9 +680,13 @@ void cloth_collision_static(ClothModifierData *clmd, CollisionModifierData *coll
if(i < 4)
{
// calc distance + normal
+#if WITH_BULLET == 1
distance = plNearestPoints(
verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector);
-
+#else
+ // just be sure that we don't add anything
+ distance = 2.0 * (epsilon + ALMOST_ZERO);
+#endif
if (distance <= (epsilon + ALMOST_ZERO))
{
// printf("dist: %f\n", (float)distance);
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index f56b94c97ce..72edef1766b 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -110,6 +110,10 @@ double itval()
return t2-t1;
}
#endif
+
+/* callbacks for errors and interrupts and some goo */
+static int (*CT_localInterruptCallBack)(void) = NULL;
+
/*
#define C99
#ifdef C99
@@ -1525,6 +1529,10 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
step += dt;
if(effectors) pdEndEffectors(effectors);
+
+ /* ask for user break */
+ if (CT_localInterruptCallBack && CT_localInterruptCallBack())
+ return 0;
}
for(i = 0; i < numverts; i++)
@@ -1569,3 +1577,9 @@ void implicit_set_positions (ClothModifierData *clmd)
if(G.rt > 0)
printf("implicit_set_positions\n");
}
+
+/* Cloth global visible functions */
+void clmdSetInterruptCallBack(int (*f)(void))
+{
+ CT_localInterruptCallBack = f;
+}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index d552fdad5c2..d243a8e3b3c 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -4960,6 +4960,7 @@ static void clothModifier_initData(ModifierData *md)
return;
cloth_init (clmd);
+ if(G.rt >0)
printf("clothModifier_initData\n");
}
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index b6d7d4afd5c..210eb286951 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -3304,7 +3304,7 @@ static void object_panel_deflection(Object *ob)
uiDefButF(block, NUM, B_DIFF, "Permeability: ", 160,80,150,20, &pd->pdef_perm, 0.0, 1.0, 10, 0, "Chance that the particle will pass through the mesh");
uiBlockEndAlign(block);
- uiDefBut(block, LABEL, 0, "Soft Body", 160,60,150,20, NULL, 0.0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, "Soft Body / Cloth", 160,60,150,20, NULL, 0.0, 0, 0, 0, "");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_FIELD_CHANGE, "Damping:", 160,40,150,20, &pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during soft body collision");
@@ -5123,6 +5123,9 @@ static void object_panel_cloth(Object *ob)
int defCount;
char *clvg1, *clvg2;
char clmvg [] = "Vertex Groups%t|";
+
+ clmdSetInterruptCallBack(blender_test_break); // make softbody module ESC aware
+ G.afbreek=0; // init global break system
val2=0;
@@ -5265,7 +5268,7 @@ static void object_panel_cloth_II(Object *ob)
{
uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Min Distance:", 160,60,150,20, &clmd->coll_parms->epsilon, 0.001f, 1.0, 0.01f, 0, "Minimum distance between collision objects before collision response takes in, can be changed for each frame");
uiDefButS(block, NUM, REDRAWBUTSOBJECT, "Collision Quality:", 10,40,150,20, &clmd->coll_parms->loop_count, 1.0, 100.0, 1.0, 0, "How many collision iterations should be done. (higher = better = slower), can be changed for each frame");
- uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Friction:", 160,40,150,20, &clmd->coll_parms->friction, 1.0, 100.0, 1.0, 0, "Friction force if a collision happened");
+ uiDefButF(block, NUM, REDRAWBUTSOBJECT, "Friction:", 160,40,150,20, &clmd->coll_parms->friction, 1.0, 100.0, 1.0, 0, "Friction force if a collision happened (high=slower movement when collided)");
}
else
uiDefBut(block, LABEL, 0, "",160,60,150,20, NULL, 0.0, 0, 0, 0, "");
diff --git a/tools/Blender.py b/tools/Blender.py
index 77262d6eaaf..06ffba6912c 100644
--- a/tools/Blender.py
+++ b/tools/Blender.py
@@ -392,6 +392,8 @@ class BlenderEnvironment(SConsEnvironment):
lenv.Append(CPPDEFINES=defines)
if lenv['WITH_BF_GAMEENGINE']:
lenv.Append(CPPDEFINES=['GAMEBLENDER=1'])
+ if lenv['WITH_BF_BULLET']:
+ lenv.Append(CPPDEFINES=['WITH_BULLET=1'])
# debug or not
# CXXFLAGS defaults to CCFLAGS, therefore
# we Replace() rather than Append() to CXXFLAGS the first time