[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23928] trunk/blender: Small particles feature: Multiple group visualization counts per group object are now possible (+/ - buttons next to the count list).

Janne Karhu jhkarh at utu.fi
Sun Oct 18 23:12:04 CEST 2009


Revision: 23928
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23928
Author:   jhk
Date:     2009-10-18 23:12:04 +0200 (Sun, 18 Oct 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/buttons_particle.py
    trunk/blender/source/blender/editors/physics/particle_object.c
    trunk/blender/source/blender/editors/physics/physics_intern.h
    trunk/blender/source/blender/editors/physics/physics_ops.c

Modified: trunk/blender/release/scripts/ui/buttons_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/buttons_particle.py	2009-10-18 20:52:15 UTC (rev 23927)
+++ trunk/blender/release/scripts/ui/buttons_particle.py	2009-10-18 21:12:04 UTC (rev 23928)
@@ -650,6 +650,8 @@
 				col = row.column()
 				subrow = col.row()
 				subcol = subrow.column(align=True)
+				subcol.itemO("particle.dupliob_copy", icon='ICON_ZOOMIN', text="")
+				subcol.itemO("particle.dupliob_remove", icon='ICON_ZOOMOUT', text="")
 				subcol.itemO("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="")
 				subcol.itemO("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="")
 				

Modified: trunk/blender/source/blender/editors/physics/particle_object.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_object.c	2009-10-18 20:52:15 UTC (rev 23927)
+++ trunk/blender/source/blender/editors/physics/particle_object.c	2009-10-18 21:12:04 UTC (rev 23928)
@@ -386,6 +386,90 @@
 	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)

Modified: trunk/blender/source/blender/editors/physics/physics_intern.h
===================================================================
--- trunk/blender/source/blender/editors/physics/physics_intern.h	2009-10-18 20:52:15 UTC (rev 23927)
+++ trunk/blender/source/blender/editors/physics/physics_intern.h	2009-10-18 21:12:04 UTC (rev 23928)
@@ -77,6 +77,8 @@
 void PARTICLE_OT_connect_hair(struct wmOperatorType *ot);
 void PARTICLE_OT_disconnect_hair(struct wmOperatorType *ot);
 
+void PARTICLE_OT_dupliob_copy(struct wmOperatorType *ot);
+void PARTICLE_OT_dupliob_remove(struct wmOperatorType *ot);
 void PARTICLE_OT_dupliob_move_up(struct wmOperatorType *ot);
 void PARTICLE_OT_dupliob_move_down(struct wmOperatorType *ot);
 

Modified: trunk/blender/source/blender/editors/physics/physics_ops.c
===================================================================
--- trunk/blender/source/blender/editors/physics/physics_ops.c	2009-10-18 20:52:15 UTC (rev 23927)
+++ trunk/blender/source/blender/editors/physics/physics_ops.c	2009-10-18 21:12:04 UTC (rev 23928)
@@ -79,6 +79,8 @@
 	WM_operatortype_append(PARTICLE_OT_connect_hair);
 	WM_operatortype_append(PARTICLE_OT_disconnect_hair);
 
+	WM_operatortype_append(PARTICLE_OT_dupliob_copy);
+	WM_operatortype_append(PARTICLE_OT_dupliob_remove);
 	WM_operatortype_append(PARTICLE_OT_dupliob_move_up);
 	WM_operatortype_append(PARTICLE_OT_dupliob_move_down);
 }





More information about the Bf-blender-cvs mailing list