LoginSignup
1
0

More than 1 year has passed since last update.

[3ds Max][TyFlow] TyFlow Script Operator Reference

Posted at

はじめに

TyflowのScriptOperatorのリファレンスになります。
Maxを起動しないと確認できないので、Maxを起動するのが手間だと思う方用です。

TyflowのScriptOperatorはMaxScriptではなく、C#となっています。

TyflowのScriptOperatorのリファレンスの見方

TyflowのScriptOperatorのリファレンスは、ScriptOperatorのScriptEditorのAPIから確認できます。
スクリーンショット 2022-10-11 160135.jpg

TyflowのScriptOperatorのリファレンス

Tyflow[v0.16134]

TyflowScriptReference.cs
/*
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
//////////                                   //////////
//////////   SCRIPT OPERATOR DOCUMENTATION   //////////					
//////////                                   //////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////

///////////// BUILT-IN KEYBOARD SHORTCUTS /////////////					
//
// [CTRL+E]					= evaluate script
//
///////////////////////////////////////////////////////

//////////////// SIMULATION PROPERTIES ////////////////					
//
// [tyFlow]	tf					= this tyFlow
// [INode]	node				= this tyFlow's scene node
//
// [tfObj]	obj[XXX]			= individual access to objects in operator scriptable-object listbox (ex: 'obj001')
// [List]	objects				= List<tfObj> of all objects in operator listbox (ex: 'objects[0]')
//
// [tfTex]	tex[XXX]			= individual access to texmaps in operator scriptable-texmap listbox (ex: 'tex001')
// [List]	texmaps				= List<tfTex> of all texmaps in operator listbox (ex: 'texmaps[0]')
//
// [float]	f					= current frame
// [float]	frameStep			= current timeStep (frames)
// [int]	t					= current tick
// [int]	tickStep			= current timeStep (ticks) 
// [int]	ticksPerFrame		= ticks per frame 
//
// [int]	eventParticleCount	= number of particles in this event prior to script execution
// [int]	totalParticleCount	= number of particles in this simulation prior to script execution
//
// [List<int>] GetEventParticles(string eventName) = gets a list of simulation indices for the particles of an event with the given name (name is not case-sensitive)
//
///////////////////////////////////////////////////////

//////////////////// MISC FUNCTIONS ///////////////////
//
// [float]   GetFloat(string name)							= get the value, by name, of the float from the 'Floats' rollout
// [float]   GetFloat(string name, float frame)				= get the value, by name (at the specified frame), of the float from the 'Floats' rollout
//
// [float]	 Lerp(float f1, float f2, float interp)			= linearly interpolate between two numerical values 
// [Point3]  Lerp(Point3 f1, Point3 f2, float interp)		= linearly interpolate between two vectors 
// [Matrix3] Lerp(Matrix3 tm1, Matrix3 tm2, float interp)	= linearly interpolate between two matrices 
// [Quat]	 Lerp(Quat tm1, Quat tm2, float interp)			= linearly interpolate between two quaternions
//
// [Matrix3] Inverse(Matrix3 m)								= get the inverse matrix
//
// [void]	 Print(object value)							= prints a value to the maxscript listener (maximum 100 prints/step)
// [void]	 PrintAll(object value)							= prints a value to the maxscript listener (unlimited prints/step - may result in long timeouts!)
//
// [void]	 DrawMarker(Point3 pos, int r, int g, int b)				= draws a colored (rgb) marker in the viewport at a location (must be called in [simulationStep])
// [void]	 DrawLine(Point3 pos1, Point3 pos2, int r, int g, int b)	= draws a colored (rgb) line in the viewport at a location (must be called in [simulationStep])
// [void]	 DrawTM(Matrix3 tm, float size)								= draws a tri-colored Matrix3 axis in the viewport (must be called in [simulationStep])
//
///////////////////////////////////////////////////////

////////////// [tyFlow] CLASS PROPERTIES ////////////// 
//
// [void]	 SetThreaded(bool val)			= set whether or not the script will be multithreaded (SimulationStepThreaded will be evaluated by multiple threads)
// [void]    SetThreadedIterations(int n)	= set the number of times SimulationStepThreaded will be re-evaluated from start to finish
// [int]	 GetThreadedIteration()			= get the current iteration being processed (call from within SimulationStepThreaded)
//
// [int]	 GetSimIndex(int eInx)		= get simulation index of a particle in the current event
// [int]	 GetSimIndexFromID(int ID)	= get simulation index of a particle from its ID [-1 == deleted]
//
// [int]	 CopyParticle(int sInx)		= copy a particle by simulation index and get the new particle's event index [WARNING: NOT thread safe!]
// [int]	 NewParticle()				= spawn a new particle and get its event index [WARNING: NOT thread safe!]
// [void]    DeleteParticle(int sInx)   = delete a particle by simulation index
//
// [void]	 TestTrue(int eInx)			= set test condition for event particle to true
// [void]	 OutputParticle(int eInx)	= equivalent to TestTrue(eInx)
//
// [int]	 GetID(int sInx)			= get particle ID from simulation index
// [int]	 GetParentID(int sInx)		= get particle ID of parent from simulation index
//
// [float]	 GetAge(int sInx)			= get particle age (in frames) from simulation index
// [int]	 GetAgeTicks(int sInx)		= get particle age (in ticks) from simulation index
// [float]	 GetEventAge(int sInx)		= get particle event age (in frames) from simulation index
// [int]	 GetEventAgeTicks(int sInx)	= get particle event age (in ticks) from simulation index
//
// [Point3]	 GetPos(int sInx)				= get particle position from simulation index
// [Quat]	 GetRot(int sInx)				= get particle rotation (quaternion) values from simulation index
// [Point3]	 GetScale(int sInx)				= get particle scale from simulation index
// [Matrix3] GetTM(int sInx)				= get particle transform from simulation index
// [Point3]	 GetSpin(int sInx)				= get particle spin from simulation index
// [Point3]	 GetVel(int sInx)				= get particle velocity from simulation index
// [int]	 GetSimulationGroups(int sInx)	= get particle simulation group flags (1 << [0-15])
// [int]	 GetExportGroups(int sInx)		= get particle export group flags (1 << [0-15])
// [int]	 GetMatID(int sInx)				= get particle materialID from simulation index [range 1-99] [0 == not assigned]
// [Point3]  GetUVW(int sInx, int channel)	= get particle mapping UVW from simulation index and map channel index [range 0-99]
// [float]	 GetMass(int sInx)				= get particle bind mass
// [float]   GetRadius(int sInx)			= get particle radius from simulation index
// [float]   GetVolume(int sInx)			= get particle volume from simulation index
//
// [tfMesh]	 GetMesh(int sInx)				= get tfMesh wrapper for particle shape mesh
//
// [void]	 SetPos(int sInx, Point3 pos)				= set particle position from simulation index
// [void]	 SetRot(int sInx, Quat rot)					= set particle rotation (quaternion) values from simulation index
// [void]	 SetScale(int sInx, Point3 scale)			= set particle scale from simulation index
// [void] 	 SetTM(int sInx, Matrix3 tm)				= set particle transform from simulation index
// [void]	 SetSpin(int sInx, Point3 spin)				= set particle spin from simulation index
// [void]	 SetVel(int sInx, Point3 vel)				= set particle velocity from simulation index
// [void]	 SetSimulationGroups(int sInx, int flags)	= set particle simulation group flags (1 << [0-15])
// [void]	 SetExportGroups(int sInx, int flags)		= set particle export group flags (1 << [0-15])
// [void]	 SetMatID(int sInx, int matID)				= set particle materialID from simulation index [range 1-99] [0 == unassign]
// [void]	 SetUVW(int sInx, int channel, Point3 uvw)	= set particle mapping UVW from simulation index and map channel index [range 0-99]
// [void]	 SetMass(int sInx, float mass)				= set particle bind mass
//
// [float]	 GetCustomFloat(int sInx, string channel)	= get particle custom float from simulation index
// [Point3]	 GetCustomVector(int sInx, string channel)	= get particle custom vector from simulation index
// [Matrix3] GetCustomTM(int sInx, string channel)		= get particle custom transform from simulation index
//
// [void]	 SetCustomFloat(int sInx, string channel, float val)		= set particle custom float from simulation index
// [void]	 SetCustomVector(int sInx, string channel, Point3 val)		= set particle custom vector from simulation index
// [void]	 SetCustomTM(int sInx, string channel, Matrix3 val)		= set particle custom transform from simulation index
//
// [float]	 GetNoise(float x, float y, float z)								= get random noise from coordinates
// [Point3]	 GetCurlNoise(int time, Point3 pos, float frequency, float scale, float phase)	= get curl noise from time, coordinates, frequency, scale and phase
// [Point3]  GetTurbulence(int time, Point3 pos, float frequency, float scale, float phase)	= get turbulent noise from time, coordinates, frequency, scale and phase
//
// [void]	 SetSeed(int sInx, int seed)					= set particle random seed from simulation index
// [int]	 GetRandInt(int sInx, int min, int max)			= get random integer from simulation particle [>= min && < max]
// [float]	 GetRandFloat(int sInx, float min, float max)	= get random float from simulation particle [>= min && <= max]
// [Point3]	 GetRandVector(int sInx)						= get random vector on unit sphere from simulation particle
//
// [void]			SetBindsActive(int sInx, bool val)		= set whether the particle will be affected by its bindings
// [List<tfBind>]	GetBinds(int sInx)						= get the bindings of a particle [WARNING: NOT thread safe!]
// [void]			SetBinds(List<tfBind> binds)			= apply changes to particle bindings retrieved with GetBinds [WARNING: NOT thread safe!]
// [void]			NewBind(int sInx1, int sInx2, int id, float length, float stiffness) = create a new binding between two particles from their simulation indices [WARNING: NOT thread safe!]
//
// [void]		PrepNeighbors(bool addVelocities)			= build data structure for doing neighbor searches, with option to integrate velocities. MUST be called before any calls to "GetNeighbors" [WARNING: call this OUTSIDE of your particle loop!]
// [List<int>]	GetNeighbors(Point3 pos, float radius)		= get simulation indices of particles within radius of position
//
// [void]	UpdatePhysXTM(int sInx)													= updates an existing particle's PhysX transform [WARNING: NOT thread safe!]
// [bool]	PhysXOverlapTest(int sInx1, Matrix3 tm1, int sInx2, Matrix3 tm2)		= true if two PhysX particle hulls overlap, from simulation index and transform
// [bool]	PhysXSweepTest(int sInx, Matrix3 tm, Point3 sweepVec, bool includeSelf)	= true if a PhysX particle hull overlaps with another PhysX particle, from simulation index, transform and sweep vector [includeSelf == sweep test will include query particle]
//
// [tfObj]	GetObject(string name)	= get tfObj wrapper for scene object by name
// [tfObj]	GetObject(int handle)	= get tfObj wrapper for scene object by handle
//
///////////////////////////////////////////////////////

///////////// [tfTex] CLASS PROPERTIES ////////////////
//
// [float]	 GetMonoVal(int t, Point3 uvw)				= get texture mono value based on time (in ticks) and UVW coordinates (range: 0.0 - 1.0)
// [Point3]	 GetColorVal(int t, Point3 uvw, bool gamma)	= get texture color value (optionally, gamma corrected) based on time (in ticks) and UVW coordinates (range: 0.0 - 1.0)
//
///////////////////////////////////////////////////////

///////////// [tfBounds] CLASS PROPERTIES ////////////////
//
// [Point3]	 min	= the minimum extents of the bounding box
// [Point3]	 max	= the maximum extents of the bounding box
//
///////////////////////////////////////////////////////

///////////// [tfMesh] CLASS PROPERTIES ////////////////
//
// [int]	 GetNumFaces()							= get number of mesh faces in tfObj 
// [int]	 GetNumVerts()							= get number of mesh vertices in tfObj 
// 
// [tfFace]	 GetFace(int inx)						= get face from index
// [Point3]	 GetVert(int inx)						= get vertex position from index
//
// [Point3]	 GetNormal(int vInx)					= get normal on mesh from vertex index
// [Point3]	 GetVel(int vInx)						= get velocity on mesh from vertex index
// [Point3]	 GetUVW(int vInx, int channel)			= get UVW on mesh from vertex index and map channel
//
// [Point3]	GetRandPointOnMesh(int seed)			= get random point on mesh using seed
// [tfFace]	GetRandFaceOnMesh(int seed)				= get random face on mesh using seed
// [int]	GetRandVertOnMesh(int seed)				= get random vertex on mesh using seed
//
// [tfBounds]	GetBounds()							= get the local bounds of the mesh
// [Point3]		GetPosOffset()						= get the local pivot position offset for the mesh
//
///////////////////////////////////////////////////////

///////////// [tfObj] CLASS PROPERTIES ////////////////
// 
// [tfMesh]  GetMesh()								= get the mesh of the tfObj
//
// [Matrix3] GetTM()								= get the world-space transform of the tfObj
// [Point3]  GetPos()								= get the world-space position of the tfObj
// [Quat]	 GetRot()								= get the world-space rotation (quaternion) of the tfObj
// [Point3]  GetScale()								= get the world-space scale of the tfObj
//
// [tfFace]	 GetClosestFace(Point3 p)				= get closest face on mesh from point (hybrid)
// [tfFace]	 GetClosestFaceAccurate(Point3 p)		= get closest face on mesh from point (accurate)
// [int]	 GetClosestVert(Point3 p)				= get closeset vertex index on mesh from point
//
// [Point3]	 GetClosestNormal(Point3 p)				= get closest normal on mesh from point
// [Point3]	 GetClosestPoint(Point3 p)				= get closest point on mesh from point (hybrid)
// [Point3]	 GetClosestPointAccurate(Point3 p)		= get closest point on mesh from point (accurate)
// [Point3]	 GetClosestUVW(Point3 p, int channel)	= get closest UVW coordinate on mesh from point and map channel
// [Point3]	 GetClosestVel(Point3 p)				= get closest velocity on mesh from point
// [Point3]	 GetClosestBary(Point3 p)				= get closest barycentric coordinate on mesh from point
//
// [RayHit]	GetRaycastHit(Point3 p, Point3 dir)		= cast a ray (from p along dir) towards mesh and return hit data
//
// [bool]	PointInside(Point3 p)					= tests if point is inside mesh 
// 
///////////////////////////////////////////////////////

///////////// [tfFace] CLASS PROPERTIES ///////////////
//
// [int]	inx					= get the index of the face on its mesh
//
// [int]	v1					= get vertex index 1 of the face
// [int]	v2					= get vertex index 2 of the face
// [int]	v3					= get vertex index 3 of the face
//
// [float]	area				= get the area of the face
// [Point3]	normal				= get the normal of the fac
// [int]	matID				= get the matID of the face
// [bool]	selected			= get the selection state of the face
//
/////////////////////////////////////////////////////// 

///////////// [tfBind] CLASS PROPERTIES ///////////////
//
// [int]	Type()				= get the type of bind (1 = stretch, 2 = shear, 3 = bend, 4 = volume)
//
// [int]	id					= get the ID of the binding
// [int]	sInx1				= get the simulation index of the first particle of the bind
// [int]	sInx2				= get the simulation index of the second particle of the bind
//
// [float]	length				= get the rest length of the binding
// [float]	OrigLength()		= get the original rest length of the binding
// [float]	CurrentLength()		= get the current length of the binding
//
// [float]	stiffness			= get the stiffness of the binding
// [float]	OrigStiffness()		= get the original stiffness of the binding
//
// [bool]	enableCollisions		= controls whether the bind will be processed by the CCCS
// [bool]	enableObjectCollisions	= controls whether the bind will collide with objects
// [float]	collisionThickness		= controls the bind's collision thickness
// [float]	collisionFriction		= controls the bind's collision friction
//
// [void]	Break()					= break the bind
// [void]	UnBreak()				= unbreak the bind
// [bool]	IsBroken()				= returns true if bind is currently broken 
//
///////////////////////////////////////////////////////

///////////// [RayHit] CLASS PROPERTIES ///////////////
//
// [bool]   hit					= true if hit valid
//
// [Point3] hitPoint			= get the hit point
// [int]	hitFace				= get the index of the hit face on the mesh
// [Point3]	hitBary				= get the barycentric coordinates of the hitPoint on the hitFace
//
///////////////////////////////////////////////////////

////////////// [Point2] CLASS PROPERTIES //////////////
//
// [float]	x			= get x value
// [float]	y			= get y value
//
///////////////////////////////////////////////////////

////////////// [Point3] CLASS PROPERTIES //////////////
//
// [float]	x					= get x value
// [float]	y					= get y value
// [float]	z					= get z value
//
// [Point3]	normalized			= get normalized vector
// [float]	magnitude			= get vector magnitude
// [float]	sqrMagnitude		= get squared vector magnitude
//
// [void]	Normalize()			= normalize the vector
// [void]	Scale(Point3 p)		= scale by vector
//
// [float]	Point3.Angle(Point3 p1, Point3 p2)				= get angle between vectors
// [Point3]	Point3.ClampMagnitude(Point3 p1, float length)	= clamp vector by maximum length
// [Point3] Point3.Cross(Point3 p1, Point3 p2)				= get cross product of vectors
// [float]	Point3.Distance(Point3 p1, Point3 p1)			= get distance between vectors
// [float]	Point3.Dot(Point3 p1, Point3 p2)				= get dot product of vectors
// [Point3]	Point3.Normalize(Point3 p1)						= get normalized vector
// [Point3]	Point3.ProjectOnPlane(Point3 p1, Point3 plane)	= project vector onto plane
// [Point3] Point3.Reflect(Point3 dir, Point3 plane)		= get reflected vector
//
///////////////////////////////////////////////////////

////////////// [Point4] CLASS PROPERTIES //////////////
//
// [float]	x			= get x value
// [float]	y			= get y value
// [float]	z			= get z value
// [float]	w			= get w value
//
///////////////////////////////////////////////////////

////////////// [Matrix3] CLASS PROPERTIES /////////////
//
// [Point3]	 row1		= get row1 (forward) of the matrix
// [Point3]	 row2		= get row2 (right) of the matrix
// [Point3]	 row3		= get row3 (up) of the matrix
// [Point3]	 row4		= get row4 (translation) of the matrix
//
// [Matrix3] inverted	= get the inverted matrix
//
// [void] PreRotate(int axis, float ang)			= pre-rotate the matrix along (0-based axis) by (ang) degrees
// [void] PostRotate(int axis, float ang)			= post-rotate the matrix along (0-based axis) by (ang) degrees
//
// [void]	 Invert()					= invert the matrix
// [Point3]  Transform(Point3 p)		= transform a point with the matrix 
// [Point3]  VectorTransform(Point3 p)	= transform a point with the matrix (without translation)
//
///////////////////////////////////////////////////////

////////////// [Quat] CLASS PROPERTIES /////////////
//
// [float]	 x		= get x value of the quaternion
// [float]	 y		= get y value of the quaternion
// [float]	 z		= get z value of the quaternion
// [float]	 w		= get w value of the quaternion
//
// [Quat] normalized	= get normalized quaternion
// [Quat] conjugated	= get the conjugated quaternion
// [Quat] inverted		= get the inverted quaternion
//
// [void] Conjugate()	= conjugate the quaternion
// [void] Invert()		= invert the quaternion
// [void] Normalize()	= normalize the quaternion
//
///////////////////////////////////////////////////////

////////////// [AngAxis] CLASS PROPERTIES /////////////
//
// [Point3]	 axis	= get the axis of the AngAxis
// [float]	 angle	= get the angle of the AngAxis
//
///////////////////////////////////////////////////////

//__END__

*/
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0