Cebas ScriptOp Documentation

This is a copy of the documentation found in the scriptOps provided with TP

/*--------------------------------------------------------------------

cebas VISUAL TECHNOLOGY Inc.

4464 Markham Street Suite 2103G

Victoria,BC V8Z 7X8

copyright August 2009

TP_ScriptOperator

Make a script plugin with the baseclass of Geometry and extends the class TP_ScriptBase.

This plugin must be invisible because the user doesn't create a normal geormetry object node in the scene from this.

Then register the plugin to TP with the function tp_register.

You can register any numbers of operators in one script file. Please see to it that ervery operator has his own unique class id.

The script function "genClassID returnValue:true" creates a unique class id. Call this function in the listener and cut and copy the id into your script.

the plugin must contain three functions as interface to TP:

-tp_color_type return value is an integer, look at the available tp_color_types

-tp_init_inoutputs will call only once at creation of the operator

-tp_calculate this is the main function call every subsample

global functions

tp_register <plugin> tp_plugin <integer> tp_type

tp_unregister <plugin> tp_plugin

tp_type in which basis category this operator is shown

TP_TYPE_CONDITION = 0

TP_TYPE_OPERATOR = 1

TP_TYPE_HELPER = 2


tp_color_type for coloring in the TP schematicview

TP_COLOR_TYPE_CONDITION = 0

TP_COLOR_TYPE_OPERATOR = 1

TP_COLOR_TYPE_HELPER = 2

TP_COLOR_TYPE_GENERATOR = 3

TP_COLOR_TYPE_INITIATOR = 4

TP_COLOR_TYPE_SHAPE = 5

tp_port_type

TP_PORT_TYPE_NONE = 0

TP_PORT_TYPE_PARTICLE = 1

TP_PORT_TYPE_POSITION = 2

TP_PORT_TYPE_VELOCITY = 3

TP_PORT_TYPE_SPIN = 4

TP_PORT_TYPE_ALIGNMENT = 5

TP_PORT_TYPE_SIZE = 6

TP_PORT_TYPE_MASS = 7

TP_PORT_TYPE_SCALE = 8

TP_PORT_TYPE_GROUP = 9

TP_PORT_TYPE_ROTATION = 10

TP_PORT_TYPE_SHAPE = 11

TP_PORT_TYPE_MESH = 12

TP_PORT_TYPE_NORMAL = 13

TP_PORT_TYPE_DISTANCE = 14

TP_PORT_TYPE_DIRECTION = 15

TP_PORT_TYPE_RNDSEED = 16

TP_PORT_TYPE_LIFE = 17

TP_PORT_TYPE_AGE = 18

TP_PORT_TYPE_INTENSITY = 19

TP_PORT_TYPE_COLOR = 20

TP_PORT_TYPE_SPEED = 21

TP_PORT_TYPE_NODE = 22

TP_PORT_TYPE_BOOL = 23

TP_PORT_TYPE_TIME = 24

TP_PORT_TYPE_FLOAT = 25

TP_PORT_TYPE_POINT3 = 26

TP_PORT_TYPE_INT = 27

TP_PORT_TYPE_ANGLE = 28

TP_PORT_TYPE_AGRADIENT = 29

TP_PORT_TYPE_FRAME = 30

TP_PORT_TYPE_CGRADIENT = 31

TP_PORT_TYPE_TEXMAP = 32

TP_PORT_TYPE_MTL = 33

TP_PORT_TYPE_PATH = 34


tp_port_flags -- one or more of them

TP_PORT_FLAG_NONE = 0

TP_PORT_FLAG_INVISIBLE = 1

TP_PORT_FLAG_NEEDED = 2

tp_outid -- outputport id

when the calculate function is called with a tp_outid >= 0 the caller want the value of the output port with this id

calls with tp_outid < 0 are global calls, to do thinks like create particle


tp_inout -- interface to the in- and outputs


FUNCTIONS


-added an input to the InOutNode of the operator

<void> AddInput <integer> tp_port_type <string> name <integer> tp_port_flags


-added an output

<void> AddOutput <integer> tp_port_type <string> name <integer> tp_port_flags

-operator simulation delta time

<time> GetInDT()


-operator simulation time

<time> GetInTime()

-get the wired input value, or undefined

<value> GetInValue <integer> id -id is the inport id, begins at 2; 0 is the default "On" and 1 the "Time" port

-restore the cache

<value> GetParticleCache <integer> pid

-is the input connected to another operator's output

<boolean> InputConnected <integer> id -true if input connected


-is the input value changed

<boolean> InputChanged <integer> id

-true if the input value change since the last GetInValue

however, if connecting PIDs then it only looks for a change in the PID number

and not in changes within the particle data!

-name of the input port

<integer> InputName <integer> id

-input port type

<integer> InputType <integer> id

-insert an input port, moves all ports one up including the port on the id

<void> InsertInput <integer> id <integer> tp_port_type

<string> name <integer> tp_port_flags


-insert an output port, moves all ports one up including the port on the id

<void> InsertOutput <integer> id <integer> tp_port_type

<string> name <integer> tp_port_flags

-move an input port, from to

<void> MoveInput <integer> from <integer> to


-move an output port, from to

<void> MoveOutput <integer> from <integer> to


-number of inputs

<integer> NumInputs()


-number of outputs

<integer> NumOutputs()

-output port type

<void> OutputType <integer> id

-name of the output port

<integer> OnputName <integer> id

-is the output connected to another operator's input

<boolean> OutputConnected <integer> id -true if output connected

-recalculate the outputs

-for Initiator operators they calculate the circuit behind his outputs active

-say you have 1 or more particles created and the circuit behind should initialisize these

-please labeling the name of a initiator output with a "*",

-sample "*particle" so that the user to be aware of that

<boolean> ReCalculateOutputs()

-remove an input port

<boolean> RemoveInput <integer> id


-remove an output port

<boolean> RemoveOutput <integer> id

-rename the input port

<void> RenameInput <integer> id <string> name


-rename the output port

<void> RenameOutput <integer> id <string> name


-cache datas per particle

<value> SetParticleCache <integer> pid <value> value


-set the version

<void> SetVersion <integer> version


-the operater must make in tp_init_inoutputs a version check by himself, after loading a scene the function tp_init_inoutputs is called

-tp_inout.Version() returned the loading version, at new creation in the schematicview version is 0

-after converting or creating ports, must be set the curent version with tp_inout.SetVersion

-get the version of the inoutnode,

<integer> Version()


tp_system --interface to the tp particle system


functions

-added a particle to the system, default is age 0 and life span endless, return is the new particle id

<integer> AddParticle()


-get particle age

<time> Age <integer> pid

-get particle alignment

<matrix3> Alignment <integer> pid


-get particle alignment in delta time, it's only a forecast,

alignment with the actual spin

<matrix3> AlignmentDT <integer> pid <time> dt

-allow the particle to die

<void> Die <integer> pid

-get particle delta time factor

returns a float, based on the particle's DT relative to the (?) sim_dt

<float> DTFactor <integer> pid

-get particle group

<PGroup*> Group <integer> pid


-is the particle alive

<boolean> IsAlive <integer> pid


-is the particle just born

<boolean> IsBorn <integer> pid


-is the particle just die

<boolean> IsDie <integer> pid


-is the particle just enter a group

<boolean> IsEnterGroup <integer> pid


-get particle life span

<time> LifeSpan <integer> pid


-get particle mass

<float> Mass <integer> pid


-get particle material time

<time> MtlTime <integer> pid

-numbers of particle in the whole system, please think of there also dead particles in the list, to play it safe call the function IsAlive for a particle id

<integer> NumParticles()

-get particle position

<point3> Position <integer> pid


-get particle position in delta time , it's only a forecast, position with the actual velocity

<point3> PositionDT <integer> pid <time> dt

-get particle randomseed

<integer> Randomseed <integer> pid


-particle moved in this group

<void> SetGroup <integer> pid <referencetarget *> group


-set position

<void> SetPosition <integer> pid <point3> &pos


-set velocity

<void> SetVelocity <integer> pid <point3> &vel


-set age

<void> SetAge <integer> pid <time> age


-set life span

<void> SetLifeSpan <integer> pid <time> lifespan


-set size

<void> SetSize <integer> pid <float> size


-set particle scale

<void> SetScale <integer> pid <point3> &scale


-set particle alignment

<void> SetAlignment <integer> pid <matrix3> &align


-set particle mass

<void> SetMass <integer> pid <float> mass


-set particle spin

<void> SetSpin <integer> pid <angelaxis> &spin


-set particle randomseed

<void> SetRandomseed <integer> pid <integer> seed


-set particle delta t factor

<void> SetDTFactor <integer> pid <float> dtfactor


-set particle material time

<void> SetMtlTime <integer> pid <time> mtltime

-get particle scale

<point3> Scale <integer> pid


-get particle size

<float> Size <integer> pid


-get particle spin

<angelaxis> Spin <integer> pid

-get particle transform matrix

<matrix3> Transform <integer> pid


-get particle transform matrix in delta time, it's only a forecast,

the transform with the actual particle datas

<matrix3> TransformDT <integer> pid <time> dt


-get particle unique id

<integer> UniqueID <integer> pid


-update the particle system, please don't call this function inside the tp_calculate function, we are allready in update (unless you need to do iterator-style calculations)

<void> UpdateParticles <time> t <object> tpobject

-get particle velocity

<point3> Velocity <integer> pid



properties

-get the particle system updated time

<time> valid_t


-get the simulation delta time (subsample time step)

<time> sim_dt

this returns the actual timesample

e.g. 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 1.2f, etc


-get the simulation time, time to calculate the operator

<time> sim_t


-get the simulation interval start time and end time of the simulation

<interval> sim_interval

-simulation start

<boolean> sim_start


-simulation depth, 0 is a call from the dynsettree

and > 0 a call from an initiator output

<integer> sim_depth