Cleanup: de-duplicate flag setting macro
This commit is contained in:
parent
bbc5c1e36f
commit
08f4cdebe4
|
@ -146,14 +146,6 @@ static const EnumPropertyItem rigidbody_mesh_source_items[] = {
|
|||
|
||||
# include "WM_api.h"
|
||||
|
||||
# define RB_FLAG_SET(dest, value, flag) \
|
||||
{ \
|
||||
if (value) \
|
||||
dest |= flag; \
|
||||
else \
|
||||
dest &= ~flag; \
|
||||
}
|
||||
|
||||
/* ******************************** */
|
||||
|
||||
static void rna_RigidBodyWorld_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
|
@ -185,7 +177,7 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
|
||||
SET_FLAG_FROM_TEST(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
if (rbw->shared->physics_world) {
|
||||
|
@ -266,7 +258,7 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbo->flag, !value, RBO_FLAG_DISABLED);
|
||||
SET_FLAG_FROM_TEST(rbo->flag, !value, RBO_FLAG_DISABLED);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
/* update kinematic state if necessary - only needed for active bodies */
|
||||
|
@ -348,7 +340,7 @@ static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbo->flag, value, RBO_FLAG_KINEMATIC);
|
||||
SET_FLAG_FROM_TEST(rbo->flag, value, RBO_FLAG_KINEMATIC);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
/* update kinematic state if necessary */
|
||||
|
@ -364,7 +356,7 @@ static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
|
||||
SET_FLAG_FROM_TEST(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
/* update activation state if necessary - only active bodies can be deactivated */
|
||||
|
@ -456,7 +448,7 @@ static void rna_RigidBodyCon_enabled_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbc->flag, value, RBC_FLAG_ENABLED);
|
||||
SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_ENABLED);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
if (rbc->physics_constraint) {
|
||||
|
@ -469,7 +461,7 @@ static void rna_RigidBodyCon_disable_collisions_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
|
||||
SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
|
||||
|
||||
rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
|
||||
}
|
||||
|
@ -728,7 +720,7 @@ static void rna_RigidBodyCon_use_motor_lin_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
|
||||
SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
if (rbc->physics_constraint) {
|
||||
|
@ -743,7 +735,7 @@ static void rna_RigidBodyCon_use_motor_ang_set(PointerRNA *ptr, bool value)
|
|||
{
|
||||
RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
|
||||
|
||||
RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
|
||||
SET_FLAG_FROM_TEST(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
|
||||
|
||||
# ifdef WITH_BULLET
|
||||
if (rbc->physics_constraint) {
|
||||
|
|
Loading…
Reference in New Issue