[Closed] [max sdk] Getting render state of particle flow
Hi,
I’m trying to retrieve particle container object from particle flow.
IParticleGroup *iPGroup = ParticleGroupInterface(pFlowGroupNodes[i]);
IObject *pContObj = iPGroup->GetParticleContainer();
pFlowGroupNodes is INodeTab with nodes which class id is ParticleGroup_Class_ID.
This is working fine but if I for example want to get render mesh or a channel from pflow I get it’s viewport state (let’s say 10% of all particles).
To switch all objects to render state I do this
BeginEnum beginEnum(t);
ClearFlags clearFlags;
for(int i=0;i<allNodes.Count();i++)
{
ReferenceMaker* rm = allNodes[i];
EnumRefs(rm, clearFlags);
}
for(int i=0;i<allNodes.Count();i++)
{
ReferenceMaker* rm = allNodes[i];
EnumRefs(rm, beginEnum);
}
In first loop I clear A_WORK1 flag. In second I call RenderBegin(t) for every reference and set A_WORK1 flag back. After rendering is finished I do same thing but I call RenderEnd(t) instead.
This is working fine because for example all modifiers are in render state, also particles like spray or snow are in render state. With pflow it is different. iPGroup->GetParticleContainer() returns NULL. Can anyone tell me why this is happening? I suspect that RenderBegin may not be implemented for particle groups. In that case is there any other way to retrieve particle channels for example IParticleChannelAmountR? Functions that are used to acquire them like GetParticleChannelAmountRInterface require some object, what else could it be if not particle container?
When I tried GetParticleContainer() inside render effect plugin (it gets scene already set to render state) it works as it should be. Particle flow stuff in render state. So I guess I just don’t know how to switch it.
Thanks for any help.
regards