33 #include "RNA_prototypes.h"
133 ot->
idname =
"RIGIDBODY_OT_object_add";
134 ot->
name =
"Add Rigid Body";
160 bool changed =
false;
184 ot->
idname =
"RIGIDBODY_OT_object_remove";
185 ot->
name =
"Remove Rigid Body";
206 bool changed =
false;
228 ot->
idname =
"RIGIDBODY_OT_objects_add";
229 ot->
name =
"Add Rigid Bodies";
254 bool changed =
false;
258 if (ob->rigidbody_object) {
279 ot->
idname =
"RIGIDBODY_OT_objects_remove";
280 ot->
name =
"Remove Rigid Bodies";
281 ot->
description =
"Remove selected objects from Rigid Body simulation";
299 bool changed =
false;
303 if (ob->rigidbody_object) {
331 ot->
idname =
"RIGIDBODY_OT_shape_change";
332 ot->
name =
"Change Collision Shape";
333 ot->
description =
"Change collision shapes for selected Rigid Body Objects";
368 {
N_(
"Acrylic"), 1400.0f},
369 {
N_(
"Asphalt (Crushed)"), 721.0f},
370 {
N_(
"Bark"), 240.0f},
371 {
N_(
"Beans (Cocoa)"), 593.0f},
372 {
N_(
"Beans (Soy)"), 721.0f},
373 {
N_(
"Brick (Pressed)"), 2400.0f},
374 {
N_(
"Brick (Common)"), 2000.0f},
375 {
N_(
"Brick (Soft)"), 1600.0f},
376 {
N_(
"Brass"), 8216.0f},
377 {
N_(
"Bronze"), 8860.0f},
378 {
N_(
"Carbon (Solid)"), 2146.0f},
379 {
N_(
"Cardboard"), 689.0f},
380 {
N_(
"Cast Iron"), 7150.0f},
382 {
N_(
"Chalk (Solid)"), 2499.0f},
384 {
N_(
"Concrete"), 2320.0f},
385 {
N_(
"Charcoal"), 208.0f},
386 {
N_(
"Cork"), 240.0f},
387 {
N_(
"Copper"), 8933.0f},
388 {
N_(
"Garbage"), 481.0f},
389 {
N_(
"Glass (Broken)"), 1940.0f},
390 {
N_(
"Glass (Solid)"), 2190.0f},
391 {
N_(
"Gold"), 19282.0f},
392 {
N_(
"Granite (Broken)"), 1650.0f},
393 {
N_(
"Granite (Solid)"), 2691.0f},
394 {
N_(
"Gravel"), 2780.0f},
395 {
N_(
"Ice (Crushed)"), 593.0f},
396 {
N_(
"Ice (Solid)"), 919.0f},
397 {
N_(
"Iron"), 7874.0f},
398 {
N_(
"Lead"), 11342.0f},
399 {
N_(
"Limestone (Broken)"), 1554.0f},
400 {
N_(
"Limestone (Solid)"), 2611.0f},
401 {
N_(
"Marble (Broken)"), 1570.0f},
402 {
N_(
"Marble (Solid)"), 2563.0f},
403 {
N_(
"Paper"), 1201.0f},
404 {
N_(
"Peanuts (Shelled)"), 641.0f},
405 {
N_(
"Peanuts (Not Shelled)"), 272.0f},
406 {
N_(
"Plaster"), 849.0f},
407 {
N_(
"Plastic"), 1200.0f},
408 {
N_(
"Polystyrene"), 1050.0f},
409 {
N_(
"Rubber"), 1522.0f},
410 {
N_(
"Silver"), 10501.0f},
411 {
N_(
"Steel"), 7860.0f},
412 {
N_(
"Stone"), 2515.0f},
413 {
N_(
"Stone (Crushed)"), 1602.0f},
414 {
N_(
"Timber"), 610.0f},
464 bool changed =
false;
483 if (ob->rigidbody_object) {
524 if (
STREQ(prop_id,
"density")) {
542 ot->
idname =
"RIGIDBODY_OT_mass_calculate";
543 ot->
name =
"Calculate Mass";
544 ot->
description =
"Automatically calculate mass values for Rigid Body Objects based on volume";
562 "Type of material that objects are made of (determines material density)");
572 "Density value (kg/m^3), allows custom value if the 'Custom' preset is used",
struct Scene * CTX_data_scene(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
API for Blender-side Rigid Body stuff.
void BKE_rigidbody_remove_object(struct Main *bmain, struct Scene *scene, struct Object *ob, bool free_us)
void BKE_rigidbody_calc_volume(struct Object *ob, float *r_vol)
bool BKE_rigidbody_add_object(struct Main *bmain, struct Scene *scene, struct Object *ob, int type, struct ReportList *reports)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
Types and defines for representing Rigid Body entities.
struct Object * ED_object_active_context(const struct bContext *C)
bool ED_operator_object_active_editable(struct bContext *C)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
const Depsgraph * depsgraph
static const pxr::TfToken density("density", pxr::TfToken::Immortal)
static int rigidbody_objects_shape_change_exec(bContext *C, wmOperator *op)
void RIGIDBODY_OT_object_remove(wmOperatorType *ot)
static const int NUM_RB_MATERIAL_PRESETS
void RIGIDBODY_OT_shape_change(wmOperatorType *ot)
struct rbMaterialDensityItem rbMaterialDensityItem
static bool operator_rigidbody_editable_poll(Scene *scene)
static bool mass_calculate_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
static bool ED_operator_rigidbody_active_poll(bContext *C)
static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
void RIGIDBODY_OT_object_add(wmOperatorType *ot)
void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
static int rigidbody_objects_add_exec(bContext *C, wmOperator *op)
void RIGIDBODY_OT_objects_remove(wmOperatorType *ot)
static const EnumPropertyItem * rigidbody_materials_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
void RIGIDBODY_OT_objects_add(wmOperatorType *ot)
static rbMaterialDensityItem RB_MATERIAL_DENSITY_TABLE[]
static int rigidbody_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
static bool ED_operator_rigidbody_add_poll(bContext *C)
static int rigidbody_object_add_exec(bContext *C, wmOperator *op)
void ED_rigidbody_object_remove(Main *bmain, Scene *scene, Object *ob)
static int rigidbody_object_remove_exec(bContext *C, wmOperator *op)
bool ED_rigidbody_object_add(Main *bmain, Scene *scene, Object *ob, int type, ReportList *reports)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
const char * RNA_property_identifier(const PropertyRNA *prop)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_rigidbody_object_type_items[]
const EnumPropertyItem rna_enum_rigidbody_object_shape_items[]
const EnumPropertyItem DummyRNA_DEFAULT_items[]
struct RigidBodyOb * rigidbody_object
struct Collection * group
struct RigidBodyWorld * rigidbody_world
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
bool(* poll_property)(const struct bContext *C, struct wmOperator *op, const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))