Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/physics/rigidbody_world.c
| Show All 39 Lines | |||||
| #ifdef WITH_BULLET | #ifdef WITH_BULLET | ||||
| # include "RBI_api.h" | # include "RBI_api.h" | ||||
| #endif | #endif | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_rigidbody.h" | #include "BKE_rigidbody.h" | ||||
| #include "DEG_depsgraph_query.h" | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "physics_intern.h" | #include "physics_intern.h" | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
| /* ********************************************** */ | /* ********************************************** */ | ||||
| /* UTILITY OPERATORS */ | /* UTILITY OPERATORS */ | ||||
| /* ********** Export RigidBody World ************* */ | /* ********** Export RigidBody World ************* */ | ||||
| static int rigidbody_world_export_exec(bContext *C, wmOperator *op) | static int rigidbody_world_export_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Depsgraph *depsgraph = CTX_data_depsgraph(C); | ||||
| RigidBodyWorld *rbw = scene->rigidbody_world; | Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | ||||
| RigidBodyWorld *rbw_eval = scene_eval->rigidbody_world; | |||||
| char path[FILE_MAX]; | char path[FILE_MAX]; | ||||
| /* sanity checks */ | /* sanity checks */ | ||||
| if (ELEM(NULL, scene, rbw)) { | if (rbw_eval == NULL) { | ||||
| BKE_report(op->reports, RPT_ERROR, "No Rigid Body World to export"); | BKE_report(op->reports, RPT_ERROR, "No Rigid Body World to export"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (rbw->physics_world == NULL) { | if (rbw_eval->physics_world == NULL) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Rigid Body World has no associated physics data to export"); | BKE_report(op->reports, RPT_ERROR, "Rigid Body World has no associated physics data to export"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| RNA_string_get(op->ptr, "filepath", path); | RNA_string_get(op->ptr, "filepath", path); | ||||
| #ifdef WITH_BULLET | #ifdef WITH_BULLET | ||||
| RB_dworld_export(rbw->physics_world, path); | RB_dworld_export(rbw->physics_world, path); | ||||
| #endif | #endif | ||||
| Show All 38 Lines | |||||