rigidbody: Add missing updates for rigidbody operators
authorSergej Reich <sergej.reich@googlemail.com>
Sat, 9 Feb 2013 10:04:29 +0000 (10:04 +0000)
committerSergej Reich <sergej.reich@googlemail.com>
Sat, 9 Feb 2013 10:04:29 +0000 (10:04 +0000)
Fixes cache not being invalidated when using change collision shape and
calculate mass operators.

source/blender/editors/physics/rigidbody_object.c

index fa258c9..9ce4656 100644 (file)
@@ -338,12 +338,14 @@ static int rigidbody_obs_shape_change_exec(bContext *C, wmOperator *op)
                        /* use RNA-system to change the property and perform all necessary changes */
                        RNA_pointer_create(&ob->id, &RNA_RigidBodyObject, ob->rigidbody_object, &ptr);
                        RNA_enum_set(&ptr, "collision_shape", shape);
+
+                       DAG_id_tag_update(&ob->id, OB_RECALC_OB);
                }
        }
        CTX_DATA_END;
 
        /* send updates */
-       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); // XXX: wrong notifiers for now, but these also do the job...
+       WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
 
        /* done */
        return OPERATOR_FINISHED;
@@ -584,12 +586,14 @@ static int rigidbody_obs_calc_mass_exec(bContext *C, wmOperator *op)
                        /* use RNA-system to change the property and perform all necessary changes */
                        RNA_pointer_create(&ob->id, &RNA_RigidBodyObject, ob->rigidbody_object, &ptr);
                        RNA_float_set(&ptr, "mass", mass);
+
+                       DAG_id_tag_update(&ob->id, OB_RECALC_OB);
                }
        }
        CTX_DATA_END;
 
        /* send updates */
-       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); // XXX: wrong notifiers for now, but these also do the job...
+       WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
 
        /* done */
        return OPERATOR_FINISHED;