[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25745] trunk/blender: Particles:
Brecht Van Lommel
brecht at blender.org
Tue Jan 5 16:23:10 CET 2010
Revision: 25745
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25745
Author: blendix
Date: 2010-01-05 16:23:09 +0100 (Tue, 05 Jan 2010)
Log Message:
-----------
Particles:
* Fix crash in mirror tool.
* Added X Mirror option back to the UI, flag is now same as the
one for edit and paint modes, stored in the mesh.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_view3d_toolbar.py
trunk/blender/source/blender/editors/physics/particle_edit.c
trunk/blender/source/blender/makesdna/DNA_scene_types.h
trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c
Modified: trunk/blender/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d_toolbar.py 2010-01-05 14:56:48 UTC (rev 25744)
+++ trunk/blender/release/scripts/ui/space_view3d_toolbar.py 2010-01-05 15:23:09 UTC (rev 25745)
@@ -972,6 +972,7 @@
if not pe.hair:
col.label(text="Correct:")
col.prop(pe, "auto_velocity", text="Velocity")
+ col.prop(ob.data, "use_mirror_x")
col = layout.column(align=True)
col.active = pe.editable
@@ -984,7 +985,6 @@
sub.active = pe.fade_time
sub.prop(pe, "fade_frames", slider=True)
-
bpy.types.register(VIEW3D_PT_tools_weightpaint)
bpy.types.register(VIEW3D_PT_tools_objectmode)
bpy.types.register(VIEW3D_PT_tools_meshedit)
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2010-01-05 14:56:48 UTC (rev 25744)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2010-01-05 15:23:09 UTC (rev 25745)
@@ -316,6 +316,14 @@
}
}
+static int pe_x_mirror(Object *ob)
+{
+ if(ob->type == OB_MESH)
+ return (((Mesh*)ob->data)->editflag & ME_EDIT_MIRROR_X);
+
+ return 0;
+}
+
/****************** common struct passed to callbacks ******************/
typedef struct PEData {
@@ -1185,7 +1193,7 @@
pe_iterate_lengths(scene, edit);
pe_deflect_emitter(scene, ob, edit);
PE_apply_lengths(scene, edit);
- if(pset->flag & PE_X_MIRROR)
+ if(pe_x_mirror(ob))
PE_apply_mirror(ob,edit->psys);
if(edit->psys)
update_world_cos(ob, edit);
@@ -1997,7 +2005,7 @@
/************************* utilities **************************/
-static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psys)
+static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psys, int mirror)
{
PTCacheEdit *edit = psys->edit;
ParticleEditSettings *pset= PE_settings(scene);
@@ -2007,7 +2015,7 @@
ParticleSystemModifierData *psmd;
int i, totpart, new_totpart= psys->totpart, removed= 0;
- if(pset->flag & PE_X_MIRROR) {
+ if(mirror) {
/* mirror tags */
psmd= psys_get_modifier(ob, psys);
totpart= psys->totpart;
@@ -2078,7 +2086,7 @@
ParticleSystemModifierData *psmd;
short new_totkey;
- if(pset->flag & PE_X_MIRROR) {
+ if(pe_x_mirror(ob)) {
/* mirror key tags */
psmd= psys_get_modifier(ob, psys);
@@ -2099,7 +2107,7 @@
if(new_totkey < 2)
point->flag |= PEP_TAG;
}
- remove_tagged_particles(scene, ob, psys);
+ remove_tagged_particles(scene, ob, psys, pe_x_mirror(ob));
LOOP_POINTS {
pa = psys->particles + p;
@@ -2270,7 +2278,7 @@
KDTreeNearest nearest[10];
POINT_P;
float mat[4][4], co[3], threshold= RNA_float_get(op->ptr, "threshold");
- int n, totn, removed, flag, totremoved;
+ int n, totn, removed, totremoved;
if(psys->flag & PSYS_GLOBAL_HAIR)
return OPERATOR_CANCELLED;
@@ -2316,10 +2324,7 @@
BLI_kdtree_free(tree);
/* remove tagged particles - don't do mirror here! */
- flag= pset->flag;
- pset->flag &= ~PE_X_MIRROR;
- remove_tagged_particles(scene, ob, psys);
- pset->flag= flag;
+ remove_tagged_particles(scene, ob, psys, 0);
totremoved += removed;
} while(removed);
@@ -2500,7 +2505,7 @@
}
else if(type == DEL_PARTICLE) {
foreach_selected_point(&data, set_delete_particle);
- remove_tagged_particles(data.scene, data.ob, data.edit->psys);
+ remove_tagged_particles(data.scene, data.ob, data.edit->psys, pe_x_mirror(data.ob));
recalc_lengths(data.edit);
}
@@ -2603,9 +2608,11 @@
newpa= psys->particles + totpart;
newpoint= edit->points + totpart;
- LOOP_VISIBLE_POINTS {
+ for(p=0, point=edit->points; p<totpart; p++, point++) {
pa = psys->particles + p;
+ if(point->flag & PEP_HIDE)
+ continue;
if(!(point->flag & PEP_TAG) || mirrorfaces[pa->num*2] == -1)
continue;
@@ -3097,7 +3104,7 @@
initialize_particle(&sim, pa,i);
reset_particle(&sim, pa, 0.0, 1.0);
point->flag |= PEP_EDIT_RECALC;
- if(pset->flag & PE_X_MIRROR)
+ if(pe_x_mirror(ob))
point->flag |= PEP_TAG; /* signal for duplicate */
framestep= pa->lifetime/(float)(pset->totaddkey-1);
@@ -3304,7 +3311,7 @@
else
foreach_point(&data, brush_cut);
- removed= remove_tagged_particles(scene, ob, edit->psys);
+ removed= remove_tagged_particles(scene, ob, edit->psys, pe_x_mirror(ob));
if(pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
}
@@ -3403,7 +3410,7 @@
recalc_lengths(edit);
if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT) && (added || removed)) {
- if(pset->brushtype == PE_BRUSH_ADD && (pset->flag & PE_X_MIRROR))
+ if(pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
PE_mirror_x(scene, ob, 1);
update_world_cos(ob,edit);
Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h 2010-01-05 14:56:48 UTC (rev 25744)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h 2010-01-05 15:23:09 UTC (rev 25745)
@@ -1124,7 +1124,7 @@
#define PE_DEFLECT_EMITTER 4
#define PE_INTERPOLATE_ADDED 8
#define PE_DRAW_PART 16
-#define PE_X_MIRROR 64
+#define PE_X_MIRROR 64 /* deprecated */
#define PE_FADE_TIME 128
#define PE_AUTO_VELOCITY 256
Modified: trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c 2010-01-05 14:56:48 UTC (rev 25744)
+++ trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c 2010-01-05 15:23:09 UTC (rev 25745)
@@ -454,10 +454,6 @@
RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles.");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
- prop= RNA_def_property(srna, "mirror_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_X_MIRROR);
- RNA_def_property_ui_text(prop, "X-Axis Mirror", "Mirror operations over the X axis while editing.");
-
prop= RNA_def_property(srna, "add_interpolate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones.");
More information about the Bf-blender-cvs
mailing list