Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_rigidbody.c')
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c82
1 files changed, 44 insertions, 38 deletions
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index df52515934a..aa90ba28e23 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -91,7 +91,6 @@ static const EnumPropertyItem rigidbody_mesh_source_items[] = {
# include "RBI_api.h"
#endif
-#include "BKE_depsgraph.h"
#include "BKE_rigidbody.h"
#include "WM_api.h"
@@ -125,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
}
@@ -138,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
}
@@ -168,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;
}
@@ -202,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
@@ -218,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
}
@@ -231,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
}
@@ -243,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
}
@@ -256,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
}
@@ -284,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
@@ -300,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
}
@@ -314,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
}
@@ -328,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
}
@@ -342,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
}
@@ -356,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
}
@@ -707,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,
@@ -724,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)
@@ -741,15 +747,15 @@ 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_struct_type(prop, "Collection");
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_ui_text(prop, "Collection", "Collection 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_struct_type(prop, "Collection");
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_ui_text(prop, "Constraints", "Collection containing rigid body constraint objects");
RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
/* booleans */
@@ -802,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", "");
@@ -1000,7 +1006,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
RNA_def_property_array(prop, 20);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_collision_groups_set");
- RNA_def_property_ui_text(prop, "Collision Groups", "Collision Groups Rigid Body belongs to");
+ RNA_def_property_ui_text(prop, "Collision Collections", "Collision collections rigid body belongs to");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
}