[Bf-blender-cvs] [4f78672] particles_refactor: Added applyModifier callback and AcceptsMesh flag so particle system can added on mesh objects. applyMesh is just a stub returning the unmodified mesh.

Lukas Tönne noreply at git.blender.org
Tue Apr 22 12:05:21 CEST 2014


Commit: 4f7867247b176aaf022c235b5c7c16ffb42d47cb
Author: Lukas Tönne
Date:   Tue Jun 4 13:24:28 2013 +0200
https://developer.blender.org/rB4f7867247b176aaf022c235b5c7c16ffb42d47cb

Added applyModifier callback and AcceptsMesh flag so particle system can added on mesh objects. applyMesh is just a stub returning the unmodified mesh.

===================================================================

M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_nparticle.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 0935665..82fec32 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -108,6 +108,7 @@ EnumPropertyItem modifier_type_items[] = {
 	{eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
 	{eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
 	{eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
+	{eModifierType_NParticleSystem, "NPARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particles (new)", ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
diff --git a/source/blender/modifiers/intern/MOD_nparticle.c b/source/blender/modifiers/intern/MOD_nparticle.c
index 6c89339..f1c4ce7 100644
--- a/source/blender/modifiers/intern/MOD_nparticle.c
+++ b/source/blender/modifiers/intern/MOD_nparticle.c
@@ -35,6 +35,9 @@
 #include "BKE_modifier.h"
 #include "BKE_nparticle.h"
 
+struct DerivedMesh;
+struct Object;
+
 static void nparticle_system_initData(ModifierData *md) 
 {
 	NParticleSystemModifierData *pmd= (NParticleSystemModifierData *)md;
@@ -55,20 +58,29 @@ static void nparticle_system_copyData(ModifierData *md, ModifierData *target)
 	tpmd->buffer = BKE_nparticle_buffer_copy(pmd->buffer);
 }
 
+static struct DerivedMesh *nparticle_system_applyModifier(ModifierData *UNUSED(md), struct Object *UNUSED(ob),
+                                                          struct DerivedMesh *derivedData,
+                                                          ModifierApplyFlag UNUSED(flag))
+{
+	/*NParticleSystemModifierData *pmd= (NParticleSystemModifierData *)md;*/
+	return derivedData;
+}
+
 ModifierTypeInfo modifierType_NParticleSystem = {
 	/* name */              "Particles",
 	/* structName */        "NParticleSystemModifierData",
 	/* structSize */        sizeof(NParticleSystemModifierData),
 	/* type */              eModifierTypeType_NonGeometrical,
-	/* flags */             eModifierTypeFlag_Single	/* for now only allow single particle buffer for unambiguous access */
-                            | eModifierTypeFlag_UsesPointCache,
+	/* flags */             eModifierTypeFlag_AcceptsMesh	/* for now only allow single particle buffer for unambiguous access */
+	                        | eModifierTypeFlag_Single
+	                        | eModifierTypeFlag_UsesPointCache,
 
 	/* copyData */          nparticle_system_copyData,
 	/* deformVerts */       NULL,
 	/* deformVertsEM */     NULL,
 	/* deformMatrices */    NULL,
 	/* deformMatricesEM */  NULL,
-	/* applyModifier */     NULL,
+	/* applyModifier */     nparticle_system_applyModifier,
 	/* applyModifierEM */   NULL,
 	/* initData */          nparticle_system_initData,
 	/* requiredDataMask */  NULL,




More information about the Bf-blender-cvs mailing list