PopcornFX v2.13

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.13
  4. Plugins
  5. O3DE Gem
  6. Event Buses
  7. PopcornFX Requests

PopcornFX Requests

PopcornFX Requests Bus

The PopcornFX request bus is used to communicate with the PopcornFX runtime.

It also allow users to spawn and manipulate effects without having to create an emitter component in the scene.

Warning: Be careful, most of those events need the effect to be loaded and instantiated before being used!
The effect async loading and creation is triggered by:

  • PreloadEffectById
  • PreloadEffectByName
  • SpawnEmitterAtLocation
  • SpawnEmitterEntityAtLocation
  • SpawnEffectById
  • SpawnEffectByName

You can check if the emitter has been created by:

  • When using the SpawnEmitterEntityAtLocation event, you can use the emitter component requests bus with the returned AZ::EntityId and check if IsLoaded() returns true
  • Use the IsEffectsPreloadingDone() that will only return true if all effects have finished loading
  • Connect to the PopcornFX events bus and wait for the OnFxCreated() callback

 

Return typeDescription
boolPreloadEffectById(const AZ::Data::AssetId &assetId)
This function is used to preload an effect. This will avoid the SpawnEmitter* and SpawnEffect* functions to stall the first time an effect is instantiated.
assetId is the identifier corresponding to the “.pkfx” effect asset.
Returns false if assetId is invalid.
boolPreloadEffectByName(const AZStd::string &path)
This function is used to preload an effect. This will avoid the SpawnEmitter* and SpawnEffect* functions to stall the first time an effect is instantiated.
pathis the path to the “.pkfx” effect asset.
Returns false if path is invalid.
boolIsEffectsPreloadingDone()
Returns true when preloading is finished for all effects.
voidSpawnEmitterAtLocation(const AZStd::string &path, const AZ::Transform &transform)
Spawns an emitter with the specified transform without creating any emitter component. The emitter is started automatically.
There is no way to manipulate the emitter properties once it has been created with this method.
pathis the path to the “.pkfx” effect asset.
AZ::EntityIdSpawnEmitterEntityAtLocation(const AZStd::string &path, const AZ::Transform &transform, bool start)
Spawns an emitter component attached to an entity at the specified transform .
pathis the path to the “.pkfx” effect asset.
start specifies if the emitter should be started at creation.
Returns an AZ::EntityId corresponding to the emitter component parent entity. You can then use the emitter component requests or emitter component events buses on this entity.
StandaloneEmitter*SpawnEffectById(const AZ::Data::AssetId &assetId, const SpawnParams &spawnParams)
Spawn an emitter with the specified spawnParams properties without creating any emitter component in the scene. This should be more efficient than spawning effects using components.
assetId is the identifier corresponding to the “.pkfx” effect asset.
Returns a pointer to a StandaloneEmitter. This pointer is owned by the PopcornFX effect manager and should not be freed manually.
StandaloneEmitter*SpawnEffectByName(const AZStd::string &path, const SpawnParams &spawnParams)
Spawn an emitter with the specified spawnParams properties without creating any emitter component in the scene. This should be more efficient than spawning effects using components.
path is the path to the “.pkfx” effect asset.
Returns a pointer to a StandaloneEmitter. This pointer is owned by the PopcornFX effect manager and should not be deleted manually.
If spawnParams.m_AutoRemove is set to true, the StandaloneEmitter will be destroyed automatically when the effect has finished playing. If not, you should destroy it by calling DestroyEffect.
voidDestroyEffect(StandaloneEmitter *emitter)
Destroys the emitter.
boolIsEffectAlive(StandaloneEmitter *emitter)
Returns true if the emitter still has living particles.
voidEffectAttachToEntity(StandaloneEmitter *emitter, AZ::EntityId entityId)
Attaches a standalone emitter to the entity identified by entityId: the emitter will follow the entity transforms.
This will not add an emitter component to the entity and you will not be able to manipulate the emitter using the emitter component buses.
voidEffectDetachFromEntity(StandaloneEmitter *emitter)
Detaches the emitter from the entity it was attached to using EffectAttachToEntity.
AZ::EntityIdEffectGetAttachedEntity(StandaloneEmitter *emitter)
Returns the AZ::EntityId identifying the entity the emitter is attached to.
voidEffectSetTransform(StandaloneEmitter *emitter, const AZ::Transform &transform)
Transforms the emitter using the  transform parameter.
voidEffectEnable(StandaloneEmitter *emitter, bool enable)
Same as Enable(bool enable)in the emitter component requests bus, but for the standalone emitter.
boolEffectStart(StandaloneEmitter *emitter)
Same as Start()in the emitter component requests bus, but for the standalone emitter.
boolEffectStop(StandaloneEmitter *emitter)
Same as Stop()in the emitter component requests bus, but for the standalone emitter.
boolEffectTerminate(StandaloneEmitter *emitter)
Same as Terminate()in the emitter component requests bus, but for the standalone emitter.
boolEffectKill(StandaloneEmitter *emitter)
Same as Kill()in the emitter component requests bus, but for the standalone emitter.
boolEffectRestart(StandaloneEmitter *emitter, bool killOnRestart)
Same as Restart(bool killOnRestart)in the emitter component requests bus, but for the standalone emitter.
boolEffectIsEnabled(StandaloneEmitter *emitter)
Same as IsEnabled() in the emitter component requests bus, but for the standalone emitter.
boolEffectIsPlaying(StandaloneEmitter *emitter)
Same as IsPlaying() in the emitter component requests bus, but for the standalone emitter.
voidEffectSetVisible(StandaloneEmitter *emitter, bool visible)
Same as SetVisible(bool visible) in the emitter component requests bus, but for the standalone emitter.
boolEffectGetVisible(StandaloneEmitter *emitter)
Same as GetVisible() in the emitter component requests bus, but for the standalone emitter.
voidEffectSetTimeScale(StandaloneEmitter *emitter, float timeScale)
Same as SetTimeScale(float timeScale) in the emitter component requests bus, but for the standalone emitter.
floatEffectGetTimeScale(StandaloneEmitter *emitter)
Same as GetTimeScale() in the emitter component requests bus, but for the standalone emitter.
voidEffectSetPrewarmEnable(StandaloneEmitter *emitter, bool enable)
Same as SetPrewarmEnable(bool enable) in the emitter component requests bus, but for the standalone emitter.
boolEffectGetPrewarmEnable(StandaloneEmitter *emitter)
Same as EffectGetPrewarmEnable() in the emitter component requests bus, but for the standalone emitter.
voidEffecSetPrewarmTime(StandaloneEmitter *emitter, float time)
Same as EffecSetPrewarmTime(float time) in the emitter component requests bus, but for the standalone emitter.
floatEffecGetPrewarmTime(StandaloneEmitter *emitter)
Same as EffecGetPrewarmTime() in the emitter component requests bus, but for the standalone emitter.
AZ::u32GetAttributesCount(StandaloneEmitter *emitter)
Same as GetAttributesCount() in the emitter component requests bus, but for the standalone emitter.
AZ::s32GetAttributeType(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as GetAttributeType(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeId(StandaloneEmitter *emitter, const AZStd::string &name)
Same as EffectGetAttributeId(const AZStd::string &name) in the emitter component requests bus, but for the standalone emitter.
boolEffectResetAttributeToDefault(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectResetAttributeToDefault(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsFloat(StandaloneEmitter *emitter, AZ::u32 attribId, float value)
Same as EffectSetAttributeAsFloat(AZ::u32 attribId, float value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsFloat2(StandaloneEmitter *emitter, AZ::u32 attribId, const AZ::Vector2 &value)
Same as EffectSetAttributeAsFloat2(AZ::u32 attribId, const AZ::Vector2 &value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsFloat3(StandaloneEmitter *emitter, AZ::u32 attribId, const AZ::Vector3 &value)
Same as EffectSetAttributeAsFloat3(AZ::u32 attribId, const AZ::Vector3 &value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsFloat4(StandaloneEmitter *emitter, AZ::u32 attribId, const AZ::Vector4 &value)
Same as EffectSetAttributeAsFloat4(AZ::u32 attribId, const AZ::Vector4 &value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsInt(StandaloneEmitter *emitter, AZ::u32 attribId, AZ::s32 value)
Same as EffectSetAttributeAsInt(AZ::u32 attribId, AZ::s32 value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsInt2(StandaloneEmitter *emitter, AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY)
Same as EffectSetAttributeAsInt2(AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsInt3(StandaloneEmitter *emitter, AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY, AZ::s32 valueZ)
Same as EffectSetAttributeAsInt3(AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY, AZ::s32 valueZ) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsInt4(StandaloneEmitter *emitter, AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY, AZ::s32 valueZ, AZ::s32 valueW)
Same as EffectSetAttributeAsInt4(AZ::u32 attribId, AZ::s32 valueX, AZ::s32 valueY, AZ::s32 valueZ, AZ::s32 valueW) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsBool(StandaloneEmitter *emitter, AZ::u32 attribId, bool value)
Same as EffectSetAttributeAsBool(AZ::u32 attribId, bool value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsBool2(StandaloneEmitter *emitter, AZ::u32 attribId, bool valueX, bool valueY)
Same as EffectSetAttributeAsBool2(AZ::u32 attribId, bool valueX, bool valueY) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsBool3(StandaloneEmitter *emitter, AZ::u32 attribId, bool valueX, bool valueY, bool valueZ)
Same as EffectSetAttributeAsBool3(AZ::u32 attribId, bool valueX, bool valueY, bool valueZ) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsBool4(StandaloneEmitter *emitter, AZ::u32 attribId, bool valueX, bool valueY, bool valueZ, bool valueW)
Same as EffectSetAttributeAsBool4(AZ::u32 attribId, bool valueX, bool valueY, bool valueZ, bool valueW) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsQuaternion(StandaloneEmitter *emitter, AZ::u32 attribId, const AZ::Quaternion &value)
Same as EffectSetAttributeAsQuaternion(AZ::u32 attribId, const AZ::Quaternion &value) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeAsColor(StandaloneEmitter *emitter, AZ::u32 attribId, const AZ::Color &value)
Same as EffectSetAttributeAsColor(AZ::u32 attribId, const AZ::Color &value) in the emitter component requests bus, but for the standalone emitter.
floatEffectGetAttributeAsFloat(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeAsFloat(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::Vector2EffectGetAttributeAsFloat2(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeAsFloat2(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::Vector3EffectGetAttributeAsFloat3(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeAsFloat3(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::Vector4EffectGetAttributeAsFloat4(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeAsFloat4(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeXAsInt(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeXAsInt(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeYAsInt(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeYAsInt(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeZAsInt(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeZAsInt(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeWAsInt(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeWAsInt(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
boolEffectGetAttributeXAsBool(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeXAsBool(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
boolEffectGetAttributeYAsBool(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeYAsBool(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
boolEffectGetAttributeZAsBool(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeZAsBool(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
boolEffectGetAttributeWAsBool(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeWAsBool(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::QuaternionEffectGetAttributeAsQuaternion(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeAsQuaternion(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::ColorEffectGetAttributeAsColor(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeAsColor(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeSamplersCount(StandaloneEmitter *emitter)
Same as EffectGetAttributeSamplersCount() in the emitter component requests bus, but for the standalone emitter.
AZ::s32EffectGetAttributeSamplerId(StandaloneEmitter *emitter, const AZStd::string &name)
Same as EffectGetAttributeSamplerId(const AZStd::string &name) in the emitter component requests bus, but for the standalone emitter.
boolEffectSetAttributeSampler(StandaloneEmitter *emitter, AZ::u32 attribId, AZ::EntityId entityId)
Same as EffectSetAttributeSampler(AZ::u32 attribId, AZ::EntityId entityId) in the emitter component requests bus, but for the standalone emitter.
boolEffectResetSamplerToDefault(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectResetSamplerToDefault(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
AZ::EntityIdEffectGetAttributeSampler(StandaloneEmitter *emitter, AZ::u32 attribId)
Same as EffectGetAttributeSampler(AZ::u32 attribId) in the emitter component requests bus, but for the standalone emitter.
voidEffectSetTeleportThisFrame(StandaloneEmitter *emitter)
Same as EffectSetTeleportThisFrame() in the emitter component requests bus, but for the standalone emitter.
floatGetLODBias()
Returns the current level of details bias value.
voidSetLODBias(float bias)
Sets the level of details bias.
voidSetBakingThreadpool()
Internal function used to build the “.pkfx” assets.

 

StandaloneEmitter

The StandaloneEmitter class is just a handler to an emitter that is was not spawn as a component. It is a way to handle effects in your C++ code without having to add components in your scene.

 

Warning You cannot directly manipulate the StandaloneEmitter, it is just a handle that should be used with the PopcornFX requests bus functions.

SpawnParams

The SpawnParams class is used to configure an emitter at spawn. It allows for controlling the initial properties of the emitter when it is instantiated.

 

It holds the following members:

  • m_Enable: If true, the effect is enabled by default.
  • m_AutoRemove: If true, the StandaloneEmitter will be automatically removed. Otherwise you will need to call the Destroy function on the PopcornFX requests bus.
  • m_Transform: Initial emitter transforms.
  • m_PrewarmTime: Prewarm time. If set to 0.0f, the emitter will not be prewarmed and GetPrewarmEnable will return false.
  • m_ParentEntityId: If valid, this will attach the emitter to this entity transforms.
  • m_Attributes: List of attributes to initially set in the emitter. All the attributes not specified here will have their default values.
    You can use AddAttribute(const Attribute &attribute) to set attributes in this list.
  • m_AttributeSamplers: List of samplers to initially set in the emitter. All the samplers not specified here will have their default values.
    You can use AddAttributeSampler(const AttributeSampler &attributeSampler) to set samplers in this list.
Was this article helpful to you? Yes No

How can we help?