Commit: 3739f53a6e2ea7e643cd9630f999b9c7503110e3
Author: Sergej Reich
Date:   Wed Jan 8 03:29:12 2014 +0100
https://developer.blender.org/rB3739f53a6e2ea7e643cd9630f999b9c7503110e3

Fix T38112: Rigid Body can't be created for objects with linked mesh

Make poll function for rigid body add operators less strict.

===================================================================

M       source/blender/editors/physics/rigidbody_object.c

===================================================================

diff --git a/source/blender/editors/physics/rigidbody_object.c 
b/source/blender/editors/physics/rigidbody_object.c
index b166f36..e4426fd 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -80,6 +80,16 @@ static int ED_operator_rigidbody_active_poll(bContext *C)
                return 0;
 }
 
+static int ED_operator_rigidbody_add_poll(bContext *C)
+{
+       if (ED_operator_object_active_editable(C)) {
+               Object *ob = ED_object_active_context(C);
+               return (ob && ob->type == OB_MESH);
+       }
+       else
+               return 0;
+}
+
 /* ----------------- */
 
 bool ED_rigidbody_object_add(Scene *scene, Object *ob, int type, ReportList 
*reports)
@@ -172,7 +182,7 @@ void RIGIDBODY_OT_object_add(wmOperatorType *ot)
 
        /* callbacks */
        ot->exec = rigidbody_object_add_exec;
-       ot->poll = ED_operator_object_active_editable_mesh;
+       ot->poll = ED_operator_rigidbody_add_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -263,7 +273,7 @@ void RIGIDBODY_OT_objects_add(wmOperatorType *ot)
 
        /* callbacks */
        ot->exec = rigidbody_objects_add_exec;
-       ot->poll = ED_operator_object_active_editable_mesh;
+       ot->poll = ED_operator_rigidbody_add_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to