[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31163] branches/soc-2010-aligorith-2/ source/blender/editors: Bullet SoC - Bugfix: Deleting an object with Rigid Body settings without first removing it from the Rigid Body sims would result in a crash .
Joshua Leung
aligorith at gmail.com
Sun Aug 8 13:47:56 CEST 2010
Revision: 31163
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31163
Author: aligorith
Date: 2010-08-08 13:47:56 +0200 (Sun, 08 Aug 2010)
Log Message:
-----------
Bullet SoC - Bugfix: Deleting an object with Rigid Body settings without first removing it from the Rigid Body sims would result in a crash. Now delete objects accounts for this by doing this automatically
Modified Paths:
--------------
branches/soc-2010-aligorith-2/source/blender/editors/include/ED_physics.h
branches/soc-2010-aligorith-2/source/blender/editors/object/object_add.c
branches/soc-2010-aligorith-2/source/blender/editors/physics/rigidbody_object.c
Modified: branches/soc-2010-aligorith-2/source/blender/editors/include/ED_physics.h
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/editors/include/ED_physics.h 2010-08-08 08:33:47 UTC (rev 31162)
+++ branches/soc-2010-aligorith-2/source/blender/editors/include/ED_physics.h 2010-08-08 11:47:56 UTC (rev 31163)
@@ -30,13 +30,23 @@
#ifndef ED_PHYSICS_H
#define ED_PHYSICS_H
+struct bContext;
+struct wmOperator;
struct wmKeyConfig;
+struct Scene;
+struct Object;
+struct RigidBodyWorld;
+
/* particle_edit.c */
int PE_poll(struct bContext *C);
int PE_hair_poll(struct bContext *C);
int PE_poll_view3d(struct bContext *C);
+/* rigidbody_object.c */
+void ED_rigidbody_ob_add(struct bContext *C, struct wmOperator *op, struct RigidBodyWorld *rbw, struct Object *ob, int type);
+void ED_rigidbody_ob_remove(struct bContext *C, struct wmOperator *op, struct Scene *scene, struct Object *ob);
+
/* operators */
void ED_operatortypes_physics(void);
void ED_keymap_physics(struct wmKeyConfig *keyconf);
Modified: branches/soc-2010-aligorith-2/source/blender/editors/object/object_add.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/editors/object/object_add.c 2010-08-08 08:33:47 UTC (rev 31162)
+++ branches/soc-2010-aligorith-2/source/blender/editors/object/object_add.c 2010-08-08 11:47:56 UTC (rev 31163)
@@ -83,6 +83,7 @@
#include "ED_mball.h"
#include "ED_mesh.h"
#include "ED_object.h"
+#include "ED_physics.h"
#include "ED_render.h"
#include "ED_screen.h"
#include "ED_transform.h"
@@ -862,8 +863,12 @@
return OPERATOR_CANCELLED;
CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
-
if(base->object->type==OB_LAMP) islamp= 1;
+
+ /* remove from RigidBody worlds */
+ if(base->object->rigidbodySettings)
+ ED_rigidbody_ob_remove(C, op, scene, base->object);
+
/* remove from current scene only */
ED_base_object_free_and_unlink(scene, base);
}
Modified: branches/soc-2010-aligorith-2/source/blender/editors/physics/rigidbody_object.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/editors/physics/rigidbody_object.c 2010-08-08 08:33:47 UTC (rev 31162)
+++ branches/soc-2010-aligorith-2/source/blender/editors/physics/rigidbody_object.c 2010-08-08 11:47:56 UTC (rev 31163)
@@ -79,7 +79,7 @@
/* ----------------- */
-static void ed_rigidbody_ob_add (bContext *C, wmOperator *op, RigidBodyWorld *rbw, Object *ob, int type)
+void ED_rigidbody_ob_add (bContext *C, wmOperator *op, RigidBodyWorld *rbw, Object *ob, int type)
{
Scene *scene = CTX_data_scene(C);
RigidBodyOb *rbo;
@@ -138,7 +138,7 @@
BKE_rigidbody_validate_sim_object(rbw, ob, 0);
}
-static void ed_rigidbody_ob_remove (bContext *C, wmOperator *op, Scene *scene, Object *ob)
+void ED_rigidbody_ob_remove (bContext *C, wmOperator *op, Scene *scene, Object *ob)
{
RigidBodyWorld *rbw;
@@ -191,7 +191,7 @@
}
/* apply to active object */
- ed_rigidbody_ob_add(C, op, rbw, ob, type);
+ ED_rigidbody_ob_add(C, op, rbw, ob, type);
/* send updates */
DAG_ids_flush_update(0);
@@ -237,7 +237,7 @@
return OPERATOR_CANCELLED;
}
else
- ed_rigidbody_ob_remove(C, op, scene, ob);
+ ED_rigidbody_ob_remove(C, op, scene, ob);
/* send updates */
DAG_ids_flush_update(0);
@@ -283,7 +283,7 @@
/* apply this to all selected objects... */
CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
{
- ed_rigidbody_ob_add(C, op, rbw, ob, type);
+ ED_rigidbody_ob_add(C, op, rbw, ob, type);
}
CTX_DATA_END;
@@ -328,7 +328,7 @@
CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
{
if (ob->rigidbodySettings)
- ed_rigidbody_ob_remove(C, op, scene, ob);
+ ED_rigidbody_ob_remove(C, op, scene, ob);
}
CTX_DATA_END;
More information about the Bf-blender-cvs
mailing list