[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23586] trunk/blender/source/blender/ editors/physics/particle_edit.c: Fix crashes with . blend files saved in particle mode, derivedmesh
Brecht Van Lommel
brecht at blender.org
Thu Oct 1 18:30:05 CEST 2009
Revision: 23586
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23586
Author: blendix
Date: 2009-10-01 18:30:05 +0200 (Thu, 01 Oct 2009)
Log Message:
-----------
Fix crashes with .blend files saved in particle mode, derivedmesh
can't be assumed to be made yet then.
Modified Paths:
--------------
trunk/blender/source/blender/editors/physics/particle_edit.c
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2009-10-01 16:06:10 UTC (rev 23585)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2009-10-01 16:30:05 UTC (rev 23586)
@@ -110,14 +110,11 @@
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
- PTCacheEdit *edit;
- if(!scene || !ob)
+ if(!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
return 0;
- edit= PE_get_current(scene, ob);
-
- return (edit && (ob->mode & OB_MODE_PARTICLE_EDIT));
+ return (PE_get_current(scene, ob) != NULL);
}
int PE_hair_poll(bContext *C)
@@ -126,12 +123,12 @@
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit;
- if(!scene || !ob)
+ if(!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
return 0;
edit= PE_get_current(scene, ob);
- return (edit && edit->psys && (ob->mode & OB_MODE_PARTICLE_EDIT));
+ return (edit && edit->psys);
}
int PE_poll_3dview(bContext *C)
@@ -675,6 +672,9 @@
psmd= psys_get_modifier(ob, psys);
totpart= psys->totpart;
+ if(!psmd->dm)
+ return;
+
tree= BLI_kdtree_new(totpart);
/* insert particles into kd tree */
@@ -803,6 +803,9 @@
edit= psys->edit;
psmd= psys_get_modifier(ob, psys);
+ if(!edit->mirror_cache || !psmd->dm)
+ return;
+
/* we delay settings the PARS_EDIT_RECALC for mirrored particles
* to avoid doing mirror twice */
LOOP_POINTS {
@@ -841,6 +844,9 @@
psys = edit->psys;
psmd = psys_get_modifier(ob,psys);
+ if(!psmd->dm)
+ return;
+
LOOP_EDITED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles + p, hairmat);
@@ -994,6 +1000,9 @@
float *vec, *nor;
int i, totface, totvert;
+ if(!dm)
+ return;
+
if(edit->emitter_cosnos)
MEM_freeN(edit->emitter_cosnos);
@@ -1079,7 +1088,7 @@
POINT_P; KEY_K;
float hairmat[4][4];
- if(psys==0 || psys->edit==0)
+ if(psys==0 || psys->edit==0 || psmd->dm==NULL)
return;
LOOP_POINTS {
@@ -2444,6 +2453,8 @@
return;
psmd= psys_get_modifier(ob, psys);
+ if(!psmd->dm)
+ return;
mirrorfaces= mesh_get_x_mirror_faces(ob, NULL);
More information about the Bf-blender-cvs
mailing list