Blender V5.3
DNA_rigidbody_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#pragma once
11
12#include "BLI_enum_flags.hh"
13
14#include "DNA_listBase.h"
16
17namespace blender {
18
19struct Collection;
20
21struct EffectorWeights;
23
26 /* should sim world be skipped when evaluating (user setting) */
27 RBW_FLAG_MUTED = (1 << 0),
28 /* sim data needs to be rebuilt */
29 /* RBW_FLAG_NEEDS_REBUILD = (1 << 1), */ /* UNUSED */
32};
34
35
36enum eRigidBodyOb_Type : short {
37 /* active geometry participant in simulation. is directly controlled by sim */
39 /* passive geometry participant in simulation. is directly controlled by animsys */
41};
42
45 /* rigidbody is kinematic (controlled by the animation system) */
47 /* rigidbody needs to be validated (usually set after duplicating and not hooked up yet) */
49 /* rigidbody shape needs refreshing (usually after exiting editmode) */
51 /* rigidbody can be deactivated */
53 /* rigidbody is deactivated at the beginning of simulation */
55 /* rigidbody is not dynamically simulated */
57 /* collision margin is not embedded (only used by convex hull shapes for now) */
59 /* collision shape deforms during simulation (only for passive triangle mesh shapes) */
61};
63
64
65enum eRigidBody_Shape : short {
76
81
82 /* concave mesh approximated using primitives */
84};
85
94
96enum eRigidBodyCon_Type : short {
102 /* RBC_TYPE_HINGE2 = 2, */ /* UNUSED */
106 /* RBC_TYPE_CONE_TWIST = 4, */ /* UNUSED */
112 /* RBC_TYPE_UNIVERSAL = 7, */ /* UNUSED */
119 /* RBC_TYPE_SPRING = 10, */ /* UNUSED */
122};
123
126 RBC_SPRING_TYPE1 = 0, /* btGeneric6DofSpringConstraint */
127 RBC_SPRING_TYPE2 = 1, /* btGeneric6DofSpring2Constraint */
128};
129
132 /* constraint influences rigid body motion */
134 /* constraint needs to be validated */
136 /* allow constrained bodies to collide */
138 /* constraint can break */
140 /* constraint use custom number of constraint solver iterations */
142 /* limits */
149 /* springs */
153 /* motors */
156 /* angular springs */
160};
162
163/* ******************************** */
164/* RigidBody World */
165
166
168 /* cache */
169 struct PointCache *pointcache = nullptr;
170 ListBaseT<PointCache> ptcaches = {nullptr, nullptr};
171
172 /* Runtime data. */
174};
175
176/* RigidBodyWorld (rbw)
177 *
178 * Represents a "simulation scene" existing within the parent scene.
179 */
182
183 /* Sim World Settings ------------------------------------------------------------- */
186
188 struct Collection *group = nullptr;
190 struct Object **objects = nullptr;
191
193 struct Collection *constraints = nullptr;
194
195 char _pad[4] = {};
197 float ltime = 0;
198
200 struct RigidBodyWorld_Shared *shared = nullptr;
204 ListBaseT<PointCache> ptcaches = {nullptr, nullptr};
206 int numbodies = 0;
207
212
216 float time_scale = 0;
217};
218
219/* ******************************** */
220/* RigidBody Object */
221
222/* Container for data that is shared among evaluated copies.
223 *
224 * This is placed in a separate struct so that, for example, the physics_shape
225 * pointer can be replaced without having to update all evaluated copies. */
226#
227#
229 /* References to Physics Sim objects. Exist at runtime only */
231 void *physics_object = nullptr;
233 void *physics_shape = nullptr;
234};
235
236/* RigidBodyObject (rbo)
237 *
238 * Represents an object participating in a RigidBody sim.
239 * This is attached to each object that is currently
240 * participating in a sim.
241 */
243 /* General Settings for this RigidBodyOb */
248
251 int col_groups = 0;
254 char _pad[2] = {};
255
256 /* Physics Parameters */
258 float mass = 0;
259
261 float friction = 0;
263 float restitution = 0;
264
266 float margin = 0;
267
269 float lin_damping = 0;
271 float ang_damping = 0;
272
277
279 float orn[4] = {};
281 float pos[3] = {};
282 char _pad1[4] = {};
283
285 struct RigidBodyOb_Shared *shared = nullptr;
286};
287
288/* ******************************** */
289/* RigidBody Constraint */
290
291/* RigidBodyConstraint (rbc)
292 *
293 * Represents an constraint connecting two rigid bodies.
294 */
297 struct Object *ob1 = nullptr;
299 struct Object *ob2 = nullptr;
300
301 /* General Settings for this RigidBodyCon */
306
308
313 char _pad[3] = {};
314
315 /* limits */
316 /* translation limits */
323 /* rotation limits */
330
331 /* spring settings */
332 /* resistance to deformation */
339 /* amount of velocity lost over time */
346
347 /* motor settings */
356
357 /* References to Physics Sim object. Exist at runtime only */
359 void *physics_constraint = nullptr;
360};
361
362/* ******************************** */
363
364} // namespace blender
#define ENUM_OPERATORS(_enum_type)
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:104
#define DNA_DEPRECATED
Definition DNA_defs.h:21
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
@ RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS
eRigidBodyCon_SpringType spring_type
struct RigidBodyOb_Shared * shared
eRigidBody_MeshSource mesh_source
struct RigidBodyWorld_Runtime * runtime
struct Collection * constraints
eRigidBodyWorld_Flag flag
struct EffectorWeights * effector_weights
DNA_DEPRECATED struct PointCache * pointcache
struct RigidBodyWorld_Shared * shared
ListBaseT< PointCache > ptcaches