Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/physics/rigidbody_constraint.c
| Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
| static bool ED_operator_rigidbody_con_add_poll(bContext *C) | static bool ED_operator_rigidbody_con_add_poll(bContext *C) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| if (scene == NULL || ID_IS_LINKED(&scene->id) || | if (scene == NULL || ID_IS_LINKED(&scene->id) || | ||||
| (scene->rigidbody_world != NULL && scene->rigidbody_world->constraints != NULL && | (scene->rigidbody_world != NULL && scene->rigidbody_world->constraints != NULL && | ||||
| ID_IS_LINKED(&scene->rigidbody_world->constraints->id))) { | ID_IS_LINKED(&scene->rigidbody_world->constraints->id))) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return ED_operator_object_active_editable(C); | |||||
| if (ED_operator_object_active_editable(C)) { | |||||
| Object *ob = ED_object_active_context(C); | |||||
| return (ob && ob->type == OB_MESH); | |||||
| } | |||||
| else { | |||||
| return false; | |||||
| } | |||||
| } | } | ||||
| bool ED_rigidbody_constraint_add( | bool ED_rigidbody_constraint_add( | ||||
| Main *bmain, Scene *scene, Object *ob, int type, ReportList *reports) | Main *bmain, Scene *scene, Object *ob, int type, ReportList *reports) | ||||
| { | { | ||||
| RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene); | RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene); | ||||
| /* check that object doesn't already have a constraint */ | /* check that object doesn't already have a constraint */ | ||||
| ▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines | |||||