diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_rigidbody_types.h | 42 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rigidbody.c | 4 | ||||
-rw-r--r-- | source/blender/rigidbody/rb_bullet_api.cpp | 49 |
6 files changed, 54 insertions, 51 deletions
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index c2b64f5892c..2cbd0ebcb0a 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -466,7 +466,7 @@ void BKE_rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, short re RB_body_set_linear_factor(rbo->physics_object, - (ob->protectflag & OB_LOCK_LOCX) == 0, + (ob->protectflag & OB_LOCK_LOCX) == 0, (ob->protectflag & OB_LOCK_LOCY) == 0, (ob->protectflag & OB_LOCK_LOCZ) == 0); RB_body_set_angular_factor(rbo->physics_object, diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1ebafd20971..8afe07b4689 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1882,7 +1882,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha) UI_ThemeColor(TH_TEXT_HI); BLF_clipping(fontid, rect.xmin, rect.ymin, rect.xmax, rect.ymax); BLF_enable(fontid, BLF_CLIPPING); - BLF_position(fontid, rect.xmin + 0.6f * U.widget_unit, rect.ymin + 0.3f*U.widget_unit, 0.0f); + BLF_position(fontid, rect.xmin + 0.6f * U.widget_unit, rect.ymin + 0.3f * U.widget_unit, 0.0f); BLF_draw(fontid, text, BLF_DRAW_STR_DUMMY_MAX); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index ffc780ebf69..cca1858f112 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1169,9 +1169,9 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED( /* draw title (node label) */ BLI_strncpy(showname, node->label, sizeof(showname)); uiDefBut(node->block, LABEL, 0, showname, - (int)(rct->xmin-NODE_DYS), (int)(rct->ymax), - (short)512, (short)NODE_DY, - NULL, 0, 0, 0, 0, ""); + (int)(rct->xmin - NODE_DYS), (int)(rct->ymax), + (short)512, (short)NODE_DY, + NULL, 0, 0, 0, 0, NULL); } /* only draw input socket. as they all are placed on the same position. diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h index e24b24deece..b70687be725 100644 --- a/source/blender/makesdna/DNA_rigidbody_types.h +++ b/source/blender/makesdna/DNA_rigidbody_types.h @@ -136,19 +136,19 @@ typedef enum eRigidBodyOb_Type { /* Flags for RigidBodyOb */ typedef enum eRigidBodyOb_Flag { /* rigidbody is kinematic (controlled by the animation system) */ - RBO_FLAG_KINEMATIC = (1<<0), + RBO_FLAG_KINEMATIC = (1 << 0), /* rigidbody needs to be validated (usually set after duplicating and not hooked up yet) */ - RBO_FLAG_NEEDS_VALIDATE = (1<<1), + RBO_FLAG_NEEDS_VALIDATE = (1 << 1), /* rigidbody shape needs refreshing (usually after exiting editmode) */ - RBO_FLAG_NEEDS_RESHAPE = (1<<2), + RBO_FLAG_NEEDS_RESHAPE = (1 << 2), /* rigidbody can be deactivated */ - RBO_FLAG_USE_DEACTIVATION = (1<<3), + RBO_FLAG_USE_DEACTIVATION = (1 << 3), /* rigidbody is deactivated at the beginning of simulation */ - RBO_FLAG_START_DEACTIVATED = (1<<4), + RBO_FLAG_START_DEACTIVATED = (1 << 4), /* rigidbody is not dynamically simulated */ - RBO_FLAG_DISABLED = (1<<5), + RBO_FLAG_DISABLED = (1 << 5), /* collision margin is not embedded (only used by convex hull shapes for now) */ - RBO_FLAG_USE_MARGIN = (1<<6) + RBO_FLAG_USE_MARGIN = (1 << 6) } eRigidBodyOb_Flag; /* RigidBody Collision Shape */ @@ -250,26 +250,26 @@ typedef enum eRigidBodyCon_Type { /* Flags for RigidBodyCon */ typedef enum eRigidBodyCon_Flag { /* constraint influences rigid body motion */ - RBC_FLAG_ENABLED = (1<<0), + RBC_FLAG_ENABLED = (1 << 0), /* constraint needs to be validated */ - RBC_FLAG_NEEDS_VALIDATE = (1<<1), + RBC_FLAG_NEEDS_VALIDATE = (1 << 1), /* allow constrained bodies to collide */ - RBC_FLAG_DISABLE_COLLISIONS = (1<<2), + RBC_FLAG_DISABLE_COLLISIONS = (1 << 2), /* constraint can break */ - RBC_FLAG_USE_BREAKING = (1<<3), + RBC_FLAG_USE_BREAKING = (1 << 3), /* constraint use custom number of constraint solver iterations */ - RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS = (1<<4), + RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS = (1 << 4), /* limits */ - RBC_FLAG_USE_LIMIT_LIN_X = (1<<5), - RBC_FLAG_USE_LIMIT_LIN_Y = (1<<6), - RBC_FLAG_USE_LIMIT_LIN_Z = (1<<7), - RBC_FLAG_USE_LIMIT_ANG_X = (1<<8), - RBC_FLAG_USE_LIMIT_ANG_Y = (1<<9), - RBC_FLAG_USE_LIMIT_ANG_Z = (1<<10), + RBC_FLAG_USE_LIMIT_LIN_X = (1 << 5), + RBC_FLAG_USE_LIMIT_LIN_Y = (1 << 6), + RBC_FLAG_USE_LIMIT_LIN_Z = (1 << 7), + RBC_FLAG_USE_LIMIT_ANG_X = (1 << 8), + RBC_FLAG_USE_LIMIT_ANG_Y = (1 << 9), + RBC_FLAG_USE_LIMIT_ANG_Z = (1 << 10), /* springs */ - RBC_FLAG_USE_SPRING_X = (1<<11), - RBC_FLAG_USE_SPRING_Y = (1<<12), - RBC_FLAG_USE_SPRING_Z = (1<<13) + RBC_FLAG_USE_SPRING_X = (1 << 11), + RBC_FLAG_USE_SPRING_Y = (1 << 12), + RBC_FLAG_USE_SPRING_Z = (1 << 13) } eRigidBodyCon_Flag; /* ******************************** */ diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 7f487a646eb..c1eb3b9b000 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -538,13 +538,13 @@ static void rna_def_rigidbody_world(BlenderRNA *brna) /* groups */ prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Group"); - RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_ui_text(prop, "Group", "Group containing objects participating in this simulation"); RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset"); prop = RNA_def_property(srna, "constraints", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Group"); - RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_ui_text(prop, "Constraints", "Group containing rigid body constraint objects"); RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset"); diff --git a/source/blender/rigidbody/rb_bullet_api.cpp b/source/blender/rigidbody/rb_bullet_api.cpp index c0d75a73b6a..c7955cae4f3 100644 --- a/source/blender/rigidbody/rb_bullet_api.cpp +++ b/source/blender/rigidbody/rb_bullet_api.cpp @@ -94,10 +94,10 @@ struct rbCollisionShape { struct rbFilterCallback : public btOverlapFilterCallback { - virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) const + virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const { - rbRigidBody *rb0 = (rbRigidBody*)((btRigidBody*)proxy0->m_clientObject)->getUserPointer(); - rbRigidBody *rb1 = (rbRigidBody*)((btRigidBody*)proxy1->m_clientObject)->getUserPointer(); + rbRigidBody *rb0 = (rbRigidBody *)((btRigidBody *)proxy0->m_clientObject)->getUserPointer(); + rbRigidBody *rb1 = (rbRigidBody *)((btRigidBody *)proxy1->m_clientObject)->getUserPointer(); bool collides; collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; @@ -135,19 +135,22 @@ rbDynamicsWorld *RB_dworld_new(const float gravity[3]) world->collisionConfiguration = new btDefaultCollisionConfiguration(); world->dispatcher = new btCollisionDispatcher(world->collisionConfiguration); - btGImpactCollisionAlgorithm::registerAlgorithm((btCollisionDispatcher*)world->dispatcher); // XXX: experimental + btGImpactCollisionAlgorithm::registerAlgorithm((btCollisionDispatcher *)world->dispatcher); // XXX: experimental world->pairCache = new btDbvtBroadphase(); world->filterCallback = new rbFilterCallback(); world->pairCache->getOverlappingPairCache()->setOverlapFilterCallback(world->filterCallback); - + /* constraint solving */ world->constraintSolver = new btSequentialImpulseConstraintSolver(); - + /* world */ - world->dynamicsWorld = new btDiscreteDynamicsWorld(world->dispatcher,world->pairCache,world->constraintSolver,world->collisionConfiguration); - + world->dynamicsWorld = new btDiscreteDynamicsWorld(world->dispatcher, + world->pairCache, + world->constraintSolver, + world->collisionConfiguration); + RB_dworld_set_gravity(world, gravity); return world; @@ -211,13 +214,13 @@ void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int maxSu void RB_dworld_export(rbDynamicsWorld *world, const char *filename) { //create a large enough buffer. There is no method to pre-calculate the buffer size yet. - int maxSerializeBufferSize = 1024*1024*5; + int maxSerializeBufferSize = 1024 * 1024 * 5; btDefaultSerializer *serializer = new btDefaultSerializer(maxSerializeBufferSize); world->dynamicsWorld->serialize(serializer); FILE *file = fopen(filename, "wb"); - fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file); + fwrite(serializer->getBufferPointer(), serializer->getCurrentBufferSize(), 1, file); fclose(file); } @@ -280,7 +283,7 @@ void RB_body_delete(rbRigidBody *object) /* manually remove constraint refs of the rigid body, normally this happens when removing constraints from the world * but since we delete everything when the world is rebult, we need to do it manually here */ for (int i = body->getNumConstraintRefs() - 1; i >= 0; i--) { - btTypedConstraint* con = body->getConstraintRef(i); + btTypedConstraint *con = body->getConstraintRef(i); body->removeConstraintRef(con); } @@ -321,7 +324,7 @@ float RB_body_get_mass(rbRigidBody *object) void RB_body_set_mass(rbRigidBody *object, float value) { btRigidBody *body = object->body; - btVector3 localInertia(0,0,0); + btVector3 localInertia(0, 0, 0); /* calculate new inertia if non-zero mass */ if (value) { @@ -510,7 +513,7 @@ void RB_body_get_transform_matrix(rbRigidBody *object, float m_out[4][4]) btTransform trans; ms->getWorldTransform(trans); - trans.getOpenGLMatrix((btScalar*)m_out); + trans.getOpenGLMatrix((btScalar *)m_out); } void RB_body_set_loc_rot(rbRigidBody *object, const float loc[3], const float rot[4]) @@ -643,7 +646,7 @@ rbCollisionShape *RB_shape_new_convex_hull(float *verts, int stride, int count, rbMeshData *RB_trimesh_data_new() { // XXX: welding threshold? - return (rbMeshData*) new btTriangleMesh(true, false); + return (rbMeshData *) new btTriangleMesh(true, false); } void RB_trimesh_add_triangle(rbMeshData *mesh, const float v1[3], const float v2[3], const float v3[3]) @@ -670,7 +673,7 @@ rbCollisionShape *RB_shape_new_trimesh(rbMeshData *mesh) // RB_TODO perhaps we need to allow saving out this for performance when rebuilding? btBvhTriangleMeshShape *unscaledShape = new btBvhTriangleMeshShape(tmesh, true, true); - shape->cshape = new btScaledBvhTriangleMeshShape(unscaledShape, btVector3(1.0f,1.0f,1.0f)); + shape->cshape = new btScaledBvhTriangleMeshShape(unscaledShape, btVector3(1.0f, 1.0f, 1.0f)); shape->mesh = tmesh; return shape; } @@ -694,7 +697,7 @@ rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh) void RB_shape_delete(rbCollisionShape *shape) { if (shape->cshape->getShapeType() == SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE) { - btBvhTriangleMeshShape *child_shape = ((btScaledBvhTriangleMeshShape*)shape->cshape)->getChildShape(); + btBvhTriangleMeshShape *child_shape = ((btScaledBvhTriangleMeshShape *)shape->cshape)->getChildShape(); if (child_shape) delete child_shape; } @@ -757,7 +760,7 @@ rbConstraint *RB_constraint_new_point(float pivot[3], rbRigidBody *rb1, rbRigidB btTypedConstraint *con = new btPoint2PointConstraint(*body1, *body2, pivot1, pivot2); - return (rbConstraint*)con; + return (rbConstraint *)con; } rbConstraint *RB_constraint_new_fixed(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) @@ -775,7 +778,7 @@ rbConstraint *RB_constraint_new_fixed(float pivot[3], float orn[4], rbRigidBody for (int i = 0; i < 6; i++) con->setLimit(i, 0, 0); - return (rbConstraint*)con; + return (rbConstraint *)con; } rbConstraint *RB_constraint_new_hinge(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) @@ -789,7 +792,7 @@ rbConstraint *RB_constraint_new_hinge(float pivot[3], float orn[4], rbRigidBody btHingeConstraint *con = new btHingeConstraint(*body1, *body2, transform1, transform2); - return (rbConstraint*)con; + return (rbConstraint *)con; } rbConstraint *RB_constraint_new_slider(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) @@ -803,7 +806,7 @@ rbConstraint *RB_constraint_new_slider(float pivot[3], float orn[4], rbRigidBody btSliderConstraint *con = new btSliderConstraint(*body1, *body2, transform1, transform2, true); - return (rbConstraint*)con; + return (rbConstraint *)con; } rbConstraint *RB_constraint_new_piston(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) @@ -818,7 +821,7 @@ rbConstraint *RB_constraint_new_piston(float pivot[3], float orn[4], rbRigidBody btSliderConstraint *con = new btSliderConstraint(*body1, *body2, transform1, transform2, true); con->setUpperAngLimit(-1.0f); // unlock rotation axis - return (rbConstraint*)con; + return (rbConstraint *)con; } rbConstraint *RB_constraint_new_6dof(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) @@ -832,7 +835,7 @@ rbConstraint *RB_constraint_new_6dof(float pivot[3], float orn[4], rbRigidBody * btTypedConstraint *con = new btGeneric6DofConstraint(*body1, *body2, transform1, transform2, true); - return (rbConstraint*)con; + return (rbConstraint *)con; } rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2) @@ -846,7 +849,7 @@ rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigi btTypedConstraint *con = new btGeneric6DofSpringConstraint(*body1, *body2, transform1, transform2, true); - return (rbConstraint*)con; + return (rbConstraint *)con; } /* Cleanup ----------------------------- */ |