From 816856f953250f7da59c819bde1b77d59c32017c Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 18 Oct 2009 21:12:04 +0000 Subject: Small particles feature: Multiple group visualization counts per group object are now possible (+/- buttons next to the count list). This allows for example an array of duplicated objects "ob1, ob2, ob1, ob3" without duplicating the actual object (ob1 in the example) in the group. --- source/blender/editors/physics/particle_object.c | 84 ++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'source/blender/editors/physics/particle_object.c') diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 1dc08a162b7..34e2b062e98 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -386,6 +386,90 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/********************** particle dupliweight operators *********************/ + +static int copy_particle_dupliob_exec(bContext *C, wmOperator *op) +{ + PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ParticleSystem *psys= ptr.data; + ParticleSettings *part; + ParticleDupliWeight *dw; + + if(!psys) + return OPERATOR_CANCELLED; + part = psys->part; + for(dw=part->dupliweights.first; dw; dw=dw->next) { + if(dw->flag & PART_DUPLIW_CURRENT) { + dw->flag &= ~PART_DUPLIW_CURRENT; + dw = MEM_dupallocN(dw); + dw->flag |= PART_DUPLIW_CURRENT; + BLI_addhead(&part->dupliweights, dw); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); + break; + } + } + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_dupliob_copy(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Copy Particle Dupliob"; + ot->idname= "PARTICLE_OT_dupliob_copy"; + ot->description="Duplicate the current dupliobject."; + + /* api callbacks */ + ot->exec= copy_particle_dupliob_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int remove_particle_dupliob_exec(bContext *C, wmOperator *op) +{ + PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ParticleSystem *psys= ptr.data; + ParticleSettings *part; + ParticleDupliWeight *dw; + + if(!psys) + return OPERATOR_CANCELLED; + + part = psys->part; + for(dw=part->dupliweights.first; dw; dw=dw->next) { + if(dw->flag & PART_DUPLIW_CURRENT) { + BLI_remlink(&part->dupliweights, dw); + MEM_freeN(dw); + break; + } + + } + dw = part->dupliweights.last; + + if(dw) + dw->flag |= PART_DUPLIW_CURRENT; + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_dupliob_remove(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Remove Particle Dupliobject"; + ot->idname= "PARTICLE_OT_dupliob_remove"; + ot->description="Remove the selected dupliobject."; + + /* api callbacks */ + ot->exec= remove_particle_dupliob_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /************************ move down particle dupliweight operator *********************/ static int dupliob_move_down_exec(bContext *C, wmOperator *op) -- cgit v1.2.3 From 2344d62dfbb6f41318ea75fb610d1823baf23cfb Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 21 Oct 2009 10:56:31 +0000 Subject: Silencing some compiler warnings for mingw * Unused functions * Uninitialised vars --- source/blender/editors/physics/particle_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/physics/particle_object.c') diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 34e2b062e98..d227591739b 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -601,7 +601,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) ParticleData *pa; PTCacheEdit *edit; PTCacheEditPoint *point; - PTCacheEditKey *ekey; + PTCacheEditKey *ekey = NULL; HairKey *key; BVHTreeFromMesh bvhtree; BVHTreeNearest nearest; -- cgit v1.2.3 From aa7374e471bfb89242cfac855505269d0e728ea5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Nov 2009 12:27:28 +0000 Subject: - removing the last particle system now exits particle edit mode. - py UI script used an undeclared variable --- source/blender/editors/physics/particle_object.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/physics/particle_object.c') diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index d227591739b..d763c0500d2 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -93,11 +93,20 @@ static int particle_system_remove_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); - + int mode_orig = ob->mode; if(!scene || !ob) return OPERATOR_CANCELLED; object_remove_particle_system(scene, ob); + + /* possible this isn't the active object + * object_remove_particle_system() clears the mode on the last psys + * */ + if(mode_orig & OB_MODE_PARTICLE_EDIT) + if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) + if(scene->basact && scene->basact->object==ob) + WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); return OPERATOR_FINISHED; -- cgit v1.2.3