CreateEventSource

Introduced

3.0

Description

Creates an emission source and adds it to a particle event.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

    CreateEventSource( Target, [Output] )

Parameters

Parameter | Type | Description
Target | Property | Event on which the emission source will be added. Default Value: Selected event property.
Output [out] | Property | Emission source generated.

Examples

JScript Example

    /*
       This example demonstrates how to add a new emission source to a particle event
    */

    NewScene( null, false );

    // Set up a disc emitting particles
    var pcloud = CreateParticleCloud( null, "Disc" )(0);

    // Set up goals for both PTypes
    var goal4OrigPType = CreatePrim( "Grid", "MeshSurface", "thing1" );
    Translate( goal4OrigPType, 30, 30, 5 );
    Rotate( goal4OrigPType, 0, 0, -90 );

    var goal4PEmitter = CreatePrim( "Grid", "MeshSurface", "thing2" );
    Translate( goal4PEmitter, -30, 30, -5 );
    Rotate( goal4PEmitter, 0, 0, 90 );

    // Set up a goal for the original PType (and color the particles
    // fuscia for this particle type so it's obvious which type is which)
    var myPType = pcloud.ActivePrimitive.ParticleTypes(0);
    myPType.Parameters( "Green" ).Value = 0.072;
    AddParticleGoal( myPType, goal4OrigPType );

    // Set up the event on the original particle type
    var myPEvent = AddParticleEvent( myPType )(0)(0);
    myPEvent.Name = "PEvent_Demo";
    myPEvent.Parameters( "EventTrigger" ).Value = 5;
    myPEvent.Parameters( "TriggerValue" ).Value = 7;
    myPEvent.Parameters( "EventAction" ).Value = 0;

    // Set up the emitter for the event
    myPEmission = CreateEventSource( myPEvent )(0);
    myPEmission.Parameters( "Rate" ).Value = 5;
    myPEmission.Parameters( "Spread" ).Value = 25;
    myPEmission.Parameters( "Roll" ).Value = 12;
    myPEmission.Parameters( "Yaw" ).Value = 7;

    // Set up a new blob particle type that will be emitted and set
    // the new particles to flee from the goal
    var connectPType2Emitter;
    for ( var i=0; myPEmission.NestedObjects.Count; i++ ) {
       if ( myPEmission.NestedObjects(i).Name == "PType" ) {
           connectPType2Emitter = myPEmission.NestedObjects(i);
           break;
       }
    }
    var myNewPType = CreateParticleType( siBlobType )(0);
    myNewPType.Name = "PType4Emitter";
    SetParticleType( connectPType2Emitter, myNewPType );
    AddParticleGoal( myNewPType, goal4PEmitter );

    // Now take a look at the simulation
    var myViewPort = Application.Desktop.ActiveLayout.Views( "vm" );
    myViewPort.SetAttributeValue( "layout", "maximize:b" );
    FrameAll();
    PlayForwardsFromStart();

See Also

AddParticleEmitter | AddParticleForce | AddParticleObstacle | ApplyParticleShader
CreateParticleCloud | CreateParticleType | SetParticleType | Particle
ParticleType | ParticleCloud | ParticleCloudPrimitive |

Autodesk Softimage v7.5