[Bf-blender-cvs] [b1721771a2c] temp-fracture-modifier-2.8: cleanup, sensible rename and code documentation, first part
Martin Felke
noreply at git.blender.org
Sun Nov 25 00:49:25 CET 2018
Commit: b1721771a2c0863a8735b741820cead3622c394e
Author: Martin Felke
Date: Sun Nov 25 00:49:01 2018 +0100
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rBb1721771a2c0863a8735b741820cead3622c394e
cleanup, sensible rename and code documentation, first part
===================================================================
M intern/rigidbody/RBI_api.h
M intern/rigidbody/rb_bullet_api.cpp
M release/scripts/startup/bl_operators/presets.py
M release/scripts/startup/bl_ui/properties_physics_fracture.py
M source/blender/blenkernel/BKE_fracture.h
M source/blender/blenkernel/BKE_fracture_util.h
M source/blender/blenkernel/BKE_rigidbody.h
M source/blender/blenkernel/intern/fracture.c
M source/blender/blenkernel/intern/fracture_automerge.c
M source/blender/blenkernel/intern/fracture_constraints.c
M source/blender/blenkernel/intern/fracture_dynamic.c
M source/blender/blenkernel/intern/fracture_external.c
M source/blender/blenkernel/intern/fracture_prefractured.c
M source/blender/blenkernel/intern/fracture_rigidbody.c
M source/blender/blenkernel/intern/fracture_util.c
M source/blender/blenkernel/intern/pointcache.c
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/blenloader/intern/readfile.c
M source/blender/editors/object/object_modifier.c
M source/blender/makesdna/DNA_fracture_types.h
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_rigidbody_types.h
M source/blender/makesrna/intern/rna_fracture.c
M source/blender/makesrna/intern/rna_fracture_api.c
M source/blender/makesrna/intern/rna_rigidbody.c
M source/blender/modifiers/intern/MOD_fracture.c
===================================================================
diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 5d64871cd43..843d07274fb 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -128,7 +128,8 @@ void RB_dworld_export(rbDynamicsWorld *world, const char *filename);
/* Setup ---------------------------- */
/* Add RigidBody to dynamics world */
-void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *body, int col_groups, void* meshIsland, void *blenderOb, int linear_index);
+void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *body, int col_groups,
+ void* meshIsland, void *blenderOb);
/* Remove RigidBody from dynamics world */
void RB_dworld_remove_body(rbDynamicsWorld *world, rbRigidBody *body);
@@ -143,8 +144,7 @@ void RB_world_convex_sweep_test(
/* ............ */
/* Create new RigidBody instance */
-rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4], bool use_compounds, float dampening, float factor,
- float min_impulse, float stability_factor, const float bbox[3]);
+rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4]);
/* Delete the given RigidBody instance */
void RB_body_delete(rbRigidBody *body);
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index aef1ec10824..67f62b77687 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -145,10 +145,8 @@ struct ViewportDebugDraw : public btIDebugDraw
struct rbRigidBody {
btRigidBody *body;
int col_groups;
- int linear_index;
void *meshIsland;
void *blenderOb;
- btVector3 *bbox;
rbDynamicsWorld *world;
};
@@ -230,69 +228,6 @@ static int connection_binary_search(btFractureBody *fbody, btVector3 impact, btS
return low;
}
-static bool weakenCompound(const btCollisionObject *body, btScalar force, btVector3 impact, btFractureDynamicsWorld *world)
-{
- //just weaken strengths of this obA and obB according to force !
- if (body->getInternalType() & CUSTOM_FRACTURE_TYPE && force > 0.0f)
- {
- btFractureBody *fbody = (btFractureBody*)body;
- int size = fbody->m_connections.size();
- bool needs_break = false;
-
- if (size == 0)
- return false;
-
- btVector3 *bbox = ((rbRigidBody*)fbody->getUserPointer())->bbox;
- btScalar dim = (*bbox)[bbox->maxAxis()] * 2;
-
- //stop at this limit, distances are sorted... so no closer object will come later
- //int mid = connection_binary_search(fbody, impact, dim * (1.0f - fbody->m_propagationParameter.m_stability_factor));
- for (int i = 0; i < size; i++)
- {
- btVector3 imp = fbody->getWorldTransform().inverse() * impact;
- btScalar dist = connection_dist(fbody, i, imp);
- btConnection& con = fbody->m_connections[i];
- btScalar lforce = force;
- if (dist > 0.0f)
- {
- lforce = lforce / dist; // the closer, the higher the force
- //printf("lforce %f\n", lforce);
- lforce *= (1.0f - fbody->m_propagationParameter.m_stability_factor);
- //printf("lforce2 %f\n", lforce);
- }
-
- if (lforce > fbody->m_propagationParameter.m_minimum_impulse)
- {
- if (con.m_strength > 0.0f)
- {
- con.m_strength -= lforce;
- //printf("Damaged connection %d %d with %f\n", fbody->m_connections[i].m_childIndex0,
- // fbody->m_connections[i].m_childIndex1, force);
-
- if (con.m_strength <= 0)
- {
- con.m_strength = 0;
- needs_break = true;
- }
- }
- }
-
- btScalar pdist = connection_dist(fbody, i, con.m_parent->getWorldTransform().getOrigin());
- if (pdist > (dim * (1.0f - fbody->m_propagationParameter.m_stability_factor)))
- {
- break;
- }
- }
-
- if (needs_break)
- world->breakDisconnectedParts(fbody);
-
- return needs_break;
- }
-
- return false;
-}
-
static void manifold_callback(TickDiscreteDynamicsWorld* tworld, btManifoldPoint& pt,
const btCollisionObject *obA, const btCollisionObject *obB)
{
@@ -710,7 +645,6 @@ struct rbDynamicsWorld {
btConstraintSolver *constraintSolver;
rbFilterCallback *filterCallback;
void *blenderWorld;
- //struct rbContactCallback *contactCallback;
IdOutCallback idOutCallback;
void *blenderScene; // ouch, very very clumsy approach, this is just a borrowed pointer
};
@@ -815,55 +749,6 @@ static inline void copy_quat_btquat(float quat[4], const btQuaternion &btquat)
quat[3] = btquat.getZ();
}
-#if 0
-/*Contact Handling*/
-typedef void (*cont_callback)(rbContactPoint *cp, void* bworld);
-
-struct rbContactCallback
-{
- static cont_callback callback;
- static void* bworld;
- rbContactCallback(cont_callback cp, void* bworld);
- static bool handle_contacts(btManifoldPoint& point, btCollisionObject* body0, btCollisionObject* body1);
-};
-
-/*rbContactCallback::rbContactCallback(cont_callback callback, void *bworld){
- rbContactCallback::callback = callback;
- rbContactCallback::bworld = bworld;
- gContactProcessedCallback = (ContactProcessedCallback)&rbContactCallback::handle_contacts;
-}*/
-
-cont_callback rbContactCallback::callback = 0;
-void* rbContactCallback::bworld = NULL;
-
-bool rbContactCallback::handle_contacts(btManifoldPoint& point, btCollisionObject* body0, btCollisionObject* body1)
-{
- bool ret = false;
- if (rbContactCallback::callback)
- {
- rbContactPoint *cp = new rbContactPoint;
- btFractureBody* bodyA = (btFractureBody*)(body0);
- btFractureBody* bodyB = (btFractureBody*)(body1);
- rbRigidBody* rbA = (rbRigidBody*)(bodyA->getUserPointer());
- rbRigidBody* rbB = (rbRigidBody*)(bodyB->getUserPointer());
- if (rbA)
- cp->contact_body_indexA = rbA->linear_index;
-
- if (rbB)
- cp->contact_body_indexB = rbB->linear_index;
-
- cp->contact_force = point.getAppliedImpulse();
- copy_v3_btvec3(cp->contact_pos_world_onA, point.getPositionWorldOnA());
- copy_v3_btvec3(cp->contact_pos_world_onB, point.getPositionWorldOnB());
-
- rbContactCallback::callback(cp, rbContactCallback::bworld);
-
- delete cp;
- }
- return ret;
-}
-#endif
-
/* ********************************** */
/* Dynamics World Methods */
@@ -1166,7 +1051,8 @@ void RB_dworld_export(rbDynamicsWorld *world, const char *filename)
/* Setup ---------------------------- */
-void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int col_groups, void* meshIsland, void* blenderOb, int linear_index)
+void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int col_groups,
+ void* meshIsland, void* blenderOb)
{
btRigidBody *body = object->body;
@@ -1180,7 +1066,6 @@ void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int col_gro
object->meshIsland = meshIsland;
object->world = world;
object->blenderOb = blenderOb;
- object->linear_index = linear_index;
world->dynamicsWorld->addRigidBody(body);
}
@@ -1246,8 +1131,7 @@ void RB_world_convex_sweep_test(
/* ............ */
-rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4], bool use_compounds, float dampening, float factor,
- float min_impulse, float stability_factor, const float bbox[3])
+rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4])
{
rbRigidBody *object = new rbRigidBody;
/* current transform */
@@ -1261,21 +1145,7 @@ rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const floa
/* make rigidbody */
btRigidBody::btRigidBodyConstructionInfo rbInfo(1.0f, motionState, shape->cshape);
- if (use_compounds)
- {
- btPropagationParameter param;
- param.m_impulse_dampening = dampening;
- param.m_directional_factor = factor;
- param.m_minimum_impulse = min_impulse;
- param.m_stability_factor = stability_factor;
- object->body = new btFractureBody(rbInfo, param);
- }
- else
- {
- object->body = new btRigidBody(rbInfo);
- }
-
- object->bbox = new btVector3(bbox[0], bbox[1], bbox[2]);
+ object->body = new btRigidBody(rbInfo);
/* user pointers */
object->body->setUserPointer(object);
@@ -1305,8 +1175,6 @@ void RB_body_delete(rbRigidBody *object)
}
delete body;
-
- delete object->bbox;
delete object;
}
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index fe836d3abd7..f662d63b2d2 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -623,7 +623,7 @@ class AddPresetFracture(AddPresetBase, Operator):
"fracture.cluster_breaking_threshold",
"fracture.point_source",
"fracture.extra_group",
- "fracture.dm_group",
+ "fracture.pack_group",
"fracture.use_particle_birth_coordinates",
"fracture.splinter_axis",
"fracture.splinter_length",
@@ -644,29 +644,17 @@ class AddPresetFracture(AddPresetBase, Operator):
"fracture.inner_vertex_group",
"fracture.autohide_dist",
"fracture.fix_normals",
- "fracture.execute_threaded",
"fracture.use_breaking",
- "fracture.nor_range",
+ "fracture.normal_search_radius",
"fracture.cluster_group",
"fracture.cutter_group",
- "fracture.grease_offset",
- "fracture.grease_decimate",
- "fracture.use_greasepencil_edges",
- "fracture.cutter_axis",
"fracture.cluster_constraint_type",
"fracture.constraint_target",
- # "fracture.fracture_mode",
"fracture.dynamic_force",
"fracture.limit_impact",
- "fracture.use_compounds",
- # "fracture.impulse_dampening",
- # "fracture.directional_factor",
- "fracture.minimum_impulse",
- "fracture.mass_threshold_factor",
"fracture.autohide_filter_group",
"fracture.uv_layer",
"fracture.inner_material",
- #"fracture.boolean_solver",
"fracture.boolean_double_threshold",
"fracture.dynamic_percentage",
"fracture.dynamic_new_constraints",
@@ -675,9 +663,9 @@ class AddPresetFracture(AddPresetBase, Operator):
"fracture.inner_crease",
"fracture.material_offset_difference",
"fracture.material_offset_intersect",
- "fracture.orthogo
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list