Blender  V2.93
DNA_rigidbody_types.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2013 Blender Foundation
17  * All rights reserved.
18  */
19 
25 #pragma once
26 
27 #include "DNA_listBase.h"
28 #include "DNA_object_force_types.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct Collection;
35 
36 struct EffectorWeights;
37 
38 /* ******************************** */
39 /* RigidBody World */
40 
41 /* Container for data shared by original and evaluated copies of RigidBodyWorld */
42 typedef struct RigidBodyWorld_Shared {
43  /* cache */
45  struct ListBase ptcaches;
46 
47  /* References to Physics Sim objects. Exist at runtime only ---------------------- */
51 
52 /* RigidBodyWorld (rbw)
53  *
54  * Represents a "simulation scene" existing within the parent scene.
55  */
56 typedef struct RigidBodyWorld {
57  /* Sim World Settings ------------------------------------------------------------- */
60 
62  struct Collection *group;
64  struct Object **objects;
65 
68 
69  char _pad[4];
71  float ltime;
72 
76  struct PointCache *pointcache DNA_DEPRECATED;
78  struct ListBase ptcaches DNA_DEPRECATED;
80  int numbodies;
81 
86 
88  int flag;
90  float time_scale;
92 
93 /* Flags for RigidBodyWorld */
94 typedef enum eRigidBodyWorld_Flag {
95  /* should sim world be skipped when evaluating (user setting) */
96  RBW_FLAG_MUTED = (1 << 0),
97  /* sim data needs to be rebuilt */
98  /* RBW_FLAG_NEEDS_REBUILD = (1 << 1), */ /* UNUSED */
102 
103 /* ******************************** */
104 /* RigidBody Object */
105 
106 /* Container for data that is shared among CoW copies.
107  *
108  * This is placed in a separate struct so that, for example, the physics_shape
109  * pointer can be replaced without having to update all CoW copies. */
110 #
111 #
112 typedef struct RigidBodyOb_Shared {
113  /* References to Physics Sim objects. Exist at runtime only */
119 
120 /* RigidBodyObject (rbo)
121  *
122  * Represents an object participating in a RigidBody sim.
123  * This is attached to each object that is currently
124  * participating in a sim.
125  */
126 typedef struct RigidBodyOb {
127  /* General Settings for this RigidBodyOb */
129  short type;
131  short shape;
132 
134  int flag;
138  short mesh_source;
139  char _pad[2];
140 
141  /* Physics Parameters */
143  float mass;
144 
146  float friction;
148  float restitution;
149 
151  float margin;
152 
154  float lin_damping;
156  float ang_damping;
157 
162 
164  float orn[4];
166  float pos[3];
167  char _pad1[4];
168 
172 
173 /* Participation types for RigidBodyOb */
174 typedef enum eRigidBodyOb_Type {
175  /* active geometry participant in simulation. is directly controlled by sim */
177  /* passive geometry participant in simulation. is directly controlled by animsys */
180 
181 /* Flags for RigidBodyOb */
182 typedef enum eRigidBodyOb_Flag {
183  /* rigidbody is kinematic (controlled by the animation system) */
184  RBO_FLAG_KINEMATIC = (1 << 0),
185  /* rigidbody needs to be validated (usually set after duplicating and not hooked up yet) */
187  /* rigidbody shape needs refreshing (usually after exiting editmode) */
189  /* rigidbody can be deactivated */
191  /* rigidbody is deactivated at the beginning of simulation */
193  /* rigidbody is not dynamically simulated */
194  RBO_FLAG_DISABLED = (1 << 5),
195  /* collision margin is not embedded (only used by convex hull shapes for now) */
197  /* collision shape deforms during simulation (only for passive triangle mesh shapes) */
200 
201 /* RigidBody Collision Shape */
202 typedef enum eRigidBody_Shape {
213 
218 
219  /* concave mesh approximated using primitives */
222 
223 typedef enum eRigidBody_MeshSource {
224  /* base mesh */
226  /* only deformations */
228  /* final derived mesh */
231 
232 /* ******************************** */
233 /* RigidBody Constraint */
234 
235 /* RigidBodyConstraint (rbc)
236  *
237  * Represents an constraint connecting two rigid bodies.
238  */
239 typedef struct RigidBodyCon {
241  struct Object *ob1;
243  struct Object *ob2;
244 
245  /* General Settings for this RigidBodyCon */
247  short type;
250 
252  int flag;
253 
258  char _pad[3];
259 
260  /* limits */
261  /* translation limits */
268  /* rotation limits */
275 
276  /* spring settings */
277  /* resistance to deformation */
284  /* amount of velocity lost over time */
291 
292  /* motor settings */
301 
302  /* References to Physics Sim object. Exist at runtime only */
306 
307 /* Participation types for RigidBodyOb */
308 typedef enum eRigidBodyCon_Type {
314  /* RBC_TYPE_HINGE2 = 2, */ /* UNUSED */
318  /* RBC_TYPE_CONE_TWIST = 4, */ /* UNUSED */
324  /* RBC_TYPE_UNIVERSAL = 7, */ /* UNUSED */
331  /* RBC_TYPE_SPRING = 10, */ /* UNUSED */
335 
336 /* Spring implementation type for RigidBodyOb */
338  RBC_SPRING_TYPE1 = 0, /* btGeneric6DofSpringConstraint */
339  RBC_SPRING_TYPE2 = 1, /* btGeneric6DofSpring2Constraint */
341 
342 /* Flags for RigidBodyCon */
343 typedef enum eRigidBodyCon_Flag {
344  /* constraint influences rigid body motion */
345  RBC_FLAG_ENABLED = (1 << 0),
346  /* constraint needs to be validated */
348  /* allow constrained bodies to collide */
350  /* constraint can break */
352  /* constraint use custom number of constraint solver iterations */
354  /* limits */
361  /* springs */
365  /* motors */
368  /* angular springs */
373 
374 /* ******************************** */
375 
376 #ifdef __cplusplus
377 }
378 #endif
These structs are the foundation for all linked lists in the library system.
eRigidBodyOb_Type
@ RBO_TYPE_ACTIVE
@ RBO_TYPE_PASSIVE
eRigidBodyWorld_Flag
@ RBW_FLAG_MUTED
@ RBW_FLAG_USE_SPLIT_IMPULSE
struct RigidBodyOb_Shared RigidBodyOb_Shared
eRigidBody_MeshSource
@ RBO_MESH_DEFORM
@ RBO_MESH_FINAL
@ RBO_MESH_BASE
struct RigidBodyOb RigidBodyOb
eRigidBodyCon_Type
@ RBC_TYPE_POINT
@ RBC_TYPE_HINGE
@ RBC_TYPE_FIXED
@ RBC_TYPE_SLIDER
@ RBC_TYPE_MOTOR
@ RBC_TYPE_6DOF_SPRING
@ RBC_TYPE_PISTON
@ RBC_TYPE_6DOF
eRigidBodyOb_Flag
@ RBO_FLAG_USE_MARGIN
@ RBO_FLAG_START_DEACTIVATED
@ RBO_FLAG_KINEMATIC
@ RBO_FLAG_USE_DEFORM
@ RBO_FLAG_NEEDS_VALIDATE
@ RBO_FLAG_USE_DEACTIVATION
@ RBO_FLAG_NEEDS_RESHAPE
@ RBO_FLAG_DISABLED
eRigidBodyCon_Flag
@ RBC_FLAG_NEEDS_VALIDATE
@ RBC_FLAG_USE_MOTOR_ANG
@ RBC_FLAG_USE_SPRING_Y
@ RBC_FLAG_USE_SPRING_ANG_Y
@ RBC_FLAG_USE_SPRING_ANG_X
@ RBC_FLAG_USE_LIMIT_ANG_X
@ RBC_FLAG_USE_LIMIT_LIN_Y
@ RBC_FLAG_USE_LIMIT_ANG_Y
@ RBC_FLAG_USE_MOTOR_LIN
@ RBC_FLAG_DISABLE_COLLISIONS
@ RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS
@ RBC_FLAG_USE_BREAKING
@ RBC_FLAG_ENABLED
@ RBC_FLAG_USE_SPRING_Z
@ RBC_FLAG_USE_LIMIT_LIN_X
@ RBC_FLAG_USE_SPRING_ANG_Z
@ RBC_FLAG_USE_SPRING_X
@ RBC_FLAG_USE_LIMIT_LIN_Z
@ RBC_FLAG_USE_LIMIT_ANG_Z
eRigidBody_Shape
@ RB_SHAPE_CAPSULE
@ RB_SHAPE_CONVEXH
@ RB_SHAPE_COMPOUND
@ RB_SHAPE_BOX
@ RB_SHAPE_TRIMESH
@ RB_SHAPE_SPHERE
@ RB_SHAPE_CYLINDER
@ RB_SHAPE_CONE
struct RigidBodyWorld RigidBodyWorld
eRigidBodyCon_SpringType
@ RBC_SPRING_TYPE1
@ RBC_SPRING_TYPE2
struct RigidBodyCon RigidBodyCon
struct RigidBodyWorld_Shared RigidBodyWorld_Shared
struct Object * ob1
float motor_lin_target_velocity
float motor_ang_target_velocity
struct Object * ob2
struct RigidBodyOb_Shared * shared
struct PointCache * pointcache
struct Collection * constraints
struct Collection * group
struct PointCache *pointcache DNA_DEPRECATED
struct RigidBodyWorld_Shared * shared
struct Object ** objects
struct EffectorWeights * effector_weights