Revision: 16772
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16772
Author: ben2610
Date: 2008-09-27 23:52:20 +0200 (Sat, 27 Sep 2008)
Log Message:
-----------
BGE patch: create new BulletSoftBody data block to store bullet soft body
specific parameters.
Previously we tried to share the parameters with the
blender render soft body but there were too many differences.
MSVC project files updated.
Modified Paths:
--------------
trunk/blender/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
trunk/blender/source/blender/blenkernel/BKE_object.h
trunk/blender/source/blender/blenkernel/intern/object.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/blenloader/intern/writefile.c
trunk/blender/source/blender/makesdna/DNA_object_force.h
trunk/blender/source/blender/makesdna/DNA_object_types.h
trunk/blender/source/blender/src/buttons_logic.c
trunk/blender/source/blender/src/editobject.c
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
Modified:
trunk/blender/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
===================================================================
--- trunk/blender/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
2008-09-27 21:09:31 UTC (rev 16771)
+++ trunk/blender/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
2008-09-27 21:52:20 UTC (rev 16772)
@@ -366,6 +366,9 @@
RelativePath="..\..\..\source\blender\blenkernel\intern\brush.c">
</File>
<File
+
RelativePath="..\..\..\source\blender\blenkernel\intern\bullet.c">
+ </File>
+ <File
RelativePath="..\..\..\source\blender\blenkernel\intern\bvhutils.c">
</File>
<File
@@ -592,6 +595,9 @@
RelativePath="..\..\..\source\blender\blenkernel\BKE_brush.h">
</File>
<File
+
RelativePath="..\..\..\source\blender\blenkernel\BKE_bullet.h">
+ </File>
+ <File
RelativePath="..\..\..\source\blender\blenkernel\BKE_bvhutils.h">
</File>
<File
Modified: trunk/blender/source/blender/blenkernel/BKE_object.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_object.h 2008-09-27
21:09:31 UTC (rev 16771)
+++ trunk/blender/source/blender/blenkernel/BKE_object.h 2008-09-27
21:52:20 UTC (rev 16772)
@@ -41,6 +41,7 @@
struct BoundBox;
struct View3D;
struct SoftBody;
+struct BulletSoftBody;
struct Group;
struct bAction;
@@ -48,10 +49,12 @@
void copy_baseflags(void);
void copy_objectflags(void);
struct SoftBody *copy_softbody(struct SoftBody *sb);
+struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
void copy_object_particlesystems(struct Object *obn, struct Object *ob);
void copy_object_softbody(struct Object *obn, struct Object *ob);
void object_free_particlesystems(struct Object *ob);
void object_free_softbody(struct Object *ob);
+void object_free_bulletsoftbody(struct Object *ob);
void update_base_layer(struct Object *ob);
void free_object(struct Object *ob);
Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c 2008-09-27
21:09:31 UTC (rev 16771)
+++ trunk/blender/source/blender/blenkernel/intern/object.c 2008-09-27
21:52:20 UTC (rev 16772)
@@ -179,6 +179,14 @@
}
}
+void object_free_bulletsoftbody(Object *ob)
+{
+ if(ob->bsoft) {
+ sbFree(ob->bsoft);
+ ob->bsoft= NULL;
+ }
+}
+
void object_free_modifiers(Object *ob)
{
while (ob->modifiers.first) {
@@ -269,6 +277,7 @@
MEM_freeN(ob->pd);
}
if(ob->soft) sbFree(ob->soft);
+ if(ob->bsoft) bsbFree(ob->bsoft);
if(ob->gpulamp.first) GPU_lamp_free(ob);
}
@@ -1047,6 +1056,17 @@
return sbn;
}
+BulletSoftBody *copy_bulletsoftbody(BulletSoftBody *bsb)
+{
+ BulletSoftBody *bsbn;
+
+ if (bsb == NULL)
+ return NULL;
+ bsbn = MEM_dupallocN(bsb);
+ /* no pointer in this structure yet */
+ return bsbn;
+}
+
ParticleSystem *copy_particlesystem(ParticleSystem *psys)
{
ParticleSystem *psysn;
@@ -1217,6 +1237,7 @@
id_us_plus(&(obn->pd->tex->id));
}
obn->soft= copy_softbody(ob->soft);
+ obn->bsoft = copy_bulletsoftbody(ob->bsoft);
copy_object_particlesystems(obn, ob);
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2008-09-27
21:09:31 UTC (rev 16771)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2008-09-27
21:52:20 UTC (rev 16772)
@@ -141,6 +141,7 @@
#include "BKE_sca.h" // for init_actuator
#include "BKE_scene.h"
#include "BKE_softbody.h" // sbNew()
+#include "BKE_bullet.h" // bsbNew()
#include "BKE_sculpt.h"
#include "BKE_texture.h" // for open_plugin_tex
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER
TEST REND
@@ -3334,6 +3335,7 @@
if(sb->pointcache)
direct_link_pointcache(fd, sb->pointcache);
}
+ ob->bsoft= newdataadr(fd, ob->bsoft);
ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
link_list(fd, &ob->particlesystem);
Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c 2008-09-27
21:09:31 UTC (rev 16771)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c 2008-09-27
21:52:20 UTC (rev 16772)
@@ -922,6 +922,7 @@
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
writestruct(wd, DATA, "SoftBody", 1, ob->soft);
if(ob->soft) writestruct(wd, DATA, "PointCache", 1,
ob->soft->pointcache);
+ writestruct(wd, DATA, "BulletSoftBody", 1, ob->bsoft);
write_particlesystems(wd, &ob->particlesystem);
write_modifiers(wd, &ob->modifiers);
Modified: trunk/blender/source/blender/makesdna/DNA_object_force.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_force.h 2008-09-27
21:09:31 UTC (rev 16771)
+++ trunk/blender/source/blender/makesdna/DNA_object_force.h 2008-09-27
21:52:20 UTC (rev 16772)
@@ -84,6 +84,16 @@
float vec[4];
} SBVertex;
+typedef struct BulletSoftBody {
+ int flag; /* various boolean options */
+ float linStiff; /* linear stiffness 0..1 */
+ float angStiff; /* angular stiffness 0..1 */
+ float volume; /* volume preservation 0..1 */
+} BulletSoftBody;
+
+/* BulletSoftBody.flag */
+#define OB_BSB_SHAPE_MATCHING 2
+
typedef struct SoftBody {
struct ParticleSystem *particles; /* particlesystem softbody */
Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h 2008-09-27
21:09:31 UTC (rev 16771)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h 2008-09-27
21:52:20 UTC (rev 16772)
@@ -193,7 +193,9 @@
* bit 15: Always ignore activity culling
*/
int gameflag2;
- short softflag; /* softboday settings */
+ struct BulletSoftBody *bsoft; /* settings for game engine bullet soft
body */
+
+ short softflag; /* softbody settings */
short recalc; /* dependency flag */
float anisotropicFriction[3];
Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c 2008-09-27 21:09:31 UTC
(rev 16771)
+++ trunk/blender/source/blender/src/buttons_logic.c 2008-09-27 21:52:20 UTC
(rev 16772)
@@ -67,6 +67,7 @@
#include "BKE_property.h"
#include "BKE_property.h"
#include "BKE_utildefines.h"
+#include "BKE_bullet.h"
#include "BIF_gl.h"
#include "BIF_resources.h"
@@ -3007,28 +3008,27 @@
"Collision margin");
}
if (ob->gameflag & OB_SOFT_BODY) {
- if (ob->soft)
+ /* create a BulletSoftBody structure if not already existing */
+ if (!ob->bsoft)
+ ob->bsoft = bsbNew();
+ if (ob->bsoft)
{
-
- uiDefButBitS(block, TOG, OB_SB_GOAL, 0, "Shape
matching",
- xco+=120, yco, 118, 19,
&ob->softflag, 0, 0, 0, 0,
+ uiDefButBitI(block, TOG, OB_BSB_SHAPE_MATCHING, 0,
"Shape matching",
+ xco+=120, yco, 118, 19,
&ob->bsoft->flag, 0, 0, 0, 0,
"Enable soft body shape
matching goal");
yco -= 25;
xco = 0;
uiDefButF(block, NUMSLI, 0, "LinStiff ", xco, yco, 238,
19,
- &ob->soft->inspring, 0.0, 1.0, 1, 0,
+ &ob->bsoft->linStiff, 0.0, 1.0, 1, 0,
"Linear stiffness of the soft body
vertex spring");
- /*
yco -= 25;
uiDefButF(block, NUMSLI, 0, "AngStiff ", xco, yco, 238,
19,
- &ob->angularStiffness, 0.0, 1.0, 1, 0,
+ &ob->bsoft->angStiff, 0.0, 1.0, 1, 0,
"Angular stiffness of the soft body
vertex spring");
yco -= 25;
uiDefButF(block, NUMSLI, 0, "Volume ", xco, yco, 238,
19,
- &ob->volumePreservation, 0.0, 1.0, 1,
0,
+ &ob->bsoft->volume, 0.0, 1.0, 1, 0,
"Factor of soft body volume
preservation");
- */
-
}
}
@@ -3056,20 +3056,10 @@
ob->body_type = OB_BODY_TYPE_SOFT;
//only enable game soft body if Blender Soft Body exists
- if (ob->soft)
- {
- but = uiDefButS(block, MENU, REDRAWVIEW3D,
- "Object type%t|No
collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4",
- 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0,
"Selects the type of physical representation");
- uiButSetFunc(but, check_body_type, but, ob);
- } else
- {
- but = uiDefButS(block, MENU, REDRAWVIEW3D,
- "Object type%t|No
collision%x0|Static%x1|Dynamic%x2|Rigid body%x3",
- 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0,
"Selects the type of physical representation");
- uiButSetFunc(but, check_body_type, but, ob);
- }
-
+ but = uiDefButS(block, MENU, REDRAWVIEW3D,
+ "Object type%t|No
collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4",
+ 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects
the type of physical representation");
+ uiButSetFunc(but, check_body_type, but, ob);
if (ob->gameflag & OB_COLLISION) {
Modified: trunk/blender/source/blender/src/editobject.c
===================================================================
--- trunk/blender/source/blender/src/editobject.c 2008-09-27 21:09:31 UTC
(rev 16771)
+++ trunk/blender/source/blender/src/editobject.c 2008-09-27 21:52:20 UTC
(rev 16772)
@@ -3529,10 +3529,8 @@
base->object->boundtype =
ob->boundtype;
}
base->object->margin= ob->margin;
- //base->object->linearStiffness=
ob->linearStiffness;
- //base->object->angularStiffness=
ob->angularStiffness;
- //base->object->volumePreservation=
ob->volumePreservation;
- //base->object->gamesoftFlag=
ob->gamesoftFlag;
+ base->object->bsoft=
copy_bulletsoftbody(ob->bsoft);
+
}
else if(event==17) { /* tex space */
copy_texture_space(base->object, ob);
Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
2008-09-27 21:09:31 UTC (rev 16771)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
2008-09-27 21:52:20 UTC (rev 16772)
@@ -1324,19 +1324,19 @@
objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY)
!= 0;
///for game soft bodies
- if (blenderobject->soft)
+ if (blenderobject->bsoft)
{
- objprop.m_linearStiffness = blenderobject->soft->inspring;
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs