Jump to content

Copy Particle Attrs (like A Split)


Recommended Posts

Hello

I'm birthing particles in my HDK pop, I want them to get the same attribute values as a source particle they come from. Is there a simple way to do this w/out looping over all the attrs myself. Looks like there are provisions in the birthParticle function to do it, I'm just not clear how to get the right data to put in there

Here's the func I'm using from the POP_Node class:

GEO_ParticleVertex * 	birthParticle (POP_ContextData *data, GEO_PrimParticle *part, const UT_Vector4 &pos, POP_AttribMap *map, GB_AttributeData *inherit, GB_AttributeData *split, POP_IntFunc originIndex, int originGeo, int originUse, POP_FloatFunc lifetime, POP_BirthAttribFunc birthAttrib=NULL, void *userData=NULL)

Right now I'm simply putting NULL in those slots, particles are birthed but of course I don't get the attr inheritance. So in the case below "centerPt" is a GEO_Point (that came from an existing particle).. I want the new particle to essentially be a copy of that one.

pvtx = birthParticle(data, part, centerPt->getPos(), NULL, NULL, NULL, (POP_IntFunc) 0, 0, POP_ORIGIN_INDEX, (POP_FloatFunc) &POP_SoftBody::getLifetime);

Thanks for any help

D

Link to comment
Share on other sites

Hi Daniel,

i guess you can do this in the same function where you now put your NULL in,

your feeding the centerPt->getPos() into the position i guess, and in the same

way you cam provide some kind of mapping with the POP_AttribMap and use the

GB_AttributeData inherit the data from the old particles.

At such i point i wish a better documentation for the HDK, but thats what i found in the H8 HDK documentation

00510     // birthParticle() should be used to birth particles into a particle
00511     // system
00512     //     data          POP_ContextData being used
00513     //     part          particle primitive to birth into
00514     //     pos           position of the birthed point
00515     //     map           mapping for inheriting attributes from the inherit
00516     //                   GB_AttributeData
00517     //     inherit       inherit general attributes (required when map is used)
00518     //     split         inherit parental attributes (parent, origin, 
00519     //                   generation)
00520     //     originIndex   origin index value.
00521     //     originGeo     origin from geometry number    
00522     //     originUse     how to set origin id. Bit mask
00523     //                      POP_ORIGIN_INDEX: add passed in index
00524     //                      POP_ORIGIN_GEO: add source geometry number
00525     //                      POP_ORIGIN_PARENT: add split origin
00526     //     lifetime      total expected life of the particle
00527     //     birthAttrib   function to set attributes after particle is birthed
00528     //     userdata      passed into birthAttrib

i dont know if that helps you somehow,

Infernal

Link to comment
Share on other sites

Hi Daniel,

i guess you can do this in the same function where you now put your NULL in,

your feeding the centerPt->getPos() into the position i guess, and in the same

way you cam provide some kind of mapping with the POP_AttribMap and use the

GB_AttributeData inherit the data from the old particles.

At such i point i wish a better documentation for the HDK, but thats what i found in the H8 HDK documentation

00510     // birthParticle() should be used to birth particles into a particle
00511     // system
00512     //     data          POP_ContextData being used
00513     //     part          particle primitive to birth into
00514     //     pos           position of the birthed point
00515     //     map           mapping for inheriting attributes from the inherit
00516     //                   GB_AttributeData
00517     //     inherit       inherit general attributes (required when map is used)
00518     //     split         inherit parental attributes (parent, origin, 
00519     //                   generation)
00520     //     originIndex   origin index value.
00521     //     originGeo     origin from geometry number    
00522     //     originUse     how to set origin id. Bit mask
00523     //                      POP_ORIGIN_INDEX: add passed in index
00524     //                      POP_ORIGIN_GEO: add source geometry number
00525     //                      POP_ORIGIN_PARENT: add split origin
00526     //     lifetime      total expected life of the particle
00527     //     birthAttrib   function to set attributes after particle is birthed
00528     //     userdata      passed into birthAttrib

i dont know if that helps you somehow,

Infernal

Right, looks like there are the provisions to pass on the attr data, I just can't figure out how to build those objects to pass in. The mapping of attrs should be the same (I'd think) since the src and dst parts are in the same detail so they'd have the same attrs and attr order etc. I'm wondering if the mapping is optional and I can just pass the attribs across. Anyway, I have a mail into support to see how to get that to work.

Thanks Mr. InfernalSpawn

Daniel

(I need a cooler name.. damn)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...