diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_rigidbody.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_rigidbody.c | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 60a1783f118..9c3b1fe3063 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -124,8 +124,8 @@ static void rna_RigidBodyWorld_num_solver_iterations_set(PointerRNA *ptr, int va rbw->num_solver_iterations = value; #ifdef WITH_BULLET - if (rbw->physics_world) { - RB_dworld_set_solver_iterations(rbw->physics_world, value); + if (rbw->shared->physics_world) { + RB_dworld_set_solver_iterations(rbw->shared->physics_world, value); } #endif } @@ -137,8 +137,8 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value) RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE); #ifdef WITH_BULLET - if (rbw->physics_world) { - RB_dworld_set_split_impulse(rbw->physics_world, value); + if (rbw->shared->physics_world) { + RB_dworld_set_split_impulse(rbw->shared->physics_world, value); } #endif } @@ -167,7 +167,7 @@ static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, Point RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; BKE_rigidbody_cache_reset(rbw); - if (rbo->physics_shape) + if (rbo->shared->physics_shape) rbo->flag |= RBO_FLAG_NEEDS_RESHAPE; } @@ -201,9 +201,9 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value) #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); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo)); + RB_body_set_kinematic_state(rbo->shared->physics_object, !value); rbo->flag |= RBO_FLAG_NEEDS_VALIDATE; } #endif @@ -217,8 +217,8 @@ static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value) #ifdef WITH_BULLET /* only active bodies need mass update */ - if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { - RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo)); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo)); } #endif } @@ -230,8 +230,8 @@ static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value) rbo->friction = value; #ifdef WITH_BULLET - if (rbo->physics_object) { - RB_body_set_friction(rbo->physics_object, value); + if (rbo->shared->physics_object) { + RB_body_set_friction(rbo->shared->physics_object, value); } #endif } @@ -242,8 +242,8 @@ static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value) rbo->restitution = value; #ifdef WITH_BULLET - if (rbo->physics_object) { - RB_body_set_restitution(rbo->physics_object, value); + if (rbo->shared->physics_object) { + RB_body_set_restitution(rbo->shared->physics_object, value); } #endif } @@ -255,8 +255,8 @@ static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value) rbo->margin = value; #ifdef WITH_BULLET - if (rbo->physics_shape) { - RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo)); + if (rbo->shared->physics_shape) { + RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo)); } #endif } @@ -283,9 +283,9 @@ static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, int value) #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); + if (rbo->shared->physics_object) { + RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo)); + RB_body_set_kinematic_state(rbo->shared->physics_object, value); rbo->flag |= RBO_FLAG_NEEDS_VALIDATE; } #endif @@ -299,8 +299,8 @@ static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, int value) #ifdef WITH_BULLET /* update activation state if necessary - only active bodies can be deactivated */ - if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { - RB_body_set_activation_state(rbo->physics_object, value); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_activation_state(rbo->shared->physics_object, value); } #endif } @@ -313,8 +313,8 @@ static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value) #ifdef WITH_BULLET /* only active bodies need sleep threshold update */ - if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { - RB_body_set_linear_sleep_thresh(rbo->physics_object, value); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_linear_sleep_thresh(rbo->shared->physics_object, value); } #endif } @@ -327,8 +327,8 @@ static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value #ifdef WITH_BULLET /* only active bodies need sleep threshold update */ - if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { - RB_body_set_angular_sleep_thresh(rbo->physics_object, value); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_angular_sleep_thresh(rbo->shared->physics_object, value); } #endif } @@ -341,8 +341,8 @@ static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value) #ifdef WITH_BULLET /* only active bodies need damping update */ - if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { - RB_body_set_linear_damping(rbo->physics_object, value); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_linear_damping(rbo->shared->physics_object, value); } #endif } @@ -355,8 +355,8 @@ static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value) #ifdef WITH_BULLET /* only active bodies need damping update */ - if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { - RB_body_set_angular_damping(rbo->physics_object, value); + if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) { + RB_body_set_angular_damping(rbo->shared->physics_object, value); } #endif } @@ -706,8 +706,8 @@ static void rna_RigidBodyWorld_convex_sweep_test( #ifdef WITH_BULLET RigidBodyOb *rob = object->rigidbody_object; - if (rbw->physics_world != NULL && rob->physics_object != NULL) { - RB_world_convex_sweep_test(rbw->physics_world, rob->physics_object, ray_start, ray_end, + if (rbw->shared->physics_world != NULL && rob->shared->physics_object != NULL) { + RB_world_convex_sweep_test(rbw->shared->physics_world, rob->shared->physics_object, ray_start, ray_end, r_location, r_hitpoint, r_normal, r_hit); if (*r_hit == -2) { BKE_report(reports, RPT_ERROR, @@ -723,6 +723,13 @@ static void rna_RigidBodyWorld_convex_sweep_test( #endif } +static PointerRNA rna_RigidBodyWorld_PointCache_get(PointerRNA *ptr) +{ + RigidBodyWorld *rbw = ptr->data; + return rna_pointer_inherit_refine(ptr, &RNA_PointCache, rbw->shared->pointcache); +} + + #else static void rna_def_rigidbody_world(BlenderRNA *brna) @@ -801,7 +808,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna) /* cache */ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "pointcache"); + RNA_def_property_pointer_funcs(prop, "rna_RigidBodyWorld_PointCache_get", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache", ""); |