make bullet optional again

This commit is contained in:
Campbell Barton 2013-01-23 07:26:39 +00:00
parent 4544c234f5
commit 69ddc5eb99
30 changed files with 247 additions and 104 deletions

@ -106,7 +106,10 @@ add_subdirectory(nodes)
add_subdirectory(modifiers)
add_subdirectory(makesdna)
add_subdirectory(makesrna)
add_subdirectory(rigidbody)
if(WITH_BULLET)
add_subdirectory(rigidbody)
endif()
if(WITH_COMPOSITOR)
add_subdirectory(opencl) # later on this may be used more generally

@ -37,7 +37,6 @@ set(INC
../modifiers
../nodes
../render/extern/include
../rigidbody
../../../intern/guardedalloc
../../../intern/iksolver/extern
../../../intern/memutil
@ -264,7 +263,10 @@ if(WITH_BULLET)
list(APPEND INC_SYS
${BULLET_INCLUDE_DIRS}
)
add_definitions(-DUSE_BULLET)
list(APPEND INC
../rigidbody
)
add_definitions(-DWITH_BULLET)
endif()
#if(WITH_MOD_CLOTH_ELTOPO)

@ -111,7 +111,7 @@ if env['WITH_BF_QUICKTIME']:
incs += ' ' + env['BF_QUICKTIME_INC']
if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
defs.append('WITH_BULLET')
if env['OURPLATFORM'] == 'darwin':
if env['WITH_BF_OPENMP']:

@ -59,7 +59,7 @@
#include "BKE_modifier.h"
#include "BKE_DerivedMesh.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "Bullet-C-Api.h"
#endif
#include "BLI_kdopbvh.h"
@ -385,7 +385,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
CollisionModifierData *collmd = (CollisionModifierData *) md2;
/* Cloth *cloth = clmd->clothObject; */ /* UNUSED */
MFace *face1=NULL, *face2 = NULL;
#ifdef USE_BULLET
#ifdef WITH_BULLET
ClothVertex *verts1 = clmd->clothObject->verts;
#endif
double distance = 0;
@ -458,7 +458,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
}
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
// calc distance + normal
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 );

@ -73,7 +73,9 @@
#include "BIK_api.h"
#include "RBI_api.h"
#ifdef WITH_BULLET
# include "RBI_api.h"
#endif
/* both in intern */
#ifdef WITH_SMOKE
@ -883,10 +885,10 @@ static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUS
RigidBodyOb *rbo = ob->rigidbody_object;
if (rbo->type == RBO_TYPE_ACTIVE) {
#ifdef WITH_BULLET
RB_body_get_position(rbo->physics_object, rbo->pos);
RB_body_get_orientation(rbo->physics_object, rbo->orn);
#endif
PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, rbo->pos);
PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, rbo->orn);
}

@ -42,7 +42,9 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "RBI_api.h"
#ifdef WITH_BULLET
# include "RBI_api.h"
#endif
#include "DNA_anim_types.h"
#include "DNA_group_types.h"
@ -66,6 +68,8 @@
#include "RNA_access.h"
#ifdef WITH_BULLET
/* ************************************** */
/* Memory Management */
@ -1210,3 +1214,36 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
}
}
/* ************************************** */
#else /* WITH_BULLET */
/* stubs */
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
void BKE_rigidbody_free_world(RigidBodyWorld *rbw) {}
void BKE_rigidbody_free_object(Object *ob) {}
void BKE_rigidbody_free_constraint(Object *ob) {}
struct RigidBodyOb *BKE_rigidbody_copy_object(Object *ob) { return NULL; }
struct RigidBodyCon *BKE_rigidbody_copy_constraint(Object *ob) { return NULL; }
void BKE_rigidbody_validate_sim_shape(Object *ob, short rebuild) {}
void BKE_rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, short rebuild) {}
void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, short rebuild) {}
void BKE_rigidbody_validate_sim_world(Scene *scene, RigidBodyWorld *rbw, short rebuild) {}
struct RigidBodyWorld *BKE_rigidbody_create_world(Scene *scene) { return NULL; }
struct RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type) { return NULL; }
struct RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, short type) { return NULL; }
struct RigidBodyWorld *BKE_rigidbody_get_world(Scene *scene) { return NULL; }
void BKE_rigidbody_remove_object(Scene *scene, Object *ob) {}
void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob) {}
void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime) {}
void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) {}
void BKE_rigidbody_do_simulation(Scene *scene, float ctime) {}
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
#endif /* WITH_BULLET */

@ -1606,7 +1606,7 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname)
RNAUpdateCb *cb;
uiBlock *block;
uiBut *but;
rctf rect;
// rctf rect; /* UNUSED */
int icon;
if (!prop || RNA_property_type(prop) != PROP_ENUM)
@ -1618,8 +1618,8 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname)
cb->ptr = *ptr;
cb->prop = prop;
rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
rect.ymin = 0; rect.ymax = 10.0f * UI_UNIT_X;
// rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
// rect.ymin = 0; rect.ymax = 10.0f * UI_UNIT_X;
block = uiLayoutAbsoluteBlock(layout);

@ -27,7 +27,6 @@ set(INC
../../makesdna
../../makesrna
../../windowmanager
../../rigidbody
../../../../intern/elbeem/extern
../../../../intern/guardedalloc
)
@ -63,4 +62,11 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
if(WITH_BULLET)
list(APPEND INC
../../rigidbody
)
add_definitions(-DWITH_BULLET)
endif()
blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}")

@ -40,7 +40,9 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "RBI_api.h"
#ifdef WITH_BULLET
# include "RBI_api.h"
#endif
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@ -170,8 +172,9 @@ static int rigidbody_world_export_exec(bContext *C, wmOperator *op)
}
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_BULLET
RB_dworld_export(rbw->physics_world, path);
#endif
return OPERATOR_FINISHED;
}

@ -238,6 +238,13 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
if(WITH_BULLET)
list(APPEND INC
../../rigidbody
)
add_definitions(-DWITH_BULLET)
endif()
# Build makesrna executable
blender_include_dirs(
.
@ -254,7 +261,6 @@ blender_include_dirs(
../../windowmanager
../../editors/include
../../render/extern/include
../../rigidbody
../../../../intern/audaspace/intern
../../../../intern/cycles/blender
../../../../intern/guardedalloc

@ -73,7 +73,9 @@ EnumPropertyItem rigidbody_con_type_items[] = {
#ifdef RNA_RUNTIME
#include "RBI_api.h"
#ifdef WITH_BULLET
# include "RBI_api.h"
#endif
#include "BKE_depsgraph.h"
#include "BKE_rigidbody.h"
@ -105,9 +107,12 @@ static void rna_RigidBodyWorld_num_solver_iterations_set(PointerRNA *ptr, int va
RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
rbw->num_solver_iterations = value;
if (rbw->physics_world)
#ifdef WITH_BULLET
if (rbw->physics_world) {
RB_dworld_set_solver_iterations(rbw->physics_world, value);
}
#endif
}
static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value)
@ -115,9 +120,12 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value)
RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
if (rbw->physics_world)
#ifdef WITH_BULLET
if (rbw->physics_world) {
RB_dworld_set_split_impulse(rbw->physics_world, value);
}
#endif
}
/* ******************************** */
@ -152,9 +160,12 @@ static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value)
rbo->type = value;
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
#ifdef WITH_BULLET
/* do physics sim updates */
if (rbo->physics_object)
if (rbo->physics_object) {
RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
}
#endif
}
static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
@ -162,13 +173,15 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
RB_FLAG_SET(rbo->flag, !value, RBO_FLAG_DISABLED);
#ifdef WITH_BULLET
/* update kinematic state if necessary - only needed for active bodies */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
RB_body_set_kinematic_state(rbo->physics_object, !value);
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
#endif
}
static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value)
@ -180,10 +193,13 @@ static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value)
/* force creation of new collision shape reflecting this */
BKE_rigidbody_validate_sim_shape(ob, TRUE);
#ifdef WITH_BULLET
/* now tell RB sim about it */
if (rbo->physics_object && rbo->physics_shape)
if (rbo->physics_object && rbo->physics_shape) {
RB_body_set_collision_shape(rbo->physics_object, rbo->physics_shape);
}
#endif
}
@ -192,10 +208,13 @@ static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->mass = value;
#ifdef WITH_BULLET
/* only active bodies need mass update */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE))
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
}
#endif
}
static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value)
@ -203,9 +222,12 @@ static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->friction = value;
if (rbo->physics_object)
#ifdef WITH_BULLET
if (rbo->physics_object) {
RB_body_set_friction(rbo->physics_object, value);
}
#endif
}
static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value)
@ -213,9 +235,11 @@ static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->restitution = value;
if (rbo->physics_object)
#ifdef WITH_BULLET
if (rbo->physics_object) {
RB_body_set_restitution(rbo->physics_object, value);
}
#endif
}
static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value)
@ -223,9 +247,12 @@ static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->margin = value;
if (rbo->physics_shape)
#ifdef WITH_BULLET
if (rbo->physics_shape) {
RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo));
}
#endif
}
static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, int value)
@ -233,13 +260,15 @@ static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, int value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
RB_FLAG_SET(rbo->flag, value, RBO_FLAG_KINEMATIC);
#ifdef WITH_BULLET
/* update kinematic state if necessary */
if (rbo->physics_object) {
RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
RB_body_set_kinematic_state(rbo->physics_object, value);
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
#endif
}
static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, int value)
@ -247,10 +276,13 @@ static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, int value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
RB_FLAG_SET(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
#ifdef WITH_BULLET
/* update activation state if necessary - only active bodies can be deactivated */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE))
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_activation_state(rbo->physics_object, value);
}
#endif
}
static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value)
@ -258,10 +290,13 @@ static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->lin_sleep_thresh = value;
#ifdef WITH_BULLET
/* only active bodies need sleep threshold update */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE))
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_linear_sleep_thresh(rbo->physics_object, value);
}
#endif
}
static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value)
@ -269,10 +304,13 @@ static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->ang_sleep_thresh = value;
#ifdef WITH_BULLET
/* only active bodies need sleep threshold update */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE))
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_angular_sleep_thresh(rbo->physics_object, value);
}
#endif
}
static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value)
@ -280,10 +318,13 @@ static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->lin_damping = value;
#ifdef WITH_BULLET
/* only active bodies need damping update */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE))
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_linear_damping(rbo->physics_object, value);
}
#endif
}
static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value)
@ -291,10 +332,13 @@ static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value)
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
rbo->ang_damping = value;
#ifdef WITH_BULLET
/* only active bodies need damping update */
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE))
if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
RB_body_set_angular_damping(rbo->physics_object, value);
}
#endif
}
static char *rna_RigidBodyCon_path(PointerRNA *ptr)
@ -317,8 +361,11 @@ static void rna_RigidBodyCon_enabled_set(PointerRNA *ptr, int value)
RB_FLAG_SET(rbc->flag, value, RBC_FLAG_ENABLED);
if (rbc->physics_constraint)
#ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_enabled(rbc->physics_constraint, value);
}
#endif
}
static void rna_RigidBodyCon_disable_collisions_set(PointerRNA *ptr, int value)
@ -336,13 +383,19 @@ static void rna_RigidBodyCon_use_breaking_set(PointerRNA *ptr, int value)
if (value) {
rbc->flag |= RBC_FLAG_USE_BREAKING;
if (rbc->physics_constraint)
#ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_breaking_threshold(rbc->physics_constraint, rbc->breaking_threshold);
}
#endif
}
else {
rbc->flag &= ~RBC_FLAG_USE_BREAKING;
if (rbc->physics_constraint)
#ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_breaking_threshold(rbc->physics_constraint, FLT_MAX);
}
#endif
}
}
@ -352,8 +405,11 @@ static void rna_RigidBodyCon_breaking_threshold_set(PointerRNA *ptr, float value
rbc->breaking_threshold = value;
if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_USE_BREAKING))
#ifdef WITH_BULLET
if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_USE_BREAKING)) {
RB_constraint_set_breaking_threshold(rbc->physics_constraint, value);
}
#endif
}
static void rna_RigidBodyCon_override_solver_iterations_set(PointerRNA *ptr, int value)
@ -362,13 +418,19 @@ static void rna_RigidBodyCon_override_solver_iterations_set(PointerRNA *ptr, int
if (value) {
rbc->flag |= RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
if (rbc->physics_constraint)
#ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_solver_iterations(rbc->physics_constraint, rbc->num_solver_iterations);
}
#endif
}
else {
rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
if (rbc->physics_constraint)
#ifdef WITH_BULLET
if (rbc->physics_constraint) {
RB_constraint_set_solver_iterations(rbc->physics_constraint, -1);
}
#endif
}
}
@ -378,8 +440,11 @@ static void rna_RigidBodyCon_num_solver_iterations_set(PointerRNA *ptr, int valu
rbc->num_solver_iterations = value;
if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS))
#ifdef WITH_BULLET
if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS)) {
RB_constraint_set_solver_iterations(rbc->physics_constraint, value);
}
#endif
}
static void rna_RigidBodyCon_spring_stiffness_x_set(PointerRNA *ptr, float value)
@ -388,8 +453,11 @@ static void rna_RigidBodyCon_spring_stiffness_x_set(PointerRNA *ptr, float value
rbc->spring_stiffness_x = value;
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_X))
#ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_X)) {
RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_X, value);
}
#endif
}
static void rna_RigidBodyCon_spring_stiffness_y_set(PointerRNA *ptr, float value)
@ -398,8 +466,11 @@ static void rna_RigidBodyCon_spring_stiffness_y_set(PointerRNA *ptr, float value
rbc->spring_stiffness_y = value;
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Y))
#ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Y)) {
RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Y, value);
}
#endif
}
static void rna_RigidBodyCon_spring_stiffness_z_set(PointerRNA *ptr, float value)
@ -408,8 +479,11 @@ static void rna_RigidBodyCon_spring_stiffness_z_set(PointerRNA *ptr, float value
rbc->spring_stiffness_z = value;
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Z))
#ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Z)) {
RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Z, value);
}
#endif
}
static void rna_RigidBodyCon_spring_damping_x_set(PointerRNA *ptr, float value)
@ -418,8 +492,11 @@ static void rna_RigidBodyCon_spring_damping_x_set(PointerRNA *ptr, float value)
rbc->spring_damping_x = value;
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_X))
#ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_X)) {
RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_X, value);
}
#endif
}
static void rna_RigidBodyCon_spring_damping_y_set(PointerRNA *ptr, float value)
@ -427,9 +504,11 @@ static void rna_RigidBodyCon_spring_damping_y_set(PointerRNA *ptr, float value)
RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
rbc->spring_damping_y = value;
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Y))
#ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Y)) {
RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Y, value);
}
#endif
}
static void rna_RigidBodyCon_spring_damping_z_set(PointerRNA *ptr, float value)
@ -437,9 +516,11 @@ static void rna_RigidBodyCon_spring_damping_z_set(PointerRNA *ptr, float value)
RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
rbc->spring_damping_z = value;
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Z))
#ifdef WITH_BULLET
if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Z)) {
RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Z, value);
}
#endif
}
#else

@ -136,7 +136,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
* in other scenes when compositing */
if (bmd->object != ob) {
/* weak! - but we can too easy end up with circular dep crash otherwise */
if (modifiers_findByType(bmd->object, eModifierType_Boolean) == false) {
if (modifiers_findByType(bmd->object, eModifierType_Boolean) == NULL) {
dm = mesh_get_derived_final(md->scene, bmd->object, CD_MASK_MESH);
}
else {

@ -856,7 +856,6 @@ endif()
bf_modifiers
bf_bmesh
bf_blenkernel
bf_rigidbody
bf_nodes
bf_gpu
bf_blenloader
@ -971,6 +970,10 @@ endif()
list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
endif()
if(WITH_BULLET)
list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_rigidbody")
endif()
if(WITH_BULLET AND NOT WITH_BULLET_SYSTEM)
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()

@ -73,7 +73,7 @@ if(WITH_BULLET)
list(APPEND INC_SYS
${BULLET_INCLUDE_DIRS}
)
add_definitions(-DUSE_BULLET)
add_definitions(-DWITH_BULLET)
endif()

@ -164,7 +164,7 @@ extern Material defmaterial; /* material.c */
#include "SG_Tree.h"
#include "KX_ConvertPhysicsObject.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "CcdPhysicsEnvironment.h"
#include "CcdGraphicController.h"
#endif
@ -1526,7 +1526,7 @@ static void BL_CreateGraphicObjectNew(KX_GameObject* gameobj,
{
switch (physics_engine)
{
#ifdef USE_BULLET
#ifdef WITH_BULLET
case UseBullet:
{
CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
@ -1829,7 +1829,7 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
switch (physics_engine)
{
#ifdef USE_BULLET
#ifdef WITH_BULLET
case UseBullet:
KX_ConvertBulletObject(gameobj, meshobj, dm, kxscene, shapeprops, smmaterial, &objprop);
break;
@ -1980,7 +1980,7 @@ static KX_GameObject *gameobject_from_blenderobject(
bool bHasDvert = mesh->dvert != NULL && ob->defbase.first;
bool bHasArmature = (BL_ModifierDeformer::HasArmatureDeformer(ob) && ob->parent && ob->parent->type == OB_ARMATURE && bHasDvert);
bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(ob);
#ifdef USE_BULLET
#ifdef WITH_BULLET
bool bHasSoftBody = (!ob->parent && (ob->gameflag & OB_SOFT_BODY));
#endif
if (bHasModifier) {
@ -2007,7 +2007,7 @@ static KX_GameObject *gameobject_from_blenderobject(
BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj,
ob, meshobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
#ifdef USE_BULLET
#ifdef WITH_BULLET
} else if (bHasSoftBody) {
KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);

@ -114,7 +114,7 @@ if(WITH_BULLET)
list(APPEND INC_SYS
${BULLET_INCLUDE_DIRS}
)
add_definitions(-DUSE_BULLET)
add_definitions(-DWITH_BULLET)
endif()
if(WITH_AUDASPACE)

@ -55,7 +55,7 @@
#include "KX_ConvertPhysicsObject.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "CcdPhysicsEnvironment.h"
#endif
@ -193,7 +193,7 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter()
itm++;
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
KX_ClearBulletSharedShapes();
#endif
@ -254,7 +254,7 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name)
}
#include "KX_PythonInit.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "LinearMath/btIDebugDraw.h"
@ -348,7 +348,7 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
switch (physics_engine)
{
#ifdef USE_BULLET
#ifdef WITH_BULLET
case UseBullet:
{
CcdPhysicsEnvironment* ccdPhysEnv = new CcdPhysicsEnvironment(useDbvtCulling);
@ -398,7 +398,7 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
//that would result from this is fixed in RemoveScene()
m_map_mesh_to_gamemesh.clear();
#ifndef USE_BULLET
#ifndef WITH_BULLET
/* quiet compiler warning */
(void)useDbvtCulling;
#endif

@ -42,7 +42,7 @@
#include "CTR_Map.h"
#include "CTR_HashedPtr.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "CcdPhysicsEnvironment.h"
#include "CcdPhysicsController.h"

@ -64,7 +64,7 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
defs.append('WITH_CXX_GUARDEDALLOC')
if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
defs.append('WITH_BULLET')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']

@ -254,7 +254,7 @@ if(WITH_BULLET)
list(APPEND INC
${BULLET_INCLUDE_DIRS}
)
add_definitions(-DUSE_BULLET)
add_definitions(-DWITH_BULLET)
endif()
blender_add_lib(ge_logic_ketsji "${SRC}" "${INC}" "${INC_SYS}")

@ -4,7 +4,7 @@
//under visual studio the #define in KX_ConvertPhysicsObject.h is quicker for recompilation
#include "KX_ConvertPhysicsObject.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "KX_BulletPhysicsController.h"
@ -536,4 +536,4 @@ const char* KX_BulletPhysicsController::getName()
return 0;
}
#endif // USE_BULLET
#endif // WITH_BULLET

@ -8,7 +8,7 @@
#include "KX_IPhysicsController.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "CcdPhysicsController.h"
#endif
@ -25,7 +25,7 @@ private:
btCollisionShape* m_bulletChildShape;
public:
#ifdef USE_BULLET
#ifdef WITH_BULLET
KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool character, bool compound);
virtual ~KX_BulletPhysicsController ();
#endif

@ -145,7 +145,7 @@ void KX_ConvertDynamoObject(KX_GameObject* gameobj,
struct KX_ObjectProperties* objprop);
#ifdef USE_BULLET
#ifdef WITH_BULLET
void KX_ConvertBulletObject( class KX_GameObject* gameobj,
class RAS_MeshObject* meshobj,

@ -58,7 +58,7 @@ extern "C"{
#include "BKE_DerivedMesh.h"
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "BulletSoftBody/btSoftBody.h"
#include "CcdPhysicsEnvironment.h"
@ -574,4 +574,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro
spc->ReplaceControllerShape(bm);
return true;
}
#endif // USE_BULLET
#endif // WITH_BULLET

@ -1777,7 +1777,7 @@ PyObject *KX_GameObject::PyReinstancePhysicsMesh(PyObject *args)
) {
return NULL;
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
/* gameobj and mesh can be NULL */
if (KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh))
Py_RETURN_TRUE;

@ -43,7 +43,7 @@
#include "PyObjectPlus.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
# include "LinearMath/btIDebugDraw.h"
#endif
@ -716,7 +716,7 @@ PyObject *initPythonConstraintBinding()
PyDict_SetItemString(d, "error", ErrorObject);
Py_DECREF(ErrorObject);
#ifdef USE_BULLET
#ifdef WITH_BULLET
//Debug Modes constants to be used with setDebugMode() python function
KX_MACRO_addTypesToDict(d, DBG_NODEBUG, btIDebugDraw::DBG_NoDebug);
KX_MACRO_addTypesToDict(d, DBG_DRAWWIREFRAME, btIDebugDraw::DBG_DrawWireframe);
@ -732,7 +732,7 @@ PyObject *initPythonConstraintBinding()
KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTS, btIDebugDraw::DBG_DrawConstraints);
KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTLIMITS, btIDebugDraw::DBG_DrawConstraintLimits);
KX_MACRO_addTypesToDict(d, DBG_FASTWIREFRAME, btIDebugDraw::DBG_FastWireframe);
#endif // USE_BULLET
#endif // WITH_BULLET
//Constraint types to be used with createConstraint() python function
KX_MACRO_addTypesToDict(d, POINTTOPOINT_CONSTRAINT, PHY_POINT2POINT_CONSTRAINT);

@ -88,7 +88,7 @@
#include "BL_DeformableGameObject.h"
#include "KX_ObstacleSimulation.h"
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "KX_SoftBodyDeformer.h"
#include "KX_ConvertPhysicsObject.h"
#include "CcdPhysicsEnvironment.h"
@ -1131,7 +1131,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
blendobj->parent && // original object had armature (not sure this test is needed)
blendobj->parent->type == OB_ARMATURE &&
blendmesh->dvert!=NULL; // mesh has vertex group
#ifdef USE_BULLET
#ifdef WITH_BULLET
bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY));
#endif
bool releaseParent = true;
@ -1222,7 +1222,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
);
newobj->SetDeformer(meshdeformer);
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
else if (bHasSoftBody)
{
KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj);
@ -1239,7 +1239,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
gameobj->AddMeshUser();
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
if (use_phys) { /* update the new assigned mesh with the physics mesh */
KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh);
}
@ -1756,7 +1756,7 @@ short KX_Scene::GetAnimationFPS()
return m_blenderScene->r.frs_sec;
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "KX_BulletPhysicsController.h"
#endif
@ -1768,7 +1768,7 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
brick->Replace_NetworkScene(to->GetNetworkScene());
/* near sensors have physics controllers */
#ifdef USE_BULLET
#ifdef WITH_BULLET
KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick);
if (touch_sensor) {
touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
@ -1789,7 +1789,7 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
}
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
#include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
#include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
#include "KX_BulletPhysicsController.h"
@ -1858,7 +1858,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
for (int i=0; i<children.size(); i++)
children[i]->SetSGClientInfo(to);
}
#ifdef USE_BULLET
#ifdef WITH_BULLET
SGControllerList::iterator contit;
SGControllerList& controllers = sg->GetSGControllerList();
for (contit = controllers.begin();contit!=controllers.end();++contit)
@ -1867,7 +1867,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
if (phys_ctrl)
phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
}
#endif // USE_BULLET
#endif // WITH_BULLET
}
/* If the object is a light, update it's scene */
if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT)
@ -1886,7 +1886,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
bool KX_Scene::MergeScene(KX_Scene *other)
{
#ifdef USE_BULLET
#ifdef WITH_BULLET
CcdPhysicsEnvironment *env= dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment());
CcdPhysicsEnvironment *env_other= dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment());
@ -1896,7 +1896,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL));
return false;
}
#endif // USE_BULLET
#endif // WITH_BULLET
if (GetSceneConverter() != other->GetSceneConverter()) {
printf("KX_Scene::MergeScene: converters differ, aborting\n");
@ -1939,7 +1939,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
GetLightList()->MergeList(other->GetLightList());
other->GetLightList()->ReleaseAndRemoveAll();
#ifdef USE_BULLET
#ifdef WITH_BULLET
if (env) /* bullet scene? - dummy scenes don't need touching */
env->MergeEnvironment(env_other);
#endif

@ -71,7 +71,7 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
defs.append('WITH_CXX_GUARDEDALLOC')
if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
defs.append('WITH_BULLET')
incs += ' #source/gameengine/Physics/Bullet'
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):

@ -62,7 +62,7 @@ if(WITH_BULLET)
list(APPEND INC
${BULLET_INCLUDE_DIRS}
)
add_definitions(-DUSE_BULLET)
add_definitions(-DWITH_BULLET)
endif()
blender_add_lib(ge_phys_bullet "${SRC}" "${INC}" "${INC_SYS}")

@ -56,6 +56,6 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
defs.append('WITH_CXX_GUARDEDALLOC')
if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
defs.append('WITH_BULLET')
env.BlenderLib ( 'ge_phys_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])