4419 lines
134 KiB
C
4419 lines
134 KiB
C
DEFINE_SCRIPT_REN(SCN_IKCompute, ComputeIK,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_INT(IKNumber) ,
|
|
"If available, compute IK in the scene. You can compute IK for several different render<br/> Indicate it in the [instance].<br/>",
|
|
{
|
|
ComputeSmallSceneIK(Smsc,IKNumber);
|
|
})
|
|
DEFINE_SCRIPT(TRK_StatusColorGet,
|
|
CATEGORY(Tracking) PARAM_INT_OPT(TrackeurID, 0),
|
|
"Get mesh status color",
|
|
{
|
|
int status;
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID= 0;
|
|
if (ID_TABLE[TrackeurID])
|
|
{
|
|
RETURN_COLOR(ID_TABLE[TrackeurID]->StatusMeshColor);
|
|
} else
|
|
{
|
|
RETURN_COLOR(0);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_ForceTracking,
|
|
CATEGORY(Media AVI) PARAM_INT_OPT(set, 1),
|
|
"Stock the Avi file into image file",
|
|
{
|
|
ForceTraking = set;
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_CameraGetFPS, CATEGORY(Tracking) ,"Get FPS of media tracking source",
|
|
{
|
|
RETURN_INT((u32)(1000.0 / (double)(trackMiliseconds_x_16>>8)));
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(TRK_IDScaleSet, IDSetScale,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum) PARAM_VECTOR(NewScale),
|
|
"Set the scale of the tracking mask",
|
|
{
|
|
ID_SetScale(IDNum , &NewScale);
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_IDAutodetectParamsSet, IDSetAutodetectParams,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum) PARAM_FLOAT(ZoomFactor) PARAM_FLOAT(VerticalFactor) PARAM_FLOAT(RotationAngle),
|
|
"Set better match auto-detect parrams",
|
|
{
|
|
Vector datas;
|
|
datas.x = ZoomFactor;
|
|
datas.y = VerticalFactor;
|
|
datas.z = RotationAngle;
|
|
ID_SetHaarParrams(IDNum , &datas);
|
|
})
|
|
DEFINE_SCRIPT(TRK_IDNew,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum),
|
|
"Create New ID",
|
|
{
|
|
ID_New(IDNum);
|
|
})
|
|
DEFINE_SCRIPT(CAMERA_SetRes,
|
|
CATEGORY(CAMERA) PARAM_INT_OPT(Witdh,320),
|
|
"Change default resolution of camera. Use this before create media camera. Default is 320",
|
|
{
|
|
if (Witdh < 320) Witdh = 320;
|
|
extern int CAMERA_SpecifyedW;
|
|
CAMERA_SpecifyedW = Witdh;
|
|
})
|
|
DEFINE_SCRIPT(CAMERA_List,
|
|
CATEGORY(CAMERA) PARAM_INT_OPT(refresh, 0),
|
|
"Get table of available camera<br/>Warning, if only one camera is avilable, return camera name (no table)",
|
|
{
|
|
extern char WebCamNames[64][256];
|
|
extern int NbWebCams;
|
|
if (refresh)
|
|
{
|
|
int GetWebCamNames(char compressors[][256], int *nbCompressors, int maxCompressors);
|
|
GetWebCamNames(WebCamNames, &NbWebCams, 64);
|
|
}
|
|
for (int camIdx=0; camIdx<NbWebCams; camIdx++)
|
|
{
|
|
RETURN_STRING(WebCamNames[camIdx]);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(CAMERA_Set,
|
|
CATEGORY(CAMERA) PARAM_STRING(camera),
|
|
"Set default camera<br/>if default camera changed, return true, else return false",
|
|
{
|
|
extern TCHAR CurrWebCam[256];
|
|
if (strcmp(camera, CurrWebCam))
|
|
{
|
|
strcpy(CurrWebCam, camera);
|
|
SetIniValue(CamcamCCM, "CurrWebCam", camera);
|
|
SaveIniFile(CamcamCCM);
|
|
|
|
u32 MediaIndex;
|
|
if (GetMediaFromString("CAM1", &MediaIndex))
|
|
{
|
|
int nbRef = 0;
|
|
for (;ID_MEDIA[MediaIndex];nbRef++)
|
|
DestroyMedia(MediaIndex);
|
|
for (int i=0; i<nbRef; i++)
|
|
CreateMedia("CAM1",0);
|
|
}
|
|
RETURN_BOOL(1);
|
|
} else
|
|
{
|
|
RETURN_BOOL(0);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(CAMERA_Get,
|
|
CATEGORY(CAMERA),
|
|
"Return current camera",
|
|
{
|
|
extern TCHAR CurrWebCam[256];
|
|
if (*CurrWebCam)
|
|
{ RETURN_STRING(CurrWebCam); }
|
|
})
|
|
DEFINE_SCRIPT(CAMERA_ProperyOpen,
|
|
CATEGORY(CAMERA) PARAM_STRING_OPT(camera, ""),
|
|
"Open property calmera page",
|
|
{
|
|
extern TCHAR CurrWebCam[256];
|
|
BOOL GetWebCamFilterPropertyByName(char *name, bool openPage);
|
|
if (*camera)
|
|
{
|
|
GetWebCamFilterPropertyByName(camera, true);
|
|
} else
|
|
{
|
|
GetWebCamFilterPropertyByName(CurrWebCam, true);
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_IDRemove,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum),
|
|
"Remove an ID from camcam (do not delete the file)",
|
|
{
|
|
/* TEST NOT HERE NORMALY */
|
|
if (ID_TABLE[IDNum])
|
|
{
|
|
ID_Destroy(IDNum);
|
|
}
|
|
})DEFINE_SCRIPT_REN(TRK_IDLoad, IDLoad,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum) PARAM_STRING(IDName),
|
|
"Load an ID",
|
|
{
|
|
char IDNameDir[2048];
|
|
if (IDName[0] && IDName[1] == ':')
|
|
{
|
|
sprintf(IDNameDir, "%s", IDName);
|
|
for (int i=0; IDNameDir[i] != '\0'; ++i)
|
|
if(IDNameDir[i] == '/')
|
|
IDNameDir[i] = '\\';
|
|
}
|
|
else sprintf(IDNameDir,".\\Ids\\%s",IDName);
|
|
ID_Load(IDNum,IDNameDir);
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_IDSave, IDSave,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum) PARAM_STRING(IDName),
|
|
"Save an ID",
|
|
{
|
|
char IDNameDir[2048];
|
|
if (IDName[0] && IDName[1] == ':')
|
|
{
|
|
sprintf(IDNameDir, "%s", IDName);
|
|
for (int i=0; IDNameDir[i] != '\0'; ++i)
|
|
if(IDNameDir[i] == '/')
|
|
IDNameDir[i] = '\\';
|
|
}
|
|
else sprintf(IDNameDir,".\\Ids\\%s",IDName);
|
|
ID_Save(IDNum,IDNameDir);
|
|
})
|
|
DEFINE_SCRIPT(TRK_IDDel,
|
|
CATEGORY(Tracking) PARAM_STRING(IDName),
|
|
"Del an ID",
|
|
{
|
|
char IDNameDir[2048];
|
|
if (IDName[0] && IDName[1] == ':')
|
|
{
|
|
sprintf(IDNameDir, "%s", IDName);
|
|
for (int i=0; IDNameDir[i] != '\0'; ++i)
|
|
if(IDNameDir[i] == '/')
|
|
IDNameDir[i] = '\\';
|
|
}
|
|
else sprintf(IDNameDir,".\\Ids\\%s",IDName);
|
|
DeleteFile(IDNameDir);
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_IDCurrentGet, IDGetCurrent,
|
|
CATEGORY(Tracking),
|
|
"Return the current ID used",
|
|
{
|
|
RETURN_INT( CurrentID);
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_IDCurrentSet, IDSetCurrent,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum),
|
|
"Set the current ID<br/>The function returns the true new ID",
|
|
{
|
|
if (IDNum < NumberOfID)
|
|
{
|
|
CurrentID = IDNum;
|
|
} else
|
|
{
|
|
CurrentID = ID_New();
|
|
}
|
|
RETURN_INT( CurrentID);
|
|
})
|
|
DEFINE_SCRIPT(TRK_IDMeshLoad,
|
|
CATEGORY(Tracking) PARAM_INT(IDNum) PARAM_STRING(MeshName),
|
|
"Load an mesh object for ID",
|
|
{
|
|
FILE *F;
|
|
char path[2048];
|
|
|
|
if (IDNum >= NumberOfID)
|
|
{
|
|
ID_New(IDNum);
|
|
}
|
|
|
|
sprintf(path, ".\\%s", MeshName);
|
|
F = fopen(path,"rt");
|
|
if (!F)
|
|
{
|
|
sprintf(path, ".\\%s.obj", MeshName);
|
|
F = fopen(path,"rt");
|
|
}
|
|
if (F)
|
|
{
|
|
extern u32 LoadObj(Mesh *LoadMesh,FILE *F);
|
|
if (VALIDATE_ID(IDNum))
|
|
{
|
|
Mesh MyMesh;
|
|
LoadObj(&MyMesh,F);
|
|
MyMesh.ulNumberOfSubObjects = 1;
|
|
MyMesh.FaceSubObjectIndexes[0] = MyMesh.NumberOfFaces;
|
|
MyMesh.FaceSubObjectIndexes[1] = 0;
|
|
MyMesh.BVIfy();
|
|
ID_SetMesh(IDNum, &MyMesh);
|
|
//ID_TABLE[IDNum]->p_UsedMesh = CopyMesh(&MyMesh);
|
|
//LoadObj(ID_TABLE[IDNum]->p_UsedMesh, F);
|
|
} else
|
|
fclose(F);
|
|
}
|
|
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(SCN_CameraCopy, CopyCamera,
|
|
CATEGORY(Small Scene) PARAM_SCENE(DestSmsc) PARAM_SCENE(SourceSmsc),
|
|
"copy camera(CP) from SOURCE to DEST",
|
|
{
|
|
DestSmsc->CameraPosition = SourceSmsc->CameraPosition;
|
|
})
|
|
#ifndef SKIMMED_NET
|
|
DEFINE_SCRIPT_REN(NET_PortSet, SetNetPort,
|
|
CATEGORY(Network) PARAM_INT(Port),
|
|
"return 0 if can't open port",
|
|
{
|
|
RETURN_INT( NetObj->SetNetPort(Port));
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT_REN(DRW_Text, DrawText,
|
|
CATEGORY(Drawing) PARAM_INT(X) PARAM_INT(Y) PARAM_COLOR(color) PARAM_STRING(StringToWrite),
|
|
"draw the text in current viewport",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
color = ARGB2ABGR(color);
|
|
DI->DrawText((unsigned char *)StringToWrite,(float)X,(float)Y,1.0f,1.0f, color);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(DRW_TextCenter, DrawTextCenter,
|
|
CATEGORY(Drawing) PARAM_COLOR(color) PARAM_STRING(StringToWrite),
|
|
"draw the text in current viewport",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
color = ARGB2ABGR(color);
|
|
DI->DrawTextCentered((unsigned char *)StringToWrite, color);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(DRW_FontText, RenderText,
|
|
CATEGORY(Drawing) PARAM_INT(X) PARAM_INT(Y) PARAM_COLOR(color) PARAM_STRING(FontName) PARAM_STRING(StringToWrite) PARAM_INT_OPT(BlendingMode, -1) PARAM_FLOAT_OPT(scale, 1.0),
|
|
"draw the text in current viewport with specified font<br/>Font is a media specified by [FontName Size Mode FONT]<br/>Mode is a mix of the options:<br/>B: Bold - I: Italic - U: Underline<br/>A: Antialiased - C: Contour - T: Transparency ",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
color = ARGB2ABGR(color);
|
|
RenderText((unsigned char *)StringToWrite,(float)X,(float)Y,scale,scale, color, FontName, BlendingMode);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(DRW_Line,
|
|
CATEGORY(Drawing) PARAM_INT(X1) PARAM_INT(Y1) PARAM_INT(X2) PARAM_INT(Y2) PARAM_COLOR(color) PARAM_INT_OPT(Lenght, 0),
|
|
"Draw a line between (X1,Y1) and (X2,Y2)",
|
|
{
|
|
Vector A(X1,Y1,0);
|
|
Vector B(X2,Y2,0);
|
|
|
|
color = ARGB2ABGR(color);
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->Draw2DLine(color, &A, &B, Lenght);
|
|
})
|
|
DEFINE_SCRIPT(DRW_Line3D,
|
|
CATEGORY(Drawing) PARAM_SCENE(SmSc) PARAM_VECTOR(P1) PARAM_VECTOR(P2) PARAM_COLOR(color) PARAM_INT_OPT(Lenght, 0) PARAM_INT_OPT(ZTest, 1),
|
|
"Draw a line between P1 and P2 in scene world",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
float Current_focale;
|
|
if (SmSc->fFocalToUseForNextRender == 0)
|
|
Current_focale = GetCurrentFocale();
|
|
else
|
|
Current_focale = SmSc->fFocalToUseForNextRender;
|
|
|
|
if (SmSc->HoloGraphicWindowWidth)
|
|
DI->Holographic(&SmSc->HoloGraphicVector,SmSc->HoloGraphicWindowWidth);
|
|
else
|
|
DI->Perspective(Current_focale);
|
|
|
|
MATRIX CP;
|
|
MATRIX MatrixToSet;
|
|
MATRIX WM;
|
|
RS LineRS;
|
|
|
|
GLOB_SetDefaultRS(&LineRS);
|
|
if (!ZTest)
|
|
LineRS.NOZTEST = 1;
|
|
|
|
LineRS.BlendingMode = 1;
|
|
DI->SetRS(&LineRS, -1);
|
|
|
|
CP = SmSc->CameraPosition;
|
|
CP.K *= -1.0f;
|
|
CP.Inverse(MatrixToSet);
|
|
|
|
WM = SmSc->RootMatrix;
|
|
WM *= MatrixToSet;
|
|
DI->Matrix(&WM);
|
|
|
|
color = ARGB2ABGR(color);
|
|
DI->DrawLine(color, &P1, &P2, Lenght);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(DRW_Triangle,
|
|
CATEGORY(Drawing) PARAM_VECTOR(P1) PARAM_VECTOR(P2) PARAM_VECTOR(P3) PARAM_VECTOR_OPT(UV1, Vector(0,0,0)) PARAM_VECTOR_OPT(UV2, Vector(1,0,0)) PARAM_VECTOR_OPT(UV3, Vector(1,1,0)) PARAM_MEDIA(Mi) PARAM_INT_OPT(BlendMode,0),
|
|
"Draw triangle with the specified uv",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
RenderTriangle(NULL, Mi, &P1,&P2,&P3,&UV1,&UV2,&UV3, BlendMode);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(DRW_Triangle3D,
|
|
CATEGORY(Drawing) PARAM_SCENE(SmSc) PARAM_VECTOR(P1) PARAM_VECTOR(P2) PARAM_VECTOR(P3) PARAM_VECTOR_OPT(UV1, Vector(0,0,0)) PARAM_VECTOR_OPT(UV2, Vector(1,0,0)) PARAM_VECTOR_OPT(UV3, Vector(1,1,0)) PARAM_MEDIA(Mi) PARAM_INT_OPT(BlendMode,0),
|
|
"Draw triangle with the specified uv",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
RenderTriangle(SmSc, Mi, &P1,&P2,&P3,&UV1,&UV2,&UV3, BlendMode);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_Load, LoadSmSc,
|
|
CATEGORY(Small Scene) PARAM_STRING(SceneName),
|
|
"load 3D",
|
|
{
|
|
UnicID SmScID = SmallSceneDico.IsExist(SceneName);
|
|
if (SmScID == -1)
|
|
{
|
|
if (LoadSmSc(SceneName) == -1)
|
|
{
|
|
//sprintf(LuaErrors, "Scene %s not Found", SceneName);
|
|
RETURN_BOOL(0);
|
|
} else
|
|
{
|
|
RETURN_BOOL(1);
|
|
}
|
|
} else
|
|
{
|
|
// Recreate Media if (virtualy destroyed)
|
|
SmallScene *SmSc;
|
|
SmSc = pSmallScenes[SmallSceneDico.mpst_Dico[SmScID].AssociatedValue];
|
|
ReLoadSmSc(SmSc);
|
|
RETURN_BOOL(1);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_Delete,
|
|
CATEGORY(Small Scene) PARAM_STRING(SceneName),
|
|
"delete 3D",
|
|
{
|
|
DeleteSmSc(SceneName);
|
|
})
|
|
DEFINE_SCRIPT(SCN_LinkObjectToVertex,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_INT(index) PARAM_STRING(DummyObject) PARAM_STRING(SceneObject) PARAM_INT_OPT(Force, 0),
|
|
"Affect Dummy object to vertex in Scene Object",
|
|
{
|
|
RETURN_BOOL(AffectObjectToVertex(Smsc, index, DummyObject, SceneObject, Force));
|
|
})
|
|
DEFINE_SCRIPT(SCN_LinkObjectSnap,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(DummySnapSrc) PARAM_STRING(DummySnapDst),
|
|
"Link snap dummy to dummy",
|
|
{
|
|
RETURN_BOOL(ObjectLinkSnap(Smsc, DummySnapSrc, DummySnapDst));
|
|
})
|
|
DEFINE_SCRIPT(SCN_LinkObjectScale,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING(DummySnapSrc1) PARAM_STRING(DummySrc2) PARAM_STRING(DummySnapDst1) PARAM_STRING(DummyDst2) PARAM_INT(axe) PARAM_INT_OPT(mode, 0),
|
|
"link snap dummy to dummy adding scale factor <br/> Scale depends on used axes",
|
|
{
|
|
RETURN_BOOL(ObjectLinkScale(Smsc, DummySnapSrc1, DummySrc2, DummySnapDst1, DummyDst2, axe, mode));
|
|
})
|
|
DEFINE_SCRIPT(SCN_LinkScaleVectorGet,
|
|
CATEGORY(Small Scene) PARAM_MATRIX(SrcMatrix) PARAM_VECTOR(SrcDummy) PARAM_MATRIX(DstMatrix) PARAM_VECTOR(DstDummy) PARAM_INT(axe) PARAM_INT_OPT(mode, 0),
|
|
"link snap dummy to dummy adding scale factor <br/> Scale depends on used axes",
|
|
{
|
|
Vector scaleVect = GetScaleVector(&SrcMatrix, &SrcDummy, &DstMatrix, &DstDummy, axe, mode);
|
|
RETURN_VECTOR(&scaleVect);
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(SCN_Render, Render,
|
|
CATEGORY(Small Scene) PARAM_STRING(SmallSceneName),
|
|
"Render smallscene",
|
|
{
|
|
START_RASTER(Rendering);
|
|
if (!(SkipFunctions & SKIP_RENDER))
|
|
{ RETURN_BOOL(RenderSmallScene(SmallSceneName)); }
|
|
else
|
|
{ RETURN_BOOL(true); }
|
|
STOP_RASTER(Rendering);
|
|
})
|
|
DEFINE_SCRIPT(SCN_RenderIK,
|
|
CATEGORY(Small Scene) PARAM_SCENE(SmallScene),
|
|
"Render smallscene",
|
|
{
|
|
START_RASTER(Rendering);
|
|
if (!(SkipFunctions & SKIP_RENDER))
|
|
DrawSmallSceneIK(SmallScene);
|
|
STOP_RASTER(Rendering);
|
|
})
|
|
DEFINE_SCRIPT(SCN_ReverseRender,
|
|
CATEGORY(Small Scene) PARAM_STRING(SmallSceneName) PARAM_FLOAT_OPT(ComputeAlpha,0.0),
|
|
"Reverse Render smallscene, ComputeAlpha mean compute alpha according to normale incidence to camera. 0 Will comupte alpha = 1",
|
|
{
|
|
START_RASTER(Rendering);
|
|
if (!(SkipFunctions & SKIP_RENDER))
|
|
{
|
|
DI->ComputeMaskAlpha = ComputeAlpha;
|
|
ReverseRenderSmallScene(SmallSceneName);
|
|
DI->ComputeMaskAlpha = 0.0;
|
|
}
|
|
STOP_RASTER(Rendering);
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_MatrixReset, ResetMatrix,
|
|
CATEGORY(Small Scene) PARAM_AFFECT(Affect) PARAM_SCENE(Smsc),
|
|
"[.T] = Translation<br/> [.R] = Rotation<br/> [.TR] or nothing = Rotation + translation<br/>restor small scene initial position",
|
|
{
|
|
if (Affect & 1)
|
|
{
|
|
Smsc->RootMatrix.T = Vector(0,0,0);
|
|
}
|
|
if (Affect & 2)
|
|
{
|
|
Smsc->RootMatrix.I = Vector(1,0,0);
|
|
Smsc->RootMatrix.J = Vector(0,1,0);
|
|
Smsc->RootMatrix.K = Vector(0,0,1);
|
|
}
|
|
ComputeSmallSceneHierarchie(Smsc);
|
|
|
|
})
|
|
DEFINE_SCRIPT(SCN_RootMatrixGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc),
|
|
"Get Root Matrix",
|
|
{
|
|
RETURN_MATRIX(&Smsc->RootMatrix);
|
|
})
|
|
DEFINE_SCRIPT(SCN_RootMatrixSet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_MATRIX(Mat),
|
|
"Set Root Matrix",
|
|
{
|
|
Smsc->RootMatrix = Mat;
|
|
ComputeSmallSceneHierarchie(Smsc);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_MatrixSet,
|
|
CATEGORY(Small Scene) PARAM_AFFECT(Affect) PARAM_SCENE(SmSc) PARAM_MATRIX(matrix) PARAM_FLOAT_OPT(Focale, 0),
|
|
"Affect a track matrix to a scene <br/>[.TR] mean:<br/> [.T] = Translation<br/> [.R] = Rotation<br/> [.S] = Mask scale<br/> [.TR] or nothing = Rotation + translation",
|
|
{
|
|
Vector matrixScale;
|
|
matrixScale.x = matrix.I.Norm(); matrix.I.Normalize();
|
|
matrixScale.z = matrix.J.Norm(); matrix.J.Normalize();
|
|
matrixScale.y = matrix.K.Norm(); matrix.K.Normalize();
|
|
|
|
AffectTrackMatrixToSmallScene(0, SmSc,Affect,&matrix);
|
|
if (Affect & 256)
|
|
{
|
|
AffectTrackScaleToSmallScene(SmSc,&matrixScale);
|
|
}
|
|
|
|
if (Focale == 0)
|
|
SmSc->fFocalToUseForNextRender = ID_MEDIA[MediaToTrack]->MediaFocale;//*/
|
|
else
|
|
SmSc->fFocalToUseForNextRender = Focale;
|
|
})
|
|
DEFINE_SCRIPT(SNC_SubMatrixSet,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_SCENE(SmSc) PARAM_STRING(ObjectName) PARAM_MATRIX(matrix) PARAM_INT_OPT(AxeModifier, 0),
|
|
"Affect trackeur matrix to an object of a small scene<br/>[.TR] mean:<br/> [.T] = Translation<br/> [.R] = Rotation<br/> [.S] = Mask scale<br/> [Index] object number - Warning begin at 1 !!<br/> [.TR] or nothing = Rotation + translation",
|
|
{
|
|
AffectTrackSubMatrixToSmallScene(0, SmSc,ObjectName,Affect,&matrix, AxeModifier);
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_MediaMatrixSet, MediaSetMatrix,
|
|
CATEGORY(Small Scene) PARAM_SCENE(SmSc) PARAM_MEDIA(Mi) PARAM_INT(TrackNum) PARAM_INT_OPT(maxStatus, 0) PARAM_INT_OPT(useTimeLineCorrection, 0),
|
|
"Medianame is used for finding current frame number<br/>Max Status sets allowed track status",
|
|
{
|
|
RETURN_INT(MediaSetMatrix(SmSc,Mi,TrackNum, maxStatus, useTimeLineCorrection));
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_MatrixSet, SetTrackMatrix,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_INT(TrackeurID) PARAM_SCENE(SmSc) PARAM_INT_OPT(SmoothModeNumber, 0),
|
|
"Affect trackeur matrix to a small scene<br/>[.TR] mean:<br/> [.T] = Translation<br/> [.R] = Rotation<br/> [.S] = Mask scale<br/> [.TR] or nothing = Rotation + translation",
|
|
{
|
|
MATRIX smoothMatrix;
|
|
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID = 0;
|
|
if (ID_TABLE[TrackeurID])
|
|
{
|
|
smoothMatrix = ID_TABLE[TrackeurID]->CurrentMatrix_U;
|
|
AffectTrackMatrixToSmallScene(SmoothModeNumber, SmSc,Affect,&smoothMatrix);
|
|
if (Affect & 256)
|
|
AffectTrackScaleToSmallScene(SmSc,&ID_TABLE[TrackeurID]->vModelScale);
|
|
|
|
if (ID_TABLE[TrackeurID]->SF_U.IsAnimatedTrack && (ID_TABLE[TrackeurID]->AnimatedMedia != -1))
|
|
SmSc->fFocalToUseForNextRender = ID_MEDIA[ID_TABLE[TrackeurID]->AnimatedMedia]->MediaFocale;
|
|
else
|
|
SmSc->fFocalToUseForNextRender = ID_MEDIA[MediaToTrack]->MediaFocale;//*/
|
|
};
|
|
})
|
|
DEFINE_SCRIPT(TRK_SubMatrixSet,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_INT(TrackeurID) PARAM_SCENE(SmSc) PARAM_STRING(ObjectName) PARAM_INT_OPT(AxeModifier, 0) PARAM_INT_OPT(SmoothModeNumber, 0),
|
|
"Affect trackeur matrix to an object of a small scene<br/>[.TR] mean:<br/> [.T] = Translation<br/> [.R] = Rotation<br/> [.S] = Mask scale<br/> [Index] object number - Warning begin at 1 !!<br/> [.TR] or nothing = Rotation + translation",
|
|
{
|
|
MATRIX smoothMatrix;
|
|
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID = 0;
|
|
if (ID_TABLE[TrackeurID])
|
|
{
|
|
smoothMatrix = ID_TABLE[TrackeurID]->CurrentMatrix_U;
|
|
AffectTrackSubMatrixToSmallScene(SmoothModeNumber, SmSc,ObjectName,Affect,&smoothMatrix, AxeModifier);
|
|
|
|
if (ID_TABLE[TrackeurID]->SF_U.IsAnimatedTrack && (ID_TABLE[TrackeurID]->AnimatedMedia != -1))
|
|
SmSc->fFocalToUseForNextRender = ID_MEDIA[ID_TABLE[TrackeurID]->AnimatedMedia]->MediaFocale;
|
|
else
|
|
SmSc->fFocalToUseForNextRender = ID_MEDIA[MediaToTrack]->MediaFocale;//*/
|
|
};
|
|
})
|
|
DEFINE_SCRIPT(TRK_MatrixChange,
|
|
CATEGORY(Tracking) PARAM_INT(TrackeurID) PARAM_MATRIX(matrix),
|
|
"Set the tracker matrix<br/>[.TR] mean:<br/> [.T] = Translation<br/> [.R] = Rotation<br/> [.S] = Mask scale<br/> [.TR] or nothing = Rotation + translation",
|
|
{
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID = 0;
|
|
if (ID_TABLE[TrackeurID])
|
|
{
|
|
Vector matrixScale;
|
|
matrixScale.x = matrix.I.Norm(); matrix.I.Normalize();
|
|
matrixScale.z = matrix.J.Norm(); matrix.J.Normalize();
|
|
matrixScale.y = matrix.K.Norm(); matrix.K.Normalize();
|
|
|
|
ID_TABLE[TrackeurID]->CurrentMatrix_U = matrix;
|
|
ID_SetScale(TrackeurID,&matrixScale);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_MatrixGet, GetTrackMatrix,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_INT(TrackeurID) PARAM_INT_OPT(SmoothNumber, 0) PARAM_INT_OPT(AxeInversion, 0) ,
|
|
"return trackeur matrix<br/>[.TR] mean:<br/> [.T] = Translation<br/> [.R] = Rotation<br/> [.TR] or nothing = Rotation + translation",
|
|
{
|
|
MATRIX smoothMatrix;
|
|
Vector scaleVector;
|
|
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID = 0;
|
|
if (ID_TABLE[TrackeurID])
|
|
{
|
|
smoothMatrix = ID_TABLE[TrackeurID]->CurrentMatrix_U;
|
|
SetSmoothMatrix(SmoothNumber, &smoothMatrix, Affect, AxeInversion);
|
|
if (Affect & 256)
|
|
{
|
|
smoothMatrix.I *= ID_TABLE[TrackeurID]->vModelScale.x;
|
|
smoothMatrix.J *= ID_TABLE[TrackeurID]->vModelScale.z;
|
|
smoothMatrix.K *= ID_TABLE[TrackeurID]->vModelScale.y;
|
|
}
|
|
switch (Affect)
|
|
{
|
|
case 1: RETURN_VECTOR(&smoothMatrix.T);break;
|
|
case 4: RETURN_VECTOR(&smoothMatrix.I);break;
|
|
case 8: RETURN_VECTOR(&smoothMatrix.J);break;
|
|
case 16: RETURN_VECTOR(&smoothMatrix.K);break;
|
|
case 256: RETURN_VECTOR(&ID_TABLE[TrackeurID]->vModelScale);break;
|
|
case 258:
|
|
case 2: memset(&smoothMatrix.T, 0, sizeof(smoothMatrix.T));
|
|
case 0:
|
|
case 259:
|
|
case 3: RETURN_MATRIX(&smoothMatrix);break;
|
|
case 257: {
|
|
MATRIX ts;
|
|
ts.I *= ID_TABLE[TrackeurID]->vModelScale.x;
|
|
ts.J *= ID_TABLE[TrackeurID]->vModelScale.y;
|
|
ts.K *= ID_TABLE[TrackeurID]->vModelScale.z;
|
|
ts.T = smoothMatrix.T;
|
|
RETURN_MATRIX(&ts);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_BOOT,
|
|
CATEGORY(Tracking) PARAM_INT(TrackeurID) PARAM_INT(ON_OFF),
|
|
"Use for script Manual Boot, 1-> Begin, 0->End",
|
|
{
|
|
if (ON_OFF)
|
|
{
|
|
ID_Reset(TrackeurID);
|
|
ID_TABLE[TrackeurID]->SF_U.CamPlaced = 0;
|
|
ID_TABLE[TrackeurID]->CurrentMatrix_U.T.z = 90.0f;
|
|
ID_TABLE[TrackeurID]->SF_U.FromScratch = 0;
|
|
} else
|
|
{
|
|
ID_TABLE[TrackeurID]->SF_U.Booted = 1;
|
|
ID_TABLE[TrackeurID]->SF_U.Ready2Learn = 1;
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_IDCreateFromMedia, CreateIDFromMedia,
|
|
CATEGORY(Tracking) PARAM_INT(ID) PARAM_INT(TrackNum) PARAM_MEDIA(Mi),
|
|
"Affect an animated matrix from a media to a new ID",
|
|
{
|
|
if (ID != 0)
|
|
{
|
|
ID_NewAnimated(ID,Mi,TrackNum);
|
|
Vector Scale;
|
|
Scale = Vector(1,1,1);
|
|
if (ID_MEDIA[Mi]->Tracks) ID_MEDIA[Mi]->Tracks->GetScale(TrackNum,&Scale);
|
|
ID_SetScale(ID,&Scale);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(DRW_Quad, DRW_QuadBlend,
|
|
CATEGORY(Drawing) PARAM_INT(X) PARAM_INT(Y) PARAM_INT(SizeX) PARAM_INT(SizeY) PARAM_MEDIA(Mi) PARAM_INT_OPT(BlendMode,0) ,
|
|
"!Medianame must be inside '<' and '>'<br/>BLENDING MODES: 0=COPY;1=ALPHA;2=ADD;3=ALPHA PREMULT;4=PREVIOUS ALPHA;5=Multiply",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
RS LocalRS;
|
|
GLOB_SetDefaultRS(&LocalRS);
|
|
LocalRS.BlendingMode = BlendMode;
|
|
LocalRS.BACKFACE = 0;
|
|
DI->DrawQuad(ID_MEDIA[Mi]->ulAssociatedTextureIndex,X,X+SizeX,Y,Y+SizeY,&LocalRS);
|
|
}
|
|
|
|
})
|
|
DEFINE_SCRIPT(DRW_QuadDistord,
|
|
CATEGORY(Drawing) PARAM_INT(X) PARAM_INT(Y) PARAM_INT(SizeX) PARAM_INT(SizeY) PARAM_MEDIA(Mi) PARAM_INT_OPT(Blend,0),
|
|
"!Medianame must be inside '<' and '>' ; Same as DrawQuad, but no ratio correction. Optional parram specify blendingmode",
|
|
{
|
|
RS LocalRS;
|
|
GLOB_SetDefaultRS(&LocalRS);
|
|
LocalRS.BlendingMode = Blend;
|
|
LocalRS.BACKFACE = 0;
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->DrawQuadDistord(ID_MEDIA[Mi]->ulAssociatedTextureIndex,X,X+SizeX,Y,Y+SizeY,&LocalRS);
|
|
})
|
|
DEFINE_SCRIPT(DRW_Circle,
|
|
CATEGORY(Drawing) PARAM_FLOAT(X) PARAM_FLOAT(Y) PARAM_FLOAT(InnerRadius) PARAM_FLOAT(OuterRadius) PARAM_FLOAT(ClockDegreeStart) PARAM_FLOAT(ClockDegreeEnd) PARAM_MEDIA(Mi) PARAM_INT_OPT(Blend,0),
|
|
"Same as DrawQuadDistord, Read carefully the parrameters",
|
|
{
|
|
RS LocalRS;
|
|
GLOB_SetDefaultRS(&LocalRS);
|
|
LocalRS.BlendingMode = Blend;
|
|
LocalRS.BACKFACE = 0;
|
|
Vector Center = Vector(X,Y,0);
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->DrawCircle(ID_MEDIA[Mi]->ulAssociatedTextureIndex,&Center,InnerRadius,OuterRadius,ClockDegreeStart,ClockDegreeEnd,&LocalRS);
|
|
})
|
|
|
|
DEFINE_SCRIPT(DRW_Patch32,
|
|
CATEGORY(Drawing) PARAM_LIST_VECTOR(pCurves) PARAM_LIST_INT(pColors) PARAM_INT(NumberOfCurves) PARAM_MEDIA(Mi) PARAM_INT_OPT(drawHalf, 0) PARAM_INT_OPT(Blend,0) PARAM_INT_OPT(HDIV, 0) PARAM_INT_OPT(VDIV, 0),
|
|
"Same as DrawCircle, See phiippe V for more info",
|
|
{
|
|
RS LocalRS;
|
|
Color4 colors[8];
|
|
GLOB_SetDefaultRS(&LocalRS);
|
|
LocalRS.BlendingMode = Blend;
|
|
LocalRS.USEVERTEXCOLORS = NbpColors > 0;
|
|
for (int i=0; i<8; i++)
|
|
{
|
|
colors[i] = Color4(pColors[i]);
|
|
}
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->DrawPatch32(ID_MEDIA[Mi]->ulAssociatedTextureIndex,pCurves,colors,drawHalf,NumberOfCurves, HDIV, VDIV, &LocalRS);
|
|
})
|
|
|
|
DEFINE_SCRIPT(DRW_Patch32Normals,
|
|
CATEGORY(Drawing) PARAM_LIST_VECTOR(pCurves) PARAM_LIST_COLOR(pColors) PARAM_INT(NumberOfCurves) PARAM_MEDIA(Mi) PARAM_INT_OPT(drawHalf, 0) PARAM_INT_OPT(Blend,0) PARAM_INT_OPT(HDIV, 0) PARAM_INT_OPT(VDIV, 0) PARAM_INT_OPT(InvertInter, 0),
|
|
"Same as DRW_Patch32, but points 4-7 and 12-15 are normals",
|
|
{
|
|
RS LocalRS;
|
|
GLOB_SetDefaultRS(&LocalRS);
|
|
Color4 color[8];
|
|
LocalRS.BlendingMode = Blend;
|
|
LocalRS.USEVERTEXCOLORS = NbpColors > 0;
|
|
PatchPointsToNormals(pCurves, color, pColors, InvertInter);
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->DrawPatch32(ID_MEDIA[Mi]->ulAssociatedTextureIndex,pCurves,color,drawHalf,NumberOfCurves,HDIV, VDIV,&LocalRS);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PATCH32_XYZFromUV,
|
|
CATEGORY(PATCH32) PARAM_LIST_VECTOR(pCurves) PARAM_VECTOR(UV),
|
|
"get coord from UV",
|
|
{
|
|
Vector V = PatchGetXYZFromUV(pCurves, UV);
|
|
RETURN_VECTOR(&V);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PATCH32_XYZFromUVNormals,
|
|
CATEGORY(PATCH32) PARAM_LIST_VECTOR(pCurves) PARAM_VECTOR(UV) PARAM_INT_OPT(InvertInter, 0),
|
|
"get coord from UV",
|
|
{
|
|
PatchPointsToNormals(pCurves, NULL, NULL, InvertInter);
|
|
Vector V = PatchGetXYZFromUV(pCurves, UV);
|
|
RETURN_VECTOR(&V);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PATCH32_UVFromXYZ,
|
|
CATEGORY(PATCH32) PARAM_LIST_VECTOR(pCurves) PARAM_VECTOR(Point) PARAM_VECTOR_OPT(vMin, Vector()) PARAM_VECTOR_OPT(vMax, Vector(1,1,1)),
|
|
"get UV from coord",
|
|
{
|
|
Vector V = PatchGetUVFromXYZ(pCurves, Point, vMin, vMax);
|
|
RETURN_VECTOR(&V);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PATCH32_UVFromXYZNormals,
|
|
CATEGORY(PATCH32) PARAM_LIST_VECTOR(pCurves) PARAM_VECTOR(Point) PARAM_VECTOR_OPT(vMin, Vector()) PARAM_VECTOR_OPT(vMax, Vector(1,1,1)) PARAM_INT_OPT(InvertInter, 0),
|
|
"get UV from coord",
|
|
{
|
|
PatchPointsToNormals(pCurves, NULL, NULL, InvertInter);
|
|
Vector V = PatchGetUVFromXYZ(pCurves, Point, vMin, vMax);
|
|
RETURN_VECTOR(&V);
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(DRW_Clear, Clear,
|
|
CATEGORY(Drawing) PARAM_COLOR_OPT(color, 0),
|
|
"Clear the current viewport",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
color = ARGB2ABGR(color);
|
|
DI->Clear(color);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(DRW_ClearZ, ClearZ,
|
|
CATEGORY(Drawing) ,
|
|
"Clear ZBuffer in the current viewport",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->ClearZ();
|
|
})
|
|
DEFINE_SCRIPT_REN(DRW_BackgroundSet, SetBackGround,
|
|
CATEGORY(Drawing) PARAM_MEDIA(Mi) PARAM_INT_OPT(Blendmode,0),
|
|
"Set the media as background in current viewport. You can specify blend mode",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
DI->SetBackGround(ID_MEDIA[Mi]->ulAssociatedTextureIndex,(u32)Blendmode);
|
|
})
|
|
DEFINE_SCRIPT_REN(DRW_RenderColorSet, SetRenderColor,
|
|
CATEGORY(Drawing) PARAM_COLOR_OPT(color, 0),
|
|
"BLACK -> All is black<br/>WHITE -> All is normal<br/>Default is 255 255 255 255 (white)",
|
|
{
|
|
color = ARGB2ABGR(color);
|
|
DI->SetCurrentColor(color);
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_MediaSet, SetMediaToTrack,
|
|
CATEGORY(Tracking) PARAM_MEDIA(Mi),
|
|
"define the media where tracker is running",
|
|
{
|
|
MediaToTrack = Mi;
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_Reset, ResetT,
|
|
CATEGORY(Tracking) PARAM_INT_OPT(TrackID, -1),
|
|
"reset current tracker",
|
|
{
|
|
if (TrackID == -1) TrackID = CurrentID;
|
|
if (ID_TABLE[TrackID])
|
|
{
|
|
ID_Reset(TrackID);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_AutoBootStart,
|
|
CATEGORY(Tracking) PARAM_INT_OPT(TrackID, -1),
|
|
"reset current tracker",
|
|
{
|
|
if (TrackID == -1) TrackID = CurrentID;
|
|
if (ID_TABLE[TrackID])
|
|
{
|
|
ID_Reset(TrackID);
|
|
ID_AutoStart(TrackID);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_AutoBootStop,
|
|
CATEGORY(Tracking) PARAM_INT_OPT(ForceReset, 0) PARAM_INT_OPT(TrackID, -1),
|
|
"reset current tracker",
|
|
{
|
|
if (TrackID == -1) TrackID = CurrentID;
|
|
if (ID_TABLE[TrackID])
|
|
{
|
|
if (ForceReset)
|
|
ID_Reset(TrackID);
|
|
ID_TABLE[TrackID]->SF_U.ViolaStart = 0;
|
|
ID_TABLE[TrackID]->SF_U.Booted = 1;
|
|
ID_TABLE[TrackID]->SF_U.Ready2Learn = 1;
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(TRK_Save, SaveTrack,
|
|
CATEGORY(Tracking) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"<br/>Save track to file",
|
|
{
|
|
s32 TrackIndex;
|
|
s32 force = 0;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]) &&
|
|
ID_MEDIA[TrackedMedia]->Tracks != NULL)
|
|
{
|
|
char TrackName[2048];
|
|
strcpy(TrackName,(char*)ID_MEDIA[TrackedMedia]->MediaName);
|
|
SetFileNameExtend(TrackName,'.TRK');
|
|
SaveTrackPlayer(ID_MEDIA[TrackedMedia]->Tracks,TrackName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_CurrentSet, SetCurrentTrack,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex),
|
|
"Set current Track",
|
|
{
|
|
MediaCurrentTrack = TrackIndex;
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_PosGet,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_INT(TrackIndex) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(AxeInversion, 0) PARAM_INT_OPT(TimeLineCorrection, 0),
|
|
"Get the position matrix of the current tracked media previously set",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]) && ID_MEDIA[TrackedMedia]->Tracks &&
|
|
TrackIndex < ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks &&
|
|
ID_MEDIA[TrackedMedia]->ulCurrentFrame < ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].ulNumberOfMC)
|
|
{
|
|
MATRIX matrix;
|
|
Vector matrixScale;
|
|
int currFrame = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
|
|
if (TimeLineCorrection)
|
|
{
|
|
currFrame = ID_MEDIA[TrackedMedia]->Tracks->GetTimeLine(currFrame, &ID_MEDIA[TrackedMedia]->Image);
|
|
}
|
|
|
|
//ID_MEDIA[TrackedMedia]->Tracks->Get(TrackIndex, currFrame, &matrix);
|
|
ID_MEDIA[TrackedMedia]->Tracks->Get(TrackIndex, ID_MEDIA[TrackedMedia]->dCurrentTime*ID_MEDIA[TrackedMedia]->dAvgFramePerSecond, &matrix);
|
|
SetSmoothMatrix(0, &matrix, Affect, AxeInversion);
|
|
if (Affect & 256)
|
|
{
|
|
|
|
ID_MEDIA[TrackedMedia]->Tracks->GetScale(TrackIndex,&matrixScale);
|
|
matrix.I *= matrixScale.x;
|
|
matrix.J *= matrixScale.z;
|
|
matrix.K *= matrixScale.y;
|
|
}
|
|
switch (Affect)
|
|
{
|
|
case 1: RETURN_VECTOR(&matrix.T);break;
|
|
case 4: RETURN_VECTOR(&matrix.I);break;
|
|
case 8: RETURN_VECTOR(&matrix.J);break;
|
|
case 16: RETURN_VECTOR(&matrix.K);break;
|
|
case 256: RETURN_VECTOR(&matrixScale);break;
|
|
case 258:
|
|
case 2: memset(&matrix.T, 0, sizeof(matrix.T));
|
|
case 0:
|
|
case 259:
|
|
case 3: RETURN_MATRIX(&matrix);break;
|
|
case 257: {
|
|
MATRIX ts;
|
|
ts.I *= matrixScale.x;
|
|
ts.J *= matrixScale.z;
|
|
ts.K *= matrixScale.y;
|
|
ts.T = matrix.T;
|
|
RETURN_MATRIX(&ts);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_PosForce,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_MATRIX(MatrixPos) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_MEDIA_OPT(MediaSynchro, -1),
|
|
"Save a position matrix in current tracked media<br/>If force=1, the track is always saved<br/>If force=0, the track is only saved if it's empty",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
if (MediaSynchro == -1)
|
|
MediaSynchro = TrackedMedia;
|
|
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
if (ID_TABLE[CurrentID])
|
|
{
|
|
Vector matrixScale;
|
|
matrixScale.x = MatrixPos.I.Norm(); MatrixPos.I.Normalize();
|
|
matrixScale.z = MatrixPos.J.Norm(); MatrixPos.J.Normalize();
|
|
matrixScale.y = MatrixPos.K.Norm(); MatrixPos.K.Normalize();
|
|
|
|
ID_MEDIA[TrackedMedia]->Tracks->Set(TrackIndex,ID_MEDIA[TrackedMedia]->ulCurrentFrame,
|
|
&MatrixPos, ID_TABLE[CurrentID]->SF_U.FlyStart + (ID_TABLE[CurrentID]->SF_U.FromScratch << 1));
|
|
|
|
ID_MEDIA[TrackedMedia]->Tracks->SetScale(TrackIndex,&matrixScale);
|
|
// Add to Test
|
|
ID_MEDIA[TrackedMedia]->Tracks->GetDescriptor(ID_MEDIA[TrackedMedia]->ulCurrentFrame)->ImageMarker =
|
|
GET_MARKER(&ID_MEDIA[MediaSynchro]->Image);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_PosSet, TRK_PosSave,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(ForceSave, 1) PARAM_MEDIA_OPT(MediaSynchro, -1),
|
|
"Save current tracked position in current tracked media<br/>If force=1, the track is always saved<br/>If force=0, the track is only saved if it's empty",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
if (MediaSynchro == -1)
|
|
MediaSynchro = TrackedMedia;
|
|
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
if (ID_TABLE[CurrentID])
|
|
{
|
|
if (TrackIndex >= ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks ||
|
|
ID_MEDIA[TrackedMedia]->ulCurrentFrame >=
|
|
ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].ulNumberOfMC ||
|
|
IsMatriceCompressedNull(&ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].pAnimation[ID_MEDIA[TrackedMedia]->ulCurrentFrame]))
|
|
ForceSave = 1;
|
|
|
|
if (ForceSave)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks->Set(TrackIndex,ID_MEDIA[TrackedMedia]->ulCurrentFrame,
|
|
&ID_TABLE[CurrentID]->CurrentMatrix_UNS, ID_TABLE[CurrentID]->SF_U.FlyStart + (ID_TABLE[CurrentID]->SF_U.FromScratch << 1));
|
|
ID_MEDIA[TrackedMedia]->Tracks->SetScale(TrackIndex,&ID_TABLE[CurrentID]->vModelScale);
|
|
// Add to Test
|
|
ID_MEDIA[TrackedMedia]->Tracks->GetDescriptor(ID_MEDIA[TrackedMedia]->ulCurrentFrame)->ImageMarker =
|
|
GET_MARKER(&ID_MEDIA[MediaSynchro]->Image);
|
|
RETURN_BOOL(true);
|
|
} else
|
|
{ RETURN_BOOL(false);}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_PosDel, DelTrackPos,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(beginPos, -1) PARAM_INT_OPT(endPos, -1),
|
|
"Delete tracked position in current tracked media<br/>If [Pos] and [End] are set, delete track from Pos to End<br/>If only [Pos] is set, delete the track at position [Pos]<br/>If neother [Pos] nor [End] are set, remove the current track ",
|
|
{
|
|
int CP;
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
}
|
|
if (ID_TABLE[CurrentID])
|
|
{
|
|
MATRIX nullMatrix;
|
|
|
|
nullMatrix.Clean();
|
|
if (beginPos == -1) beginPos = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (endPos == -1) endPos = beginPos;
|
|
for (int idx=beginPos; idx<=endPos; idx++)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks->Set(TrackIndex,idx, &nullMatrix, 0);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_TrackDel,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Delete tracked position in current tracked media<br/>If [Pos] and [End] are set, delete track from Pos to End<br/>If only [Pos] is set, delete the track at position [Pos]<br/>If neother [Pos] nor [End] are set, remove the current track ",
|
|
{
|
|
int CP;
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
}
|
|
if (ID_TABLE[CurrentID])
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks->DelStream(TrackIndex);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_CutsceneRefresh, RefreshCutScene,
|
|
CATEGORY(Tracking) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Set if there is a cut scene or not",
|
|
{
|
|
TrackPlayer_Descriptors *descPtr;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
if (TrackedMedia != -1)
|
|
{
|
|
descPtr = ID_MEDIA[TrackedMedia]->Tracks->GetDescriptor(ID_MEDIA[TrackedMedia]->ulCurrentFrame);
|
|
if (descPtr)
|
|
{
|
|
if (WSPC && (WSPC->INTERP_MatchingPercent < 8.0f))
|
|
{
|
|
descPtr->Flags = descPtr->Flags | 1;
|
|
RETURN_INT(1);
|
|
} else
|
|
{
|
|
descPtr->Flags = descPtr->Flags & ~1;
|
|
RETURN_INT(0);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_CutsceneSet, SetCutScene,
|
|
CATEGORY(Tracking) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(posIndex, -1),
|
|
"Force current media frame as a cut scene at specified position or current position",
|
|
{
|
|
TrackPlayer_Descriptors *descPtr;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
if (posIndex == -1)
|
|
posIndex = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
|
|
descPtr = ID_MEDIA[TrackedMedia]->Tracks->GetDescriptor(posIndex);
|
|
descPtr->Flags = descPtr->Flags | 1;
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_CutsceneDel, DelCutScene,
|
|
CATEGORY(Tracking) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(posIndex, -1),
|
|
"Force track as a cut scene at specified position or current position",
|
|
{
|
|
TrackPlayer_Descriptors *descPtr;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
if (posIndex == -1)
|
|
posIndex = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
|
|
descPtr = ID_MEDIA[TrackedMedia]->Tracks->GetDescriptor(posIndex);
|
|
descPtr->Flags = descPtr->Flags & ~1;
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_CutSceneTest, IsCutScene,
|
|
CATEGORY(Tracking) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(idxBegin, -1) PARAM_INT_OPT(idxEnd, -1),
|
|
"Return if the frame is a cutscene",
|
|
{
|
|
int nbReturn = 0;
|
|
BOOL returnList[1024];
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (idxBegin == -1) idxBegin = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (idxEnd == -1) idxEnd = idxBegin;
|
|
|
|
if (ID_MEDIA[TrackedMedia]->Tracks)
|
|
{
|
|
if (idxEnd >= ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfDescriptors)
|
|
idxEnd = ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfDescriptors - 1;
|
|
|
|
if (idxEnd - idxBegin < 1024)
|
|
{
|
|
for (int idx = idxBegin; idx <= idxEnd; idx++)
|
|
returnList[nbReturn++] = ((ID_MEDIA[TrackedMedia]->Tracks->IsCutScene(idx)) ? 1 : 0);
|
|
}
|
|
}
|
|
}
|
|
if (nbReturn == 1)
|
|
{ RETURN_BOOL(returnList[0]); }
|
|
else if (nbReturn > 1)
|
|
{ RETURN_TABLE_INT(returnList, nbReturn); }
|
|
else
|
|
{ RETURN_BOOL(false); }
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_Count, GetNumTracks,
|
|
CATEGORY(Tracking) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Return the number of tracks of the current tracked media",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) &&
|
|
ID_MEDIA[TrackedMedia]->Tracks)
|
|
{ RETURN_INT(ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks); }
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_NameGet, GetTrackName,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Return the track's name",
|
|
{
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) &&
|
|
ID_MEDIA[TrackedMedia]->Tracks &&
|
|
TrackIndex < ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks)
|
|
{ RETURN_STRING(ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].Name); }
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_NameSet, SetTrackName,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(Name) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Set the track's name",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) &&
|
|
ID_MEDIA[TrackedMedia]->Tracks &&
|
|
TrackIndex < ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks)
|
|
{
|
|
strcpy(ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].Name, Name);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_Smooth, SmoothTracks,
|
|
CATEGORY(Tracking) PARAM_MEDIA(Mi) PARAM_INT_OPT(MaxSmooth, -1),
|
|
"Add lost images in tracker",
|
|
{
|
|
if (ID_MEDIA[Mi]->Tracks)
|
|
{
|
|
ID_MEDIA[Mi]->Tracks->Clean(MaxSmooth);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_SmoothIO, SmoothTrackIO,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_INT(begin) PARAM_INT(end) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if ((TrackedMedia != -1) && (ID_MEDIA[TrackedMedia]) &&
|
|
begin < end && end < ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].ulNumberOfMC)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks->CleanZone(TrackIndex, begin, end);
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(TRK_StatusGet, GetTrackStatus,
|
|
CATEGORY(Tracking) PARAM_INT(TrackeurID),
|
|
"return tracker state, like Islost with more info<br/>0: tracking ok<br/>1: traking on fly<br/>2: traking from scratch<br/>3: combination of 1 and 2<br/>8: no tracker",
|
|
{
|
|
if (!(SkipFunctions & SKIP_TRACKER))
|
|
{
|
|
int status;
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID= 0;
|
|
if (ID_TABLE[TrackeurID])
|
|
{
|
|
status = ID_TABLE[TrackeurID]->SF_U.FlyStart + (ID_TABLE[TrackeurID]->SF_U.FromScratch << 1);
|
|
} else
|
|
status = 8;
|
|
RETURN_INT(status);
|
|
}
|
|
//else
|
|
// RETURN_INT(8);
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_StatusSavedGet, GetSavedTrackStatus,
|
|
CATEGORY(Tracking) PARAM_INT(TrackeurID) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(trckBegin, -1) PARAM_INT_OPT(trckEnd, -1),
|
|
"return SAVED tracker state<br/>If [Track] is Set, returns the tracker save status at specified position<br/>Track States:<br/>0: tracking ok<br/>1: traking on fly<br/>2: traking from scratch<br/>3: combination of 1 and 2<br/>4: null track<br/> 8: no track made",
|
|
{
|
|
int trckPos;
|
|
int nbReturn = 0;
|
|
int returnList[1024];
|
|
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if (trckBegin == -1) trckBegin = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (trckEnd == -1) trckEnd = trckBegin;
|
|
|
|
if (TrackeurID >= MAX_ID) TrackeurID = MAX_ID-1;
|
|
if (TrackeurID < 0) TrackeurID = 0;
|
|
if (ID_MEDIA[TrackedMedia]->Tracks &&
|
|
TrackeurID < ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks)
|
|
{
|
|
if (trckEnd >= ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackeurID].ulNumberOfMC)
|
|
trckEnd = ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackeurID].ulNumberOfMC - 1;
|
|
|
|
if (trckEnd - trckBegin < 2047)
|
|
{
|
|
for (trckPos=trckBegin; trckPos <= trckEnd; trckPos++)
|
|
{
|
|
if (IsMatriceCompressedNull(&ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackeurID].pAnimation[trckPos]))
|
|
returnList[nbReturn++] = 4;
|
|
else
|
|
returnList[nbReturn++] = (int)(ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackeurID].pAnimation[trckPos].IsValid & 3);
|
|
}
|
|
}
|
|
}
|
|
if (nbReturn == 1)
|
|
{ RETURN_INT(returnList[0]); }
|
|
else if (nbReturn > 1)
|
|
{ RETURN_TABLE_INT(returnList, nbReturn); }
|
|
else
|
|
{ RETURN_INT(8); }
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_ColorSet, SetTrackColor,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_COLOR(color) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(posBegin, -1) PARAM_INT_OPT(posEnd, -1),
|
|
"Set color in track using",
|
|
{
|
|
int posIndex;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
if (posBegin == -1) posBegin = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (posEnd == -1) posEnd = posBegin;
|
|
|
|
for (posIndex = posBegin; posIndex <= posEnd; posIndex++)
|
|
ID_MEDIA[TrackedMedia]->Tracks->SetSkinColor(TrackIndex, posIndex, color);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_ColorGet, GetTrackColor,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(trckBegin, -1) PARAM_INT_OPT(trckEnd, -1),
|
|
"return SAVED tracker color in RGB mode",
|
|
{
|
|
int trckPos;
|
|
int strPos;
|
|
u32 color;
|
|
char resultStr[2048];
|
|
BOOL tableMode = false;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
memset(resultStr, 0, sizeof(resultStr));
|
|
|
|
if (trckBegin == -1) trckBegin = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (trckEnd == -1) trckEnd = trckBegin;
|
|
else tableMode = true;
|
|
|
|
if (TrackIndex >= MAX_ID) TrackIndex = MAX_ID-1;
|
|
if (TrackIndex < 0) TrackIndex = 0;
|
|
if (ID_MEDIA[TrackedMedia]->Tracks &&
|
|
TrackIndex < ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks &&
|
|
trckBegin < ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].ulNumberOfMC)
|
|
{
|
|
if (trckEnd >= ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].ulNumberOfMC)
|
|
trckEnd = ID_MEDIA[TrackedMedia]->Tracks->TracksPtrs[TrackIndex].ulNumberOfMC - 1;
|
|
|
|
if (trckEnd - trckBegin < 256)
|
|
{
|
|
for (trckPos=trckBegin, strPos=0; trckPos <= trckEnd; trckPos++, strPos+=6)
|
|
{
|
|
color = ID_MEDIA[TrackedMedia]->Tracks->GetSkinColor(TrackIndex, trckPos);
|
|
sprintf(resultStr + strPos, "%06X", color);
|
|
}
|
|
resultStr[strPos] = 0;
|
|
}
|
|
if (tableMode)
|
|
{ RETURN_STRING(resultStr); }
|
|
else
|
|
{ RETURN_COLOR(color); }
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_DataIntSet,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(DataName) PARAM_INT(DataValue) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Set integer data into .TRK <br/>if track index == -1, stocks in descriptor",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
RETURN_INT(ID_MEDIA[TrackedMedia]->Tracks->SetDataInt(TrackIndex,ID_MEDIA[TrackedMedia]->ulCurrentFrame, DataName, DataValue));
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_DataIntGet,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(DataName) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(FromFrame, -1) PARAM_INT_OPT(ToFrame, -1),
|
|
"Get integer data into .TRK <br/>if track index == -1, stocks in descriptor",
|
|
{
|
|
int returnInt;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if (ID_MEDIA[TrackedMedia]->Tracks &&
|
|
(int)TrackIndex < (int)ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks)
|
|
{
|
|
if (ToFrame == -1)
|
|
ToFrame = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (FromFrame != -1)
|
|
{
|
|
for (int fndIdx = FromFrame; fndIdx <= ToFrame; fndIdx++)
|
|
if (ID_MEDIA[TrackedMedia]->Tracks->GetDataInt(TrackIndex,fndIdx, DataName, &returnInt))
|
|
{ RETURN_INT_EVENT(returnInt, (double)fndIdx/ID_MEDIA[TrackedMedia]->dAvgFramePerSecond); }
|
|
} else
|
|
if (ID_MEDIA[TrackedMedia]->Tracks->GetDataInt(TrackIndex,ToFrame, DataName, &returnInt))
|
|
{ RETURN_INT_EVENT(returnInt, (double)ToFrame/ID_MEDIA[TrackedMedia]->dAvgFramePerSecond); }
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_DataFloatSet,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(DataName) PARAM_FLOAT(DataValue) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Set float data into .TRK <br/>if track index == -1, stocks in descriptor",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
RETURN_INT(ID_MEDIA[TrackedMedia]->Tracks->SetDataFloat(TrackIndex,ID_MEDIA[TrackedMedia]->ulCurrentFrame, DataName, DataValue));
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_DataFloatGet,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(DataName) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(FromFrame, -1) PARAM_INT_OPT(ToFrame, -1),
|
|
"Get float data into .TRK <br/>if track index == -1, stocks in descriptor",
|
|
{
|
|
float returnFloat;
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if (ID_MEDIA[TrackedMedia]->Tracks &&
|
|
(int)TrackIndex < (int)ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks)
|
|
{
|
|
if (ToFrame == -1)
|
|
ToFrame = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (FromFrame != -1)
|
|
{
|
|
for (int fndIdx = FromFrame; fndIdx <= ToFrame; fndIdx++)
|
|
if (ID_MEDIA[TrackedMedia]->Tracks->GetDataFloat(TrackIndex,fndIdx, DataName, &returnFloat))
|
|
{ RETURN_FLOAT_EVENT(returnFloat, (double)fndIdx/ID_MEDIA[TrackedMedia]->dAvgFramePerSecond); }
|
|
} else
|
|
if (ID_MEDIA[TrackedMedia]->Tracks->GetDataFloat(TrackIndex, ToFrame, DataName, &returnFloat))
|
|
{ RETURN_FLOAT_EVENT(returnFloat, (double)ToFrame/ID_MEDIA[TrackedMedia]->dAvgFramePerSecond); }
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_DataStringSet,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(DataName) PARAM_STRING(DataValue) PARAM_MEDIA_OPT(TrackedMedia, -1),
|
|
"Set string (256 max) data into .TRK <br/>if track index == -1, stocks in descriptor",
|
|
{
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if((TrackedMedia != -1) &&
|
|
(ID_MEDIA[TrackedMedia]))
|
|
{
|
|
if (ID_MEDIA[TrackedMedia]->Tracks == NULL)
|
|
{
|
|
ID_MEDIA[TrackedMedia]->Tracks = (TrackPlayer*)CC_malloc(sizeof(TrackPlayer));
|
|
memset(ID_MEDIA[TrackedMedia]->Tracks,0,sizeof(TrackPlayer));
|
|
};
|
|
RETURN_INT(ID_MEDIA[TrackedMedia]->Tracks->SetDataStr(TrackIndex,ID_MEDIA[TrackedMedia]->ulCurrentFrame, DataName, DataValue));
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(TRK_DataStringGet,
|
|
CATEGORY(Tracking) PARAM_INT(TrackIndex) PARAM_STRING(DataName) PARAM_MEDIA_OPT(TrackedMedia, -1) PARAM_INT_OPT(FromFrame, -1) PARAM_INT_OPT(ToFrame, -1),
|
|
"Get string data into .TRK <br/>if track index == -1, stocks in descriptor",
|
|
{
|
|
char returnStr[256];
|
|
|
|
if (TrackedMedia == -1)
|
|
TrackedMedia = MediaToTrack;
|
|
|
|
if (ID_MEDIA[TrackedMedia]->Tracks &&
|
|
(int)TrackIndex < (int)ID_MEDIA[TrackedMedia]->Tracks->ulNumberOfTracks)
|
|
{
|
|
if (ToFrame == -1)
|
|
ToFrame = ID_MEDIA[TrackedMedia]->ulCurrentFrame;
|
|
if (FromFrame != -1)
|
|
{
|
|
for (int fndIdx = FromFrame; fndIdx <= ToFrame; fndIdx++)
|
|
if (ID_MEDIA[TrackedMedia]->Tracks->GetDataStr(TrackIndex,fndIdx, DataName, returnStr))
|
|
{ RETURN_STRING_EVENT(returnStr, (double)fndIdx/ID_MEDIA[TrackedMedia]->dAvgFramePerSecond); }
|
|
} else
|
|
if (ID_MEDIA[TrackedMedia]->Tracks->GetDataStr(TrackIndex,ToFrame, DataName, returnStr))
|
|
{ RETURN_STRING_EVENT(returnStr, (double)ToFrame/ID_MEDIA[TrackedMedia]->dAvgFramePerSecond); }
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_Log,
|
|
CATEGORY(Application) PARAM_STRING(log),
|
|
"Log text on DBG File",
|
|
{
|
|
void SaveDBGInfo(char *text);
|
|
SaveDBGInfo(log);
|
|
})
|
|
DEFINE_SCRIPT(APP_Error,
|
|
CATEGORY(Application),
|
|
"Force Error",
|
|
{
|
|
HandleError(L, luaParam);
|
|
})
|
|
#ifdef USER_MODE
|
|
DEFINE_SCRIPT(APP_UserModeTest,
|
|
CATEGORY(Application),
|
|
"Return if executable is compiled in user mode",
|
|
{
|
|
RETURN_BOOL(1);
|
|
})
|
|
DEFINE_SCRIPT(APP_VersionGet,
|
|
CATEGORY(Application),
|
|
"Return application version",
|
|
{
|
|
extern const char *VersionStr;
|
|
RETURN_STRING((char *)VersionStr);
|
|
})
|
|
#else
|
|
DEFINE_SCRIPT(APP_UserModeTest,
|
|
CATEGORY(Application),
|
|
"Return if executable is compiled in user mode",
|
|
{
|
|
RETURN_BOOL(0);
|
|
})
|
|
DEFINE_SCRIPT(APP_VersionGet,
|
|
CATEGORY(Application),
|
|
"Return application version",
|
|
{
|
|
extern u32 VersionNumber;
|
|
RETURN_INT(VersionNumber);
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT(APP_IsRestart,
|
|
CATEGORY(Application),
|
|
"Verify if application is on restart mode",
|
|
{
|
|
extern u32 IsRestart;
|
|
RETURN_BOOL(IsRestart);
|
|
})
|
|
DEFINE_SCRIPT(APP_CurrentUserGet,
|
|
CATEGORY(Application),
|
|
"Return application version",
|
|
{
|
|
extern DWORD CurrentSessionID;
|
|
RETURN_INT(CurrentSessionID);
|
|
})
|
|
DEFINE_SCRIPT(APP_LaunchUserGet,
|
|
CATEGORY(Application),
|
|
"Return application version",
|
|
{
|
|
extern DWORD LaunchSessionID;
|
|
RETURN_INT(LaunchSessionID);
|
|
})
|
|
DEFINE_SCRIPT(APP_GetDemoBranchFlag,
|
|
CATEGORY(Application),
|
|
"Return if the GameId of the application belongs to the Demo branch",
|
|
{
|
|
RETURN_BOOL(GetDemoBranchFlagFromRegistry());
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_GetFirstRunFlag,
|
|
CATEGORY(Application),
|
|
"Return false if the application has already been run with an account",
|
|
{
|
|
RETURN_BOOL(GetFirstRunFlag());
|
|
})
|
|
|
|
/*DEFINE_SCRIPT(APP_GetValueFromRegistry,
|
|
CATEGORY(Application), PARAM_STRING(Item), PARAM_BOOL(FromHKCU, true)
|
|
"Return the value of the item in HKCU/Software/Ubisoft/CamCam (or HKLM if From HKCU is false)",
|
|
{
|
|
char value[2048] = "";
|
|
GetCamCamValueFromRegistry(value, Item, FromHKCU));
|
|
RETURN_STRING(value);
|
|
})*/
|
|
|
|
DEFINE_SCRIPT(APP_GetInstalledLanguage,
|
|
CATEGORY(Application),
|
|
"Return the 2-character language code",
|
|
{
|
|
char languageCode[3] = "";
|
|
GetInstalledLanguageCode(languageCode);
|
|
RETURN_STRING(languageCode);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_SplashScreenShow,
|
|
CATEGORY(Application) PARAM_INT_OPT(ON_OFF, 1),
|
|
"Show/Hide the splashscreen",
|
|
{
|
|
void ShowSplashScreen(bool show);
|
|
ShowSplashScreen((bool)ON_OFF);
|
|
})
|
|
DEFINE_SCRIPT(APP_SetGraphicDriver,
|
|
CATEGORY(Application) PARAM_INT(DriverNumber),
|
|
"0 for Opengl, 1 for D3D",
|
|
{
|
|
ChangeDriver(DriverNumber);
|
|
})
|
|
#ifdef ONLINE_MODE
|
|
DEFINE_SCRIPT(APP_GetYouUpBranch,
|
|
CATEGORY(Application),
|
|
"Return the YouUp Branch for this Exe (Demo, Beta, Release)",
|
|
{
|
|
RETURN_STRING(YOUUP_BRANCH);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_GetYouUpOrigin,
|
|
CATEGORY(Application),
|
|
"Return the YouUp Origin (referrer) for this Exe",
|
|
{
|
|
RETURN_STRING(YOUUP_ORIGIN);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_GetYouUpBranding,
|
|
CATEGORY(Application),
|
|
"Return the YouUp Branding for this Exe (MSN, Ubisoft)",
|
|
{
|
|
RETURN_STRING(YOUUP_ORIGIN);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_Exit,
|
|
CATEGORY(Application),
|
|
"Kill application",
|
|
{
|
|
void API_EXIT();
|
|
API_EXIT();
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_AutorunSet,
|
|
CATEGORY(Application) PARAM_INT_OPT(ON_OFF, 1),
|
|
"Set autorun off application in windows startup",
|
|
{
|
|
int RegisterBoot(u32 add);
|
|
RegisterBoot(ON_OFF);
|
|
})
|
|
DEFINE_SCRIPT(APP_AutorunGet,
|
|
CATEGORY(Application),
|
|
"Get autorun off application in windows startup",
|
|
{
|
|
int RegisterBoot(u32 add);
|
|
int res = RegisterBoot(-1);
|
|
if (res >= 0)
|
|
{ RETURN_BOOL(res); }
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT(APP_AVI2FLV,
|
|
CATEGORY(Application) PARAM_STRING(AviPath) PARAM_STRING(FlvDest),
|
|
"Test Function - Convert AVI to FLV",
|
|
{
|
|
int AVI2FLV(char *avi, char *flv, bool *Aborted=NULL);
|
|
RETURN_BOOL(AVI2FLV(AviPath, FlvDest));
|
|
})
|
|
DEFINE_SCRIPT(APP_IconShow,
|
|
CATEGORY(Application) PARAM_INT_OPT(Show, 1),
|
|
"Show or hide tray icon",
|
|
{
|
|
void AnimateIcon(HINSTANCE hInstance, HWND hWnd, DWORD dwMsgType,UINT nIndexOfIcon,char *pInfoTexte);
|
|
if (Show)
|
|
{
|
|
AnimateIcon(NULL, OwnerHwnd, NIM_ADD,0,"");
|
|
} else
|
|
{
|
|
AnimateIcon(NULL, OwnerHwnd, NIM_DELETE,0,"");
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_DragFile,
|
|
CATEGORY(Application) PARAM_STRING(filename) PARAM_INT_OPT(moveFiles, 0),
|
|
"do drag and drop ...",
|
|
{
|
|
int DragAndDrop(char *path, bool moveFiles);
|
|
DragAndDrop(filename, (bool)moveFiles);
|
|
})
|
|
|
|
DEFINE_SCRIPT(APP_ForceKey,
|
|
CATEGORY(Application) PARAM_STRING(Key) PARAM_INT_OPT(IsUp,0) PARAM_INT_OPT(IsScanCode,0),
|
|
"",
|
|
{
|
|
void SendKeyMessage(DWORD code, int isScanCode, int isUp);
|
|
SendKeyMessage(*Key, IsScanCode, IsUp);
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(APP_Restart, APP_ExitInDriver,
|
|
CATEGORY(Application) PARAM_STRING_OPT(file, ""),
|
|
"",
|
|
{
|
|
if (*file )
|
|
strcpy(LuaScriptRestart, file);
|
|
else
|
|
strcpy(LuaScriptRestart, "driver.lua");
|
|
})
|
|
DEFINE_SCRIPT(APP_ForceMouse,
|
|
CATEGORY(Application) PARAM_INT(x) PARAM_INT(y) PARAM_INT_OPT(PressStatus,0),
|
|
"",
|
|
{
|
|
void SendMouseMessage(int x, int y, DWORD status);
|
|
SendMouseMessage(x,y,PressStatus);
|
|
})
|
|
DEFINE_SCRIPT_REN(APP_KeyPressTest, IsKeyPressed,
|
|
CATEGORY(Application) PARAM_INT_OPT(KeyNum, -1) PARAM_STRING_OPT(Key, ""),
|
|
"return 1 if one of the key is pressed",
|
|
{
|
|
BOOL keyPressed = false;
|
|
char *Parser;
|
|
|
|
if (*Key)
|
|
{
|
|
Parser = Key;
|
|
while (*Parser)
|
|
{
|
|
if (IsKeyPressed(*(Parser++))) keyPressed = true;
|
|
};
|
|
} else if (KeyNum != -1)
|
|
{
|
|
keyPressed = GetKeyState(KeyNum) & 0x80;
|
|
}
|
|
RETURN_BOOL(keyPressed);
|
|
})
|
|
DEFINE_SCRIPT_REN(APP_KeyUnpress, UnPressKey,
|
|
CATEGORY(Application) PARAM_STRING(Keys),
|
|
"unpress the specifyed key(s)",
|
|
{
|
|
char *Parser;
|
|
Parser = Keys;
|
|
while (*Parser)
|
|
{
|
|
UnPressKey(*(Parser++));
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_KeyGet,
|
|
CATEGORY(Application),
|
|
"Get current pressed char key",
|
|
{
|
|
char MyCharString[2];
|
|
|
|
MyCharString[0] = LastKeyPressed;
|
|
MyCharString[1] = 0;
|
|
RETURN_STRING(MyCharString);
|
|
})
|
|
DEFINE_SCRIPT_REN(APP_MousePressTest, IsMousePressed,
|
|
CATEGORY(Application) PARAM_INT_OPT(TestEvenWithNoFocus, 0),
|
|
"return true if left mouse button is pressed",
|
|
{
|
|
if (!TestEvenWithNoFocus && !CheckFocus())
|
|
{
|
|
RETURN_BOOL(0);
|
|
} else
|
|
{
|
|
RETURN_BOOL((GetAsyncKeyState(VK_LBUTTON) & 0x8000));
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_Explore,
|
|
CATEGORY(Application) PARAM_STRING(path),
|
|
"open explorer at specified path",
|
|
{
|
|
char TEXT[2048];
|
|
sprintf(TEXT,"CMD /C START explorer %s", path);
|
|
WinExec(TEXT,SW_HIDE);
|
|
})
|
|
#ifdef RASTERS_ACTIVATED
|
|
DEFINE_SCRIPT(APP_RasterStart,
|
|
CATEGORY(Application) PARAM_INT(index) PARAM_STRING_OPT(Name, ""),
|
|
"Set Raster, 0 <= index <= 4",
|
|
{
|
|
if (*Name)
|
|
StartRaster((RASTER_ENUM)(RAS_SCRIPT_Raster1+index), Name);
|
|
else
|
|
StartRaster((RASTER_ENUM)(RAS_SCRIPT_Raster1+index));
|
|
})
|
|
DEFINE_SCRIPT(APP_RasterStop,
|
|
CATEGORY(Application) PARAM_INT(index),
|
|
"Set Raster, 0 <= index <= 4",
|
|
{
|
|
StopRaster((RASTER_ENUM)(RAS_SCRIPT_Raster1+index));
|
|
})
|
|
#else
|
|
DEFINE_SCRIPT(APP_RasterStart,
|
|
CATEGORY(Application) PARAM_INT(index) PARAM_STRING_OPT(Name, ""),
|
|
"Set Raster, 0 <= index <= 4",
|
|
{
|
|
})
|
|
DEFINE_SCRIPT(APP_RasterStop,
|
|
CATEGORY(Application) PARAM_INT(index),
|
|
"Set Raster, 0 <= index <= 4",
|
|
{
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT(APP_ScreenMouseThresholdSet,
|
|
CATEGORY(Application) PARAM_FLOAT(Threshold),
|
|
"Set screen mouse noise threshold, set a small value for a big smooth",
|
|
{
|
|
extern float NoisThreshold;
|
|
NoisThreshold = Threshold;
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISaveConfig,
|
|
CATEGORY(Application) PARAM_STRING(SaveFile) PARAM_INT_OPT(UseSound, 0) PARAM_STRING_OPT(FilterName, "") PARAM_INT_OPT(Width, 0) PARAM_INT_OPT(Height, 0),
|
|
"Create and config avi file writer",
|
|
{
|
|
CreateMedia(SaveFile, 0, true);
|
|
RETURN_BOOL(SaveInFile_Config(SaveFile, UseSound, FilterName, Width, Height));
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISaveSourceSet,
|
|
CATEGORY(Application) PARAM_INT(OnResultFrame) PARAM_MEDIA_OPT(media, -1),
|
|
"Set Avi writer source if onResultFrame == 1, use total screen, else, use a specific media. DO IT BEFORE START !!!",
|
|
{
|
|
SaveInFile_SetSource(OnResultFrame, media);
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISaveAudioSourceAdd,
|
|
CATEGORY(Application) PARAM_STRING(media),
|
|
"Add an audio source to Record. DO IT BEFORE START !!!",
|
|
{
|
|
RETURN_INT(SaveInFile_AddInputData(media));
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISaveAudioSourceSeek,
|
|
CATEGORY(Application) PARAM_INT(inputIndex) PARAM_FLOAT(time),
|
|
"Seek audio source. DO IT BEFORE START !!!",
|
|
{
|
|
RETURN_BOOL(SaveInFile_SeekInputData(inputIndex, time));
|
|
})
|
|
#ifdef VIDEO_OPENLIB
|
|
DEFINE_SCRIPT(APP_AVISaveAudioSourceSkip,
|
|
CATEGORY(Application) PARAM_INT(inputIndex) PARAM_INT_OPT(skip, 1),
|
|
"Skip audio source. THIS FUNCTION DO NOT REMOVE THE INPUT",
|
|
{
|
|
RETURN_BOOL(SaveInFile_SkipInputData(inputIndex, skip));
|
|
})
|
|
#endif
|
|
#ifndef USE_WMV
|
|
DEFINE_SCRIPT(APP_AVISaveExtension,
|
|
CATEGORY(Application),
|
|
"Return video file extension",
|
|
{
|
|
RETURN_STRING(".avi");
|
|
})
|
|
#else
|
|
DEFINE_SCRIPT(APP_AVISaveExtension,
|
|
CATEGORY(Application),
|
|
"Return video file extension",
|
|
{
|
|
RETURN_STRING(".wmv");
|
|
})
|
|
#endif
|
|
|
|
DEFINE_SCRIPT(APP_AVISaveStart,
|
|
CATEGORY(Application),
|
|
"Start save",
|
|
{
|
|
if (!SaveInFile_Init())
|
|
{
|
|
SaveInFile_Stop();
|
|
RETURN_BOOL(0);
|
|
} else
|
|
{
|
|
RETURN_BOOL(1);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISaveRun,
|
|
CATEGORY(Application),
|
|
"Begin AVI Save (need AVISaveConfig)",
|
|
{
|
|
RETURN_BOOL(SaveInFile_Run());
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISavePause,
|
|
CATEGORY(Application),
|
|
"Pause AVI Save (need AVISaveConfig)",
|
|
{
|
|
RETURN_BOOL(SaveInFile_Pause());
|
|
})
|
|
DEFINE_SCRIPT(APP_AVISaveStop,
|
|
CATEGORY(Application),
|
|
"Stop and remove AVI save mode (need AVISaveConfig), after a stop a Config is needed again",
|
|
{
|
|
RETURN_BOOL(SaveInFile_Stop());
|
|
})
|
|
DEFINE_SCRIPT(APP_Sleep,
|
|
CATEGORY(Application) PARAM_INT(SleepTime),
|
|
"Sleep application (time in milliseconds)",
|
|
{
|
|
Sleep(SleepTime);
|
|
})
|
|
DEFINE_SCRIPT(APP_DirWatch,
|
|
CATEGORY(Application) PARAM_STRING_OPT(Directory, ""),
|
|
"Set Lua watch to specified directory (only on watch at the same time), if file is modified, the lua event onDirWatch is send",
|
|
{
|
|
int DWLua_WatchDirectory(char *DirectoryToWatch, void *pS);
|
|
int DWLua_UnWatchDirectory();
|
|
if (*Directory)
|
|
DWLua_WatchDirectory(Directory, (void *)this);
|
|
else
|
|
DWLua_UnWatchDirectory();
|
|
})
|
|
DEFINE_SCRIPT(APP_ApplicationDataPathGet,
|
|
CATEGORY(Application),
|
|
"Get user application data path",
|
|
{
|
|
extern char AppDataPath[];
|
|
RETURN_STRING(AppDataPath);
|
|
})
|
|
DEFINE_SCRIPT(APP_MyDocsPathGet,
|
|
CATEGORY(Application),
|
|
"Get user My Documents path",
|
|
{
|
|
extern char MyDocsPath[];
|
|
RETURN_STRING(MyDocsPath);
|
|
})
|
|
DEFINE_SCRIPT(APP_MyMusicPathGet,
|
|
CATEGORY(Application),
|
|
"Get user My Music path",
|
|
{
|
|
extern char MyMusicsPath[];
|
|
RETURN_STRING(MyMusicsPath);
|
|
})
|
|
DEFINE_SCRIPT(APP_MyPicturesPathGet,
|
|
CATEGORY(Application),
|
|
"Get user My Pictures path",
|
|
{
|
|
extern char MyPicturesPath[];
|
|
RETURN_STRING(MyPicturesPath);
|
|
})
|
|
DEFINE_SCRIPT(APP_SimConnect,
|
|
CATEGORY(Application) PARAM_INT_OPT(newDelta, 0) PARAM_INT_OPT(close, 0) PARAM_FLOAT_OPT(xFactor, 1) PARAM_FLOAT_OPT(yFactor, 1) PARAM_FLOAT_OPT(zFactor, 1) PARAM_FLOAT_OPT(rFactor, 1) PARAM_FLOAT_OPT(tSmooth, 0) PARAM_FLOAT_OPT(rSmooth, 0),
|
|
"Connection To Flight simulator",
|
|
{
|
|
void testCockpitCamera(bool close, bool newDelta, float xFactor, float yFactor, float zFactor, float rFactor, float tSmoothFactor, float rSmoothFactor);
|
|
testCockpitCamera(close, newDelta, xFactor, yFactor, zFactor, rFactor, tSmooth, rSmooth);
|
|
})
|
|
DEFINE_SCRIPT(APP_BlazingConnect,
|
|
CATEGORY(Application) PARAM_INT_OPT(init, 0) PARAM_MATRIX(matrix) PARAM_FLOAT_OPT(ratio, 1.0f),
|
|
"Connection To Flight simulator",
|
|
{
|
|
bool SendCommandToBlazingAngel(MATRIX *matrix, bool init, float ratio);
|
|
RETURN_BOOL(SendCommandToBlazingAngel(&matrix, init, ratio));
|
|
})
|
|
DEFINE_SCRIPT(FILE_Exists,
|
|
CATEGORY(File) PARAM_STRING(filename),
|
|
"Verify if file exists and can be Opened !",
|
|
{
|
|
FILE *file;
|
|
file = fopen(filename, "r");
|
|
if (file)
|
|
{
|
|
fclose(file);
|
|
RETURN_BOOL(1);
|
|
} else
|
|
{
|
|
RETURN_BOOL(0);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(FILE_Copy,
|
|
CATEGORY(File) PARAM_STRING(src) PARAM_STRING(dst),
|
|
"Copy specified file",
|
|
{
|
|
RETURN_BOOL(CopyFile(src, dst, 0));
|
|
})
|
|
DEFINE_SCRIPT(FILE_Move,
|
|
CATEGORY(File) PARAM_STRING(src) PARAM_STRING(dst),
|
|
"Move specified file",
|
|
{
|
|
RETURN_BOOL(MoveFile(src, dst));
|
|
})
|
|
DEFINE_SCRIPT(FILE_Delete,
|
|
CATEGORY(File) PARAM_STRING(filename),
|
|
"Delete specified file",
|
|
{
|
|
RETURN_BOOL(DeleteFile(filename));
|
|
})
|
|
DEFINE_SCRIPT(FILE_DirCreate,
|
|
CATEGORY(File) PARAM_STRING(dirname),
|
|
"Create specified directory",
|
|
{
|
|
RETURN_BOOL(CreateDirectory(dirname, NULL));
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(DRW_MediaPoint, DrawPoint,
|
|
CATEGORY(Drawing) PARAM_INT(X) PARAM_INT(Y) PARAM_MEDIA(Mi) PARAM_COLOR(ColorRGB) PARAM_INT(Opacity) PARAM_INT(Diam) PARAM_INT(CursorMode),
|
|
"Draw one pixel with the specified color into the media at position X,Y<br/>Modes 0: Paint - 1:Cursor - 2:RemoveCursor",
|
|
{
|
|
if (!(SkipFunctions & SKIP_DRAWING))
|
|
{
|
|
POINT XY;
|
|
|
|
XY.x = X; XY.y = Y;
|
|
if (ID_MEDIA[Mi]->Image.GetBase())
|
|
{
|
|
if (CursorMode & 4)
|
|
{
|
|
if (prevMousePointSet && (CursorMode & 3)) {
|
|
PaintCursor(&ID_MEDIA[Mi]->Image, prevMousePoint, prevDiam);
|
|
}
|
|
prevMousePointSet = 0;
|
|
prevMousePoint.x =
|
|
prevMousePoint.y = 0;
|
|
} else if ( XY.x >= 0 && XY.x < ID_MEDIA[Mi]->Image.SX &&
|
|
XY.y >= 0 && XY.y < ID_MEDIA[Mi]->Image.SY )
|
|
{
|
|
if (CursorMode == 0 || CursorMode & 1)
|
|
Paint(&ID_MEDIA[Mi]->Image, XY, prevMousePoint, ColorRGB, Opacity, Diam);
|
|
if (CursorMode & 2)
|
|
{
|
|
PaintCursor(&ID_MEDIA[Mi]->Image, XY, Diam);
|
|
}
|
|
prevMousePointSet = 1;
|
|
prevMousePoint = XY;
|
|
prevDiam = Diam;
|
|
}
|
|
if (ID_MEDIA[Mi]->ulAssociatedTextureIndex != -1)
|
|
DI->UpdateTexture_BM_2_HW(ID_MEDIA[Mi]->ulAssociatedTextureIndex);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_MorphSet, SetMorph,
|
|
CATEGORY(Small Scene) PARAM_SCENE(SmSc) PARAM_STRING_OPT(ObjectName, "") PARAM_LIST_FLOAT(WeightList),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF = -1;
|
|
|
|
if (*ObjectName != 0)
|
|
{
|
|
sprintf(ObjectNameOBJ, "%s.OBJ", ObjectName);
|
|
ObjectREF = SmSc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = SmSc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (ObjectREF != -1)
|
|
ObjectREF = SmSc->ObjectsPtrs[ObjectREF]->MeshIndex;
|
|
}
|
|
}
|
|
|
|
for (u32 MeshIndex = 0; MeshIndex < SmSc->ulNumberOfMeshes ; MeshIndex++)
|
|
{
|
|
if ((ObjectREF == -1 || ObjectREF == MeshIndex) && SmSc->MeshesPtrs[MeshIndex])
|
|
{
|
|
for (int MorphIndex=0; MorphIndex<NbWeightList; MorphIndex++)
|
|
{
|
|
if (MorphIndex < SmSc->MeshesPtrs[MeshIndex]->ulNumberOfTarget)
|
|
SmSc->MeshesPtrs[MeshIndex]->MorphTargets[MorphIndex].Weight = WeightList[MorphIndex];
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(SCN_MorphGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(SmSc) PARAM_STRING(ObjectName),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF = -1;
|
|
|
|
sprintf(ObjectNameOBJ, "%s.OBJ", ObjectName);
|
|
ObjectREF = SmSc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = SmSc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
if (ObjectREF != -1)
|
|
ObjectREF = SmSc->ObjectsPtrs[ObjectREF]->MeshIndex;
|
|
}
|
|
|
|
if (ObjectREF != -1 && SmSc->MeshesPtrs[ObjectREF])
|
|
{
|
|
for (int MorphIndex=0; MorphIndex<SmSc->MeshesPtrs[ObjectREF]->ulNumberOfTarget; MorphIndex++)
|
|
{
|
|
RETURN_FLOAT(SmSc->MeshesPtrs[ObjectREF]->MorphTargets[MorphIndex].Weight);
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(APP_TimeGet, GetTime,
|
|
CATEGORY(Application) ,
|
|
"Return actual time in milliseconds",
|
|
{
|
|
DWORD curTime = timeGetTime();
|
|
RETURN_INT(curTime); //// A VOIR
|
|
})
|
|
DEFINE_SCRIPT(APP_DateGet,
|
|
CATEGORY(Application) ,
|
|
"Return a string of actual date",
|
|
{
|
|
SYSTEMTIME st;
|
|
GetSystemTime(&st);
|
|
RETURN_DATE(st);
|
|
})
|
|
DEFINE_SCRIPT(APP_CursorHide,
|
|
CATEGORY(Application) PARAM_INT_OPT(ON_OFF, 0),
|
|
"Show or hide WINDOWS cursor",
|
|
{
|
|
ShowCursor(!ON_OFF);
|
|
})
|
|
DEFINE_SCRIPT_REN(APP_Cursor, APP_CursorHand,
|
|
CATEGORY(Application) PARAM_INT_OPT(CursorType, 0) PARAM_STRING_OPT(CursorPath, ""),
|
|
"Show a specified cursor<br/>0 - Standard cursor<br/>1 - Hand cursor<br/>2 - Wait cursor<br/>3 - Resize Cursor NWSE <br/>4 - Resize Cursor NESW <br/>5 - Move Cursor",
|
|
{
|
|
void ChangeCursor(char *cursor);
|
|
void ChangeCursorFromFile(char *cursorPath);
|
|
if (CursorType == 0)
|
|
ChangeCursor(IDC_ARROW);
|
|
if (CursorType == 1)
|
|
ChangeCursor(IDC_HAND);
|
|
if (CursorType == 2)
|
|
ChangeCursor(IDC_WAIT);
|
|
if (CursorType == 3)
|
|
ChangeCursor(IDC_SIZENWSE);
|
|
if (CursorType == 4)
|
|
ChangeCursor(IDC_SIZENESW);
|
|
if (CursorType == 5)
|
|
ChangeCursor(IDC_SIZEALL);
|
|
if (CursorPath && *CursorPath)
|
|
ChangeCursorFromFile(CursorPath);
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(TRK_MeshShow, ShowMesh,
|
|
CATEGORY(Tracking) PARAM_INT_OPT(ON_OFF, -1),
|
|
"Show the tracked mesh... And return the state ",
|
|
{
|
|
if (ID_TABLE[CurrentID])
|
|
{
|
|
if (ON_OFF == -1)
|
|
ID_TABLE[CurrentID]->SF_U.DrawMesh = !ID_TABLE[CurrentID]->SF_U.DrawMesh;
|
|
else
|
|
{
|
|
if (ON_OFF) ID_TABLE[CurrentID]->SF_U.DrawMesh = 1;
|
|
else ID_TABLE[CurrentID]->SF_U.DrawMesh = 0;
|
|
}
|
|
RETURN_BOOL(ID_TABLE[CurrentID]->SF_U.DrawMesh);
|
|
};
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectLookAtSet, SetObjectLookAt,
|
|
CATEGORY(Small Scene) PARAM_AFFECT(Affect) PARAM_SCENE(Smsc) PARAM_STRING(ObjectName) PARAM_STRING_OPT(ObjectLookAt, ""),
|
|
"",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
s32 Number;
|
|
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
{
|
|
MATRIX LookWhat;
|
|
UnicID ObjectREFLA;
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
ObjectREFLA = -1;
|
|
if (*ObjectLookAt != 0)
|
|
{
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectLookAt);
|
|
ObjectREFLA = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREFLA != -1)
|
|
ObjectREFLA = Smsc->ObjectNameDico.mpst_Dico[ObjectREFLA].AssociatedValue;
|
|
};
|
|
ComputeSmallSceneObjectLookAt(Smsc,Affect,ObjectREF,ObjectREFLA);
|
|
}
|
|
})
|
|
#ifndef SKIMMED_NET
|
|
DEFINE_SCRIPT_REN(NET_IDGetSet, Net_GetSetID,
|
|
CATEGORY(Network),
|
|
"Get Network ID and set it as currentID",
|
|
{
|
|
int myIdex = 0;
|
|
|
|
for (u32 netIdx=0; netIdx<32; netIdx++)
|
|
{
|
|
if ((NetObj->ValidMask & 1<<netIdx) &&
|
|
(NetObj->LinkedIP[netIdx].ulIP < NetObj->MyulIP))
|
|
myIdex++;
|
|
}
|
|
CurrentID = myIdex;
|
|
if (ID_TABLE[CurrentID] == NULL)
|
|
ID_New(CurrentID);
|
|
RETURN_INT( CurrentID);
|
|
})
|
|
DEFINE_SCRIPT_REN(NET_IDCount, Net_GetNbID,
|
|
CATEGORY(Network),
|
|
"Get Number of connected machine",
|
|
{
|
|
int nbID = 1; // myID
|
|
|
|
for (u32 netIdx=0; netIdx<32; netIdx++)
|
|
{
|
|
if (NetObj->ValidMask & (1<<netIdx))
|
|
nbID++;
|
|
}
|
|
RETURN_INT( nbID);
|
|
})
|
|
DEFINE_SCRIPT_REN(NET_IPGetFromID, Net_GetIPFromID,
|
|
CATEGORY(Network) PARAM_INT(theID),
|
|
"Get Network IP of a specific ",
|
|
{
|
|
if (theID == CurrentID)
|
|
{ RETURN_STRING( NetObj->MyIP); }
|
|
else
|
|
{
|
|
u32 netIdx;
|
|
u32 netIdxIn;
|
|
if (theID > CurrentID) theID--;
|
|
|
|
for (netIdx=0; netIdx<32; netIdx++)
|
|
{
|
|
if (NetObj->ValidMask & 1<<netIdx)
|
|
{
|
|
int curIPPos = 0;
|
|
for (netIdxIn=0; netIdxIn<32; netIdxIn++)
|
|
{
|
|
if (netIdxIn == netIdx) continue;
|
|
if ((NetObj->ValidMask & 1<<netIdxIn) &&
|
|
(NetObj->LinkedIP[netIdxIn].ulIP < NetObj->LinkedIP[netIdx].ulIP))
|
|
curIPPos++;
|
|
}
|
|
if (curIPPos == theID)
|
|
break;
|
|
}
|
|
}
|
|
char IPBuffer[256];
|
|
sprintf(IPBuffer, "%d.%d.%d.%d", (NetObj->LinkedIP[netIdx].ulIP >> 24) & 0xFF,
|
|
(NetObj->LinkedIP[netIdx].ulIP >> 16) & 0xFF,
|
|
(NetObj->LinkedIP[netIdx].ulIP >> 8) & 0xFF,
|
|
(NetObj->LinkedIP[netIdx].ulIP >> 0) & 0xFF);
|
|
RETURN_STRING(IPBuffer);
|
|
}
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT_REN(APP_CollisionSet, Collision_Set,
|
|
CATEGORY(Application) PARAM_INT(ON_OFF),
|
|
"Set or remove collision process",
|
|
{
|
|
CollisionOn = ON_OFF;
|
|
})
|
|
|
|
#ifndef SKIMMED_NET
|
|
DEFINE_SCRIPT(NET_GetMyIP,
|
|
CATEGORY(Network),
|
|
"return this PC IP as 10.10.10.10",
|
|
{
|
|
RETURN_STRING(NetObj->MyIP);
|
|
})
|
|
#endif
|
|
DEFINE_SCRIPT_REN(SCN_ObjectHideSet, SetHideObject,
|
|
CATEGORY(Small Scene) PARAM_INT(Hide) PARAM_SCENE(Smsc) PARAM_STRING_OPT(ObjectName, "") PARAM_INT_OPT(AffectChildren, 1),
|
|
"Hide or unhide an object and all his son's.<br/>His nothing do it for all",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF;
|
|
ObjectREF = 0;
|
|
if(*ObjectName != 0)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectName);
|
|
if (ObjectREF == -1)
|
|
{
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
}
|
|
if (ObjectREF != -1)
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
} else ObjectREF = 0;
|
|
if (ObjectREF != -1) SmallScene_HideObject(Smsc,ObjectREF,Hide,AffectChildren);
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectHideGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING_OPT(ObjectName, ""),
|
|
"Tell if object is Hidden",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF;
|
|
ObjectREF = 0;
|
|
if(*ObjectName != 0)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectName);
|
|
if (ObjectREF == -1)
|
|
{
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
}
|
|
if (ObjectREF != -1)
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
} else ObjectREF = 0;
|
|
if (ObjectREF != -1)
|
|
{ RETURN_BOOL(Smsc->ObjectsPtrs[ObjectREF]->Flags.HIDEN); }
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_ObjectOriginalPosSet, SetPosObjectOriginal,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING_OPT(ObjectName, ""),
|
|
"Restore an object initial position all his son's.<br/>his nothing do it for all",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
UnicID ObjectREF;
|
|
ObjectREF = 0;
|
|
if(*ObjectName != 0)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectName);
|
|
if (ObjectREF == -1)
|
|
{
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
}
|
|
if (ObjectREF != -1)
|
|
{
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
}
|
|
} else ObjectREF = 0;
|
|
if (ObjectREF != -1) SmallScene_RestoreInitialPosition(Smsc,ObjectREF);
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_ObjectStateSave,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING_OPT(ObjectName, "") PARAM_INT_OPT(index, 0) PARAM_INT_OPT(mask, 7),
|
|
"Save object states<br/>mask : 1- Flags; 2- LocalMatrix; 4- Draworder",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
SmallScene_ObjectStateSave(Smsc, ObjectREF , index, mask);
|
|
})
|
|
DEFINE_SCRIPT(SCN_ObjectStateRestore,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_STRING_OPT(ObjectName, "") PARAM_INT_OPT(index, 0) PARAM_INT_OPT(mask, 7),
|
|
"Restore object states <br/>mask : 1- Flags; 2- LocalMatrix; 4- Draworder",
|
|
{
|
|
char ObjectNameOBJ[2048];
|
|
sprintf(ObjectNameOBJ,"%s.OBJ",ObjectName);
|
|
UnicID ObjectREF;
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(ObjectNameOBJ);
|
|
if (ObjectREF != -1)
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
RETURN_INT(SmallScene_ObjectStateRestore(Smsc, ObjectREF, index, mask));
|
|
})
|
|
DEFINE_SCRIPT_REN(TRK_CameraMove, MoveCam,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_INT(TrackeurID) PARAM_SCENE(Smsc) PARAM_INT_OPT(SmoothModeNumber,0),
|
|
"Warning ! this must be called BEFORE SetTrackMatrix !!",
|
|
{
|
|
int TRID = TrackeurID;
|
|
|
|
if (TRID >= MAX_ID) TRID = MAX_ID-1;
|
|
if (TRID < 0) TRID = 0;
|
|
if (ID_TABLE[TRID])
|
|
{
|
|
if (!ID_TABLE[TRID]->SF_U.Booted || bManualBoot) Affect = 0;
|
|
MoveSceneCamera(SmoothModeNumber, Smsc, Affect, ID_TABLE[TRID]);
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(TRK_PadHandle,
|
|
CATEGORY(Tracking) PARAM_AFFECT(Affect) PARAM_INT(index) PARAM_MATRIX(Matrix) PARAM_INT(SmoothNumber) PARAM_FLOAT(maxAngle),
|
|
"Handle PPJoy",
|
|
{
|
|
char error[2048];
|
|
|
|
void HandlePad(int SmoothNumber, int Affect, MATRIX *pTrckMatrix, float maxAngle, char *error);
|
|
HandlePad(SmoothNumber, Affect, &Matrix, maxAngle, error);
|
|
RETURN_STRING(error);
|
|
})
|
|
DEFINE_SCRIPT(TRK_ResolutionSet,
|
|
CATEGORY(Tracking) PARAM_INT(Resolution),
|
|
"Change track resolution",
|
|
{
|
|
trackSize = Resolution;
|
|
})
|
|
DEFINE_SCRIPT(TRK_FactorTranslationSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(TFactor),
|
|
"Set translation factor multiplier",
|
|
{
|
|
FrmFactorTranslation = TFactor;
|
|
})
|
|
DEFINE_SCRIPT(TRK_FactorRotationSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(RFactor),
|
|
"Set rotation factor multiplier",
|
|
{
|
|
FrmFactorRotation = RFactor;
|
|
})
|
|
DEFINE_SCRIPT(TRK_FactorRotationLimitSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(RLimit),
|
|
"Set rotation factor multiplier",
|
|
{
|
|
FrmFactorRotationLimit = RLimit;
|
|
})
|
|
DEFINE_SCRIPT(TRK_SmoothTranslationSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(TSmooth) PARAM_FLOAT_OPT(THold, 0.0),
|
|
"Set translation smooth factor, number between 0 and 1, 1-> no smooth, 0-> no move",
|
|
{
|
|
FrmSmooth.Translation = TSmooth;
|
|
FrmSmooth.TranslationHold = THold;
|
|
})
|
|
DEFINE_SCRIPT(TRK_SmoothRotationSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(RSmooth),
|
|
"Set rotation smooth factor, default 2, the bigger is the number, the smaller is the smooth",
|
|
{
|
|
FrmSmooth.Rotation = RSmooth;
|
|
})
|
|
DEFINE_SCRIPT(TRK_SmoothQuatSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(QSmooth) PARAM_FLOAT_OPT(QHold, 0.0),
|
|
"Set quat smooth factor, number between 0 and 1, 1-> no smooth, 0-> no rotation<br/>QHold affect non move for small movements, QHold = 1, like 0, no holding, the smaller is QHold the less the rotation is affected",
|
|
{
|
|
FrmSmooth.Quat = QSmooth;
|
|
FrmSmooth.QuatHold = QHold;
|
|
})
|
|
DEFINE_SCRIPT(TRK_SmoothQuatModeSet,
|
|
CATEGORY(Tracking) PARAM_FLOAT(qMode),
|
|
"Set translation smooth factor, number between 0 and 1, 1-> no smooth, 0-> no move",
|
|
{
|
|
FrmQuatMode = qMode;
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_AnimLoad, AnimLoad,
|
|
CATEGORY(Small Scene) PARAM_STRING(AnimName) PARAM_STRING_OPT(Scene, "") PARAM_INT_OPT(ForceReload, 0),
|
|
"If anim does not exist, do nothing.",
|
|
{
|
|
RETURN_BOOL(LoadAnim(AnimName, Scene, ForceReload));
|
|
})
|
|
DEFINE_SCRIPT(SCN_AnimTime,
|
|
CATEGORY(Small Scene) PARAM_STRING(AnimName) PARAM_STRING_OPT(Scene, ""),
|
|
"Return anim time in milliseconds",
|
|
{
|
|
SmallScene *pSmallScene;
|
|
UnicID AnimID;
|
|
char DicoName[1024];
|
|
SmallScene_ANIM *pSmallSceneAnim;
|
|
|
|
pSmallSceneAnim = NULL;
|
|
pSmallScene = SmallNameToScene(Scene);
|
|
sprintf(DicoName, "%s_%s", Scene, AnimName);
|
|
AnimID = AnimDico.IsExist(DicoName);
|
|
if (AnimID == -1)
|
|
AnimID = AnimDico.IsExist(AnimName);
|
|
if (pSmallScene && (AnimID != -1))
|
|
{
|
|
pSmallSceneAnim = &pAllAnims[AnimDico.mpst_Dico[AnimID].AssociatedValue];
|
|
if (pSmallSceneAnim)
|
|
{ RETURN_INT(pSmallSceneAnim->TimeLineInMS*33); }
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(SCN_AnimPlay, AnimPlay,
|
|
CATEGORY(Small Scene) PARAM_STRING(SmscName) PARAM_STRING(AnimName) PARAM_INT_OPT(BaseTime,0) PARAM_FLOAT_OPT(PlayFactor,1),
|
|
"AnimPlay WILL return 1 if anim is finished.<br/>Basetime is the time (in MS) when anim has started.<br/> PlayFactor is the speed",
|
|
{
|
|
s32 DT = timeGetTime() - BaseTime;
|
|
DT *= PlayFactor;
|
|
RETURN_BOOL((BaseTime == 0 ) ||
|
|
PlayAnim(AnimName,SmscName,DT,1.0f));
|
|
})
|
|
DEFINE_SCRIPT(SCN_AnimPlayBlend,
|
|
CATEGORY(Small Scene) PARAM_STRING(SmscName) PARAM_STRING(AnimName) PARAM_FLOAT(BlendFactor) PARAM_INT_OPT(BaseTime,0) PARAM_FLOAT_OPT(PlayFactor,1),
|
|
"AnimPlay WILL return 1 if anim is finished.<br/>Basetime is the time (in MS) when anim has started.<br/> Blend is used for blending with existing position (1 is like playanim).",
|
|
{
|
|
s32 DT = timeGetTime() - BaseTime;
|
|
DT *= PlayFactor;
|
|
RETURN_BOOL((BaseTime == 0 ) ||
|
|
PlayAnim(AnimName,SmscName,DT,BlendFactor));
|
|
})
|
|
DEFINE_SCRIPT(SCN_AnimDestroy,
|
|
CATEGORY(Small Scene) PARAM_STRING(AnimName) PARAM_STRING_OPT(Scene, ""),
|
|
"Delete Anim",
|
|
{
|
|
DestroyAnim(AnimName, Scene);
|
|
})
|
|
DEFINE_SCRIPT_REN(PGEN_Load, PGenerator_Load,
|
|
CATEGORY(Particules generator) PARAM_STRING(Name) PARAM_STRING(GeneratorFileName) PARAM_STRING(SmallSceneName) PARAM_STRING_OPT(SceneObject,"") PARAM_STRING_OPT(MassTexture,""),
|
|
"Load particule generator",
|
|
{
|
|
SIZE grid;
|
|
int ID_Res;
|
|
|
|
grid.cx = 1;
|
|
grid.cy = 1;
|
|
|
|
ID_Res = LoadPGenerator(Name, GeneratorFileName, SmallSceneName, SceneObject,MassTexture);
|
|
if (ID_Res < 0)
|
|
sprintf(LuaErrors, "Error Creating Particule Generator");
|
|
})
|
|
DEFINE_SCRIPT(PGEN_Delete,
|
|
CATEGORY(Particules generator) PARAM_STRING(Name),
|
|
"Delete particule generator",
|
|
{
|
|
DeletePGenerator(Name);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_Save,
|
|
CATEGORY(Particules generator) PARAM_STRING(Name) PARAM_STRING_OPT(newFilename, ""),
|
|
"save particule generator file",
|
|
{
|
|
SavePGenerator(Name, newFilename);
|
|
})
|
|
DEFINE_SCRIPT_REN(PGEN_Process, PGenerator_Process,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_FLOAT_OPT(I_factor,0.0f) PARAM_FLOAT_OPT(J_factor,0.0f) PARAM_FLOAT_OPT(K_factor,0.0f) PARAM_INT_OPT(ProcessOnly, 0),
|
|
"if [Generator Name] = 'All', process all generators",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
ProcessParticules(ID_PGENERATOR[PGeneratorIndex], ProcessOnly, I_factor, J_factor, K_factor);
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
if (!ID_PGENERATOR[pGenIdx]) continue;
|
|
ProcessParticules(ID_PGENERATOR[pGenIdx], ProcessOnly, I_factor, J_factor, K_factor);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_Emit,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_FLOAT_OPT(I_factor,0.0f) PARAM_FLOAT_OPT(J_factor,0.0f) PARAM_FLOAT_OPT(K_factor,0.0f) PARAM_INT_OPT(Life, 0),
|
|
"Emit a single particle and return it's index, the particle will have specified life in ms",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
RETURN_INT(EmitParticule(ID_PGENERATOR[PGeneratorIndex], Life, I_factor, J_factor, K_factor));
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
if (!ID_PGENERATOR[pGenIdx]) continue;
|
|
EmitParticule(ID_PGENERATOR[pGenIdx], Life, I_factor, J_factor, K_factor);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_EmitFromPos,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_VECTOR(AbsoluteOrigin) PARAM_VECTOR(AbsoluteDirection) PARAM_INT_OPT(Life, 0),
|
|
"Emit a single particle at the specified position and direction and return it's index",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
RETURN_INT(EmitParticule(ID_PGENERATOR[PGeneratorIndex], Life, 0.0, 0.0, 0.0, &AbsoluteOrigin, &AbsoluteDirection));
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
if (!ID_PGENERATOR[pGenIdx]) continue;
|
|
EmitParticule(ID_PGENERATOR[pGenIdx], Life, 0.0, 0.0, 0.0, &AbsoluteOrigin, &AbsoluteDirection);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(PGEN_Render, PGenerator_Render,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_STRING_OPT(SmallSceneName,""),
|
|
"if [Generator Name] = 'All', process all generators",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
RenderParticules(ID_PGENERATOR[PGeneratorIndex], SmallSceneName);
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
if (!ID_PGENERATOR[pGenIdx]) continue;
|
|
RenderParticules(ID_PGENERATOR[pGenIdx], SmallSceneName);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_Restart,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT_OPT(forceReinit, 0),
|
|
"if [Generator Name] = 'All', restart all generators",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
{
|
|
if (!forceReinit)
|
|
{
|
|
memset( ID_PGENERATOR[PGeneratorIndex]->particulesTab, 0,
|
|
ID_PGENERATOR[PGeneratorIndex]->maxParticules*sizeof(Particules));
|
|
ID_PGENERATOR[PGeneratorIndex]->nbParticules = 0;
|
|
ID_PGENERATOR[PGeneratorIndex]->curParticule = -1;
|
|
} else
|
|
{
|
|
ID_PGENERATOR[PGeneratorIndex]->Init();
|
|
ComputeParticleOptions(ID_PGENERATOR[PGeneratorIndex]);
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
if (!ID_PGENERATOR[pGenIdx]) continue;
|
|
if (!forceReinit)
|
|
{
|
|
memset( ID_PGENERATOR[pGenIdx]->particulesTab, 0,
|
|
ID_PGENERATOR[pGenIdx]->maxParticules*sizeof(Particules));
|
|
ID_PGENERATOR[pGenIdx]->nbParticules = 0;
|
|
ID_PGENERATOR[pGenIdx]->curParticule = -1;
|
|
} else
|
|
{
|
|
ID_PGENERATOR[pGenIdx]->Init();
|
|
ComputeParticleOptions(ID_PGENERATOR[pGenIdx]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticlePosGet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index),
|
|
"Get Particle position",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (Index < ID_PGENERATOR[PGeneratorIndex]->nbParticules &&
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].alive)
|
|
{
|
|
RETURN_VECTOR(&ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].coordsDest);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticlePosSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index) PARAM_VECTOR(coords) PARAM_INT_OPT(inSource, 0),
|
|
"Get Particle position",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (Index < ID_PGENERATOR[PGeneratorIndex]->nbParticules &&
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].alive)
|
|
{
|
|
if (inSource)
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].coords = coords;
|
|
else
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].coordsDest = coords;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticleSpeedGet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index),
|
|
"Get Particle position",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (Index < ID_PGENERATOR[PGeneratorIndex]->nbParticules &&
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].alive)
|
|
{
|
|
RETURN_VECTOR(&ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].speedDest);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticleSpeedSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index) PARAM_VECTOR(speed) PARAM_INT_OPT(inSource, 0),
|
|
"Get Particle position",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (Index < ID_PGENERATOR[PGeneratorIndex]->nbParticules &&
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].alive)
|
|
{
|
|
if (inSource)
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].speed = speed;
|
|
else
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].speedDest = speed;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticleCollideCallbackAdd,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index) PARAM_STRING(CallbackName),
|
|
"Add callback to specific particle when collide, Callback type:<br/> MyCallback(SceneName, ObjectName, AbsolutePos, AbsoluteNormal, UV)",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (Index < ID_PGENERATOR[PGeneratorIndex]->maxParticules)
|
|
{
|
|
if (ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].luaCollideCallBack)
|
|
{
|
|
CC_free(ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].luaCollideCallBack);
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].luaCollideCallBack = NULL;
|
|
}
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].luaCollideCallBack = (char *)CC_malloc(strlen(CallbackName)+1);
|
|
strcpy(ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].luaCollideCallBack, CallbackName);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticleAliveTest,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index),
|
|
"Verify if particle is alive",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (Index < ID_PGENERATOR[PGeneratorIndex]->nbParticules)
|
|
{
|
|
RETURN_BOOL(ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].alive)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_ParticleKill,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(Index),
|
|
"Kill selected Particle, if -1 kills all living particles, if -2 kill all livings particles and stop generation (if no repeat)",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
{
|
|
if (Index >= 0)
|
|
{
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[Index].alive = 0;
|
|
} else
|
|
{
|
|
for (int i=0; i<ID_PGENERATOR[PGeneratorIndex]->maxParticules; i++)
|
|
{
|
|
ID_PGENERATOR[PGeneratorIndex]->particulesTab[i].alive = 0;
|
|
}
|
|
if (Index < -1)
|
|
{
|
|
ID_PGENERATOR[PGeneratorIndex]->nbParticules = ID_PGENERATOR[PGeneratorIndex]->maxParticules;
|
|
}
|
|
}
|
|
}
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
if (!ID_PGENERATOR[pGenIdx]) continue;
|
|
if (Index >= 0)
|
|
{
|
|
ID_PGENERATOR[pGenIdx]->particulesTab[Index].alive = 0;
|
|
} else
|
|
{
|
|
for (int i=0; i<ID_PGENERATOR[pGenIdx]->maxParticules; i++)
|
|
{
|
|
ID_PGENERATOR[pGenIdx]->particulesTab[i].alive = 0;
|
|
}
|
|
if (Index < -1)
|
|
{
|
|
ID_PGENERATOR[pGenIdx]->nbParticules = ID_PGENERATOR[pGenIdx]->maxParticules;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_RepeatSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_INT(ON_OFF),
|
|
"Set or Remove particle repeat mode",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorName, "all"))
|
|
{
|
|
if (GetPGeneratorFromString(GeneratorNameIn, &PGeneratorIndex))
|
|
{
|
|
ID_PGENERATOR[PGeneratorIndex]->particuleRepeat = ON_OFF;
|
|
}
|
|
} else
|
|
{
|
|
for (int pGenIdx=0; pGenIdx<MAX_PGENERATOR; pGenIdx++)
|
|
{
|
|
ID_PGENERATOR[pGenIdx]->particuleRepeat = ON_OFF;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_OptionsSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Options",
|
|
{
|
|
Pgen->options = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_OptionsGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Options",
|
|
{
|
|
RETURN_INT(Pgen->options);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_TextureGridSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value1) PARAM_INT(Value2),
|
|
"Set Particules generator config Texture Grid",
|
|
{
|
|
Pgen->TextureGrid.cx = Value1;
|
|
Pgen->TextureGrid.cy = Value2;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_TextureGridGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Texture Grid",
|
|
{
|
|
RETURN_INT(Pgen->TextureGrid.cx);
|
|
RETURN_INT(Pgen->TextureGrid.cy);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_BlendModeSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Blend Mode",
|
|
{
|
|
Pgen->BlendMode = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_BlendModeGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Blend Mode",
|
|
{
|
|
RETURN_INT(Pgen->BlendMode);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AlphaThresholdSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Alpha Threshold",
|
|
{
|
|
Pgen->AlphaThreshold = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AlphaThresholdGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Alpha Threshold",
|
|
{
|
|
RETURN_INT(Pgen->AlphaThreshold);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleNumberSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules total number",
|
|
{
|
|
Pgen->maxParticules = Value;
|
|
if (Pgen->particulesTab)
|
|
Pgen->particulesTab = (Particules *)CC_realloc(Pgen->particulesTab, Value*sizeof(Particules));
|
|
else
|
|
Pgen->particulesTab = (Particules *)CC_malloc(Value*sizeof(Particules));
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleNumberGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules total number",
|
|
{
|
|
RETURN_INT(Pgen->maxParticules);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleLifeSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules life in ms",
|
|
{
|
|
Pgen->particuleLife = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleLifeGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules life in ms",
|
|
{
|
|
RETURN_INT(Pgen->particuleLife);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleRepeatSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules life in ms",
|
|
{
|
|
Pgen->particuleRepeat = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleRepeatGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules life in ms",
|
|
{
|
|
RETURN_INT(Pgen->particuleRepeat);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleLifeRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules life random",
|
|
{
|
|
Pgen->particuleLifeRand = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_ParticuleLifeRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules life random",
|
|
{
|
|
RETURN_FLOAT(Pgen->particuleLifeRand);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenSpeedSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation speed",
|
|
{
|
|
Pgen->genSpeed = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenSpeedGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation speed",
|
|
{
|
|
RETURN_FLOAT(Pgen->genSpeed);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenSpeedRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation speed random",
|
|
{
|
|
Pgen->genSpeedRand = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenSpeedRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation speed random",
|
|
{
|
|
RETURN_FLOAT(Pgen->genSpeedRand);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenAngleAllowedSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation angle",
|
|
{
|
|
Pgen->genAngleAllowed = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenAngleAllowedGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation angle",
|
|
{
|
|
RETURN_FLOAT(Pgen->genAngleAllowed);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenPowerSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation power",
|
|
{
|
|
Pgen->genPower = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenPowerGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation power",
|
|
{
|
|
RETURN_FLOAT(Pgen->genPower);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenPowerRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation power random",
|
|
{
|
|
Pgen->genPowerRand = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenPowerRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation power random",
|
|
{
|
|
RETURN_FLOAT(Pgen->genPowerRand);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenWidthSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation width",
|
|
{
|
|
Pgen->genWidth = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenWidthGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation width",
|
|
{
|
|
RETURN_FLOAT(Pgen->genWidth);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenHeightSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config generation height",
|
|
{
|
|
Pgen->genHeight = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenHeightGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation height",
|
|
{
|
|
RETURN_FLOAT(Pgen->genHeight);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenSizeRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config random size",
|
|
{
|
|
Pgen->genSizeRand = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenSizeRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config random size",
|
|
{
|
|
RETURN_FLOAT(Pgen->genSizeRand);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenNumberSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config generation number",
|
|
{
|
|
Pgen->genNumber = Value;
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GenNumberGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config generation number",
|
|
{
|
|
RETURN_INT(Pgen->genNumber);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GravitySet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_VECTOR(Value),
|
|
"Set Particules generator config Gravity",
|
|
{
|
|
Pgen->forces.Gravity = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GravityGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Gravity",
|
|
{
|
|
RETURN_VECTOR(&Pgen->forces.Gravity);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_FrictionsSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Frictions",
|
|
{
|
|
Pgen->forces.Frictions = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FrictionsGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Frictions",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.Frictions);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_WindDirectionSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_VECTOR(Value),
|
|
"Set Particules generator config Wind Direction",
|
|
{
|
|
Pgen->forces.WindDirection = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_WindDirectionGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Wind Direction",
|
|
{
|
|
RETURN_VECTOR(&Pgen->forces.WindDirection);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_WindForceSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Wind Force",
|
|
{
|
|
Pgen->forces.WindForce = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_WindForceGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Wind Force",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.WindForce);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_RotationSpeedSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Rotation Speed",
|
|
{
|
|
Pgen->forces.RotationSpeed = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_RotationSpeedGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Rotation Speed",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.RotationSpeed);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_RotationRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Rotation Random",
|
|
{
|
|
Pgen->forces.RotationRand = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_RotationRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Rotation Random",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.RotationRand);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_RotationInitSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value1) PARAM_FLOAT(Value2),
|
|
"Set Particules generator config ",
|
|
{
|
|
Pgen->forces.RotationInit = Value1;
|
|
Pgen->forces.RotationInit2 = Value2;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_RotationInitGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config ",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.RotationInit);
|
|
RETURN_FLOAT(Pgen->forces.RotationInit2);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForTimeSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Grow For Time",
|
|
{
|
|
Pgen->forces.GrowFor = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForTimeGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For Time",
|
|
{
|
|
RETURN_INT(Pgen->forces.GrowFor);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForInitSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Grow For Init",
|
|
{
|
|
Pgen->forces.GrowForInit = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForInitGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For Init",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.GrowForInit);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForEndSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Grow For End",
|
|
{
|
|
Pgen->forces.GrowForEnd = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForEndGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For End",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.GrowForEnd);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForTimeRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Grow For Time Random",
|
|
{
|
|
Pgen->forces.GrowForRand = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForTimeRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For Time Random",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.GrowForRand);
|
|
})
|
|
|
|
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForTimeSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Fade For Time",
|
|
{
|
|
Pgen->forces.FadeFor = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForTimeGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For Time",
|
|
{
|
|
RETURN_INT(Pgen->forces.FadeFor);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForInitSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Fade For Init",
|
|
{
|
|
Pgen->forces.FadeForInit = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForInitGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For Init",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.FadeForInit);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForEndSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Fade For End",
|
|
{
|
|
Pgen->forces.FadeForEnd = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForEndGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For End",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.FadeForEnd);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForTimeRandSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config Fade For Time Random",
|
|
{
|
|
Pgen->forces.FadeForRand = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForTimeRandGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For Time Random",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.FadeForRand);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForColorTimeSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Grow For Color Time",
|
|
{
|
|
Pgen->forces.GrowForColor = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForColorTimeGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For Color Time",
|
|
{
|
|
RETURN_INT(Pgen->forces.GrowForColor);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForColorInitSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_COLOR(Value),
|
|
"Set Particules generator config Grow For Color Init",
|
|
{
|
|
Value = ARGB2ABGR(Value);
|
|
Pgen->forces.GrowForColorInit = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForColorInitGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For Color Init",
|
|
{
|
|
RETURN_COLOR(Pgen->forces.GrowForColorInit);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForColorEndSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_COLOR(Value),
|
|
"Set Particules generator config Grow For Color End",
|
|
{
|
|
Value = ARGB2ABGR(Value);
|
|
Pgen->forces.GrowForColorEnd = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_GrowForColorEndGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Grow For Color End",
|
|
{
|
|
RETURN_COLOR(Pgen->forces.GrowForColorEnd);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForColorTimeSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Fade For Color Time",
|
|
{
|
|
Pgen->forces.FadeForColor = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForColorTimeGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For Color Time",
|
|
{
|
|
RETURN_INT(Pgen->forces.FadeForColor);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForColorInitSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_COLOR(Value),
|
|
"Set Particules generator config Fade For Color Init",
|
|
{
|
|
Value = ARGB2ABGR(Value);
|
|
Pgen->forces.FadeForColorInit = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForColorInitGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For Color Init",
|
|
{
|
|
RETURN_COLOR(Pgen->forces.FadeForColorInit);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForColorEndSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_COLOR(Value),
|
|
"Set Particules generator config Fade For Color End",
|
|
{
|
|
Value = ARGB2ABGR(Value);
|
|
Pgen->forces.FadeForColorEnd = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_FadeForColorEndGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Fade For Color End",
|
|
{
|
|
RETURN_COLOR(Pgen->forces.FadeForColorEnd);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_AnimSpeedSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Anim Speed",
|
|
{
|
|
Pgen->forces.AnimSpeed = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AnimSpeedGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Anim Speed",
|
|
{
|
|
RETURN_INT(Pgen->forces.AnimSpeed);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AnimRepeatSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config Anim Repeat",
|
|
{
|
|
Pgen->forces.AnimRepeat = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AnimRepeatGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config Anim Repeat",
|
|
{
|
|
RETURN_INT(Pgen->forces.AnimRepeat);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AnimInitSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_INT(Value),
|
|
"Set Particules generator config AnimInit",
|
|
{
|
|
Pgen->forces.AnimInit = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_AnimInitGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config AnimInit",
|
|
{
|
|
RETURN_INT(Pgen->forces.AnimInit);
|
|
})
|
|
|
|
DEFINE_SCRIPT(PGEN_CONF_CollisionFrictionSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config collision Friction",
|
|
{
|
|
Pgen->forces.collisionFriction = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_CollisionFrictionGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config collision Friction",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.collisionFriction);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_CollisionRandAngleSet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen) PARAM_FLOAT(Value),
|
|
"Set Particules generator config collision Random Angle",
|
|
{
|
|
Pgen->forces.collisionRandAngle = Value;
|
|
})
|
|
DEFINE_SCRIPT(PGEN_CONF_CollisionRandAngleGet,
|
|
CATEGORY(Particules generator config) PARAM_PGENERATOR(Pgen),
|
|
"Get Particules generator config collision Random Angle",
|
|
{
|
|
RETURN_FLOAT(Pgen->forces.collisionRandAngle);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(APP_ApplicationPathGet,
|
|
CATEGORY(Application),
|
|
"Get the application path",
|
|
{
|
|
int nArgs;
|
|
LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
|
size_t size = wcslen(szArglist[0])+1;
|
|
char* exepathname = (char*)ZeroAlloc(size);
|
|
wcstombs(exepathname, szArglist[0], size);
|
|
|
|
RETURN_STRING(exepathname);
|
|
})
|
|
DEFINE_SCRIPT(PGEN_MediaGet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName),
|
|
"Set or Remove particle media",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
RETURN_STRING(ID_PGENERATOR[PGeneratorIndex]->MediaName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_MediaSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_STRING(media),
|
|
"Set or Remove particle media",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
u32 PMediaIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (GetMediaFromString(ID_PGENERATOR[PGeneratorIndex]->MediaName, &PMediaIndex))
|
|
DestroyMedia(PMediaIndex);
|
|
CreateMedia(media, 0);
|
|
strcpy(ID_PGENERATOR[PGeneratorIndex]->MediaName, media);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_MassTextureGet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName),
|
|
"Set or Remove particle mass media",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
RETURN_STRING(ID_PGENERATOR[PGeneratorIndex]->MassTextureName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_MassTextureSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_STRING(media),
|
|
"Set or Remove particle mass media",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
u32 PMediaIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
if (*ID_PGENERATOR[PGeneratorIndex]->MassTextureName &&
|
|
GetMediaFromString(ID_PGENERATOR[PGeneratorIndex]->MassTextureName, &PMediaIndex))
|
|
DestroyMedia(PMediaIndex);
|
|
if (*media)
|
|
CreateMedia(media, 0);
|
|
strcpy(ID_PGENERATOR[PGeneratorIndex]->MassTextureName, media);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_SceneGet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName),
|
|
"Get particle scene",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
RETURN_STRING(ID_PGENERATOR[PGeneratorIndex]->SceneName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_SceneSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_STRING(scene),
|
|
"Set particle scene",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
strcpy(ID_PGENERATOR[PGeneratorIndex]->SceneName, scene);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_SceneObjectGet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName),
|
|
"Get particle scene object",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
RETURN_STRING(ID_PGENERATOR[PGeneratorIndex]->ObjectName);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_SceneObjectSet,
|
|
CATEGORY(Particules generator) PARAM_STRING(GeneratorName) PARAM_STRING(object),
|
|
"Set particle scene object",
|
|
{
|
|
u32 PGeneratorIndex;
|
|
if (GetPGeneratorFromString(GeneratorName, &PGeneratorIndex))
|
|
{
|
|
strcpy(ID_PGENERATOR[PGeneratorIndex]->ObjectName, object);
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PGEN_PGRExplore,
|
|
CATEGORY(Small Scene) PARAM_STRING(PGRFile),
|
|
"Open PGR file",
|
|
{
|
|
char PGR[2048];
|
|
char TEXT[2048];
|
|
char TEXT2[2048];
|
|
FILE *F;
|
|
|
|
strcpy(PGR, PGRFile);
|
|
if (GetFileNameExtend(PGR) != '.PGR')
|
|
strcat(PGR, ".PGR");
|
|
|
|
sprintf(TEXT,".\\Particles\\%s", PGR);
|
|
F = fopen(TEXT,"rb");
|
|
if (F)
|
|
{
|
|
fclose(F);
|
|
sprintf(TEXT2,"CMD /C START %s", TEXT);
|
|
WinExec(TEXT2,SW_HIDE);
|
|
}
|
|
})
|
|
|
|
|
|
|
|
DEFINE_SCRIPT(FUR_Load,
|
|
CATEGORY(Fur generator) PARAM_STRING(Name) PARAM_STRING(GeneratorFileName) PARAM_STRING(SmallSceneName) PARAM_STRING_OPT(SceneObject,""),
|
|
"Load fur generator",
|
|
{
|
|
if (LoadFur(Name, GeneratorFileName, SmallSceneName, SceneObject) < 0)
|
|
sprintf(LuaErrors, "Error Creating Particule Generator");
|
|
})
|
|
DEFINE_SCRIPT(FUR_Delete,
|
|
CATEGORY(Fur generator) PARAM_STRING(Name),
|
|
"Delete fur generator",
|
|
{
|
|
DeleteFur(Name);
|
|
})
|
|
DEFINE_SCRIPT(FUR_Save,
|
|
CATEGORY(Fur generator) PARAM_STRING(Name) PARAM_STRING_OPT(newFilename, "") PARAM_INT_OPT(fullPath, 0),
|
|
"save particule generator file",
|
|
{
|
|
SaveFur(Name, newFilename, fullPath);
|
|
})
|
|
DEFINE_SCRIPT(FUR_Render,
|
|
CATEGORY(Fur generator) PARAM_STRING(GeneratorName) PARAM_STRING_OPT(SmallSceneName,""),
|
|
"if [Generator Name] = 'All', process all furs",
|
|
{
|
|
u32 FurIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
//if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetFurFromString(GeneratorNameIn, &FurIndex))
|
|
RenderFur(ID_FUR[FurIndex], SmallSceneName);
|
|
} else
|
|
{
|
|
for (int furIdx=0; furIdx<MAX_FUR; furIdx++)
|
|
{
|
|
if (!ID_FUR[furIdx]) continue;
|
|
RenderFur(ID_FUR[furIdx], SmallSceneName);
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_Restart,
|
|
CATEGORY(Fur generator) PARAM_STRING(GeneratorName),
|
|
"if [Generator Name] = 'All', process all furs",
|
|
{
|
|
u32 FurIndex;
|
|
char GeneratorNameIn[2048];
|
|
strcpy(GeneratorNameIn, GeneratorName);
|
|
strlwr(GeneratorNameIn);
|
|
|
|
//if (!(SkipFunctions & SKIP_PARTICLES))
|
|
{
|
|
if (strcmp(GeneratorNameIn, "all"))
|
|
{
|
|
if (GetFurFromString(GeneratorNameIn, &FurIndex))
|
|
{
|
|
ID_FUR[FurIndex]->Init();
|
|
RETURN_BOOL(1);
|
|
} else
|
|
{
|
|
RETURN_BOOL(0);
|
|
}
|
|
} else
|
|
{
|
|
for (int furIdx=0; furIdx<MAX_PGENERATOR; furIdx++)
|
|
{
|
|
if (!ID_FUR[furIdx]) continue;
|
|
ID_FUR[furIdx]->Init();
|
|
}
|
|
}
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(FUR_Debug,
|
|
CATEGORY(Fur generator) PARAM_INT_OPT(debug,1),
|
|
"Draw debug info",
|
|
{
|
|
FurDebug = debug;
|
|
})
|
|
DEFINE_SCRIPT(FUR_GeneratorSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_STRING(GeneratorName),
|
|
"Set Fur generator Generator",
|
|
{
|
|
strcpy(Fur->GeneratorName, GeneratorName);
|
|
ComputeFurOptions(Fur);
|
|
})
|
|
DEFINE_SCRIPT(FUR_GeneratorGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator Generator",
|
|
{
|
|
RETURN_STRING(Fur->GeneratorName);
|
|
})
|
|
DEFINE_SCRIPT(FUR_SceneSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_STRING(SceneName),
|
|
"Set Fur generator Scene",
|
|
{
|
|
strcpy(Fur->SceneName, SceneName);
|
|
ComputeFurOptions(Fur);
|
|
})
|
|
DEFINE_SCRIPT(FUR_SceneGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator Scene",
|
|
{
|
|
RETURN_STRING(Fur->SceneName);
|
|
})
|
|
DEFINE_SCRIPT(FUR_ObjectSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_STRING(ObjectName),
|
|
"Set Fur generator Object",
|
|
{
|
|
strcpy(Fur->ObjectName, ObjectName);
|
|
ComputeFurOptions(Fur);
|
|
})
|
|
DEFINE_SCRIPT(FUR_ObjectGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator Object",
|
|
{
|
|
RETURN_STRING(Fur->ObjectName);
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_ModeSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_INT(Value),
|
|
"Set Fur generator config Mode",
|
|
{
|
|
Fur->Mode = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_ModeGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config Mode",
|
|
{
|
|
RETURN_INT(Fur->Mode);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_NbElmtSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_INT(Value),
|
|
"Set Fur generator config nbFurElmt",
|
|
{
|
|
Fur->nbFurElmt = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_NbElmtGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config nbFurElmt",
|
|
{
|
|
RETURN_INT(Fur->nbFurElmt);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteTextureMatNameSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_STRING(Value),
|
|
"Set Fur generator config SpriteTextureMatName",
|
|
{
|
|
SetFurMaterial(Fur, Value);
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteTextureMatNameGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpriteTextureMatName",
|
|
{
|
|
RETURN_STRING(Fur->SpriteTextureMatName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_MassTextureNameSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_STRING(Value),
|
|
"Set Fur generator config MassTextureName",
|
|
{
|
|
strcpy(Fur->MassTextureName, Value);
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_MassTextureNameGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config MassTextureName",
|
|
{
|
|
RETURN_STRING(Fur->MassTextureName);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteWidthSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config SpriteWidth",
|
|
{
|
|
Fur->SpriteWidth = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteWidthGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpriteWidth",
|
|
{
|
|
RETURN_FLOAT(Fur->SpriteWidth);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteWidthRandSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config SpriteWidthRand",
|
|
{
|
|
Fur->SpriteWidthRand = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteWidthRandGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpriteWidthRand",
|
|
{
|
|
RETURN_FLOAT(Fur->SpriteWidthRand);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteHeightSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config SpriteHeight",
|
|
{
|
|
Fur->SpriteHeight = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteHeightGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpriteHeight",
|
|
{
|
|
RETURN_FLOAT(Fur->SpriteHeight);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteHeightRandSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config SpriteHeightRand",
|
|
{
|
|
Fur->SpriteHeightRand = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteHeightRandGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpriteHeightRand",
|
|
{
|
|
RETURN_FLOAT(Fur->SpriteHeightRand);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpritePositionSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config SpritePosition",
|
|
{
|
|
Fur->SpritePosition = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpritePositionGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpritePosition",
|
|
{
|
|
RETURN_FLOAT(Fur->SpritePosition);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteLevelsSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_INT(Value),
|
|
"Set Fur generator config SpriteLevels",
|
|
{
|
|
Fur->SpriteLevels = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_SpriteLevelsGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config SpriteLevels",
|
|
{
|
|
RETURN_INT(Fur->SpriteLevels);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_OrientationStrenghSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config OrientationStrengh",
|
|
{
|
|
Fur->OrientationStrengh = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_OrientationStrenghGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config OrientationStrengh",
|
|
{
|
|
RETURN_FLOAT(Fur->OrientationStrengh);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_ElasticitySet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config Elasticity",
|
|
{
|
|
Fur->OrientationMeca.elasticity = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_ElasticityGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config Elasticity",
|
|
{
|
|
RETURN_FLOAT(Fur->OrientationMeca.elasticity);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_FrictionSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_FLOAT(Value),
|
|
"Set Fur generator config Friction",
|
|
{
|
|
Fur->OrientationMeca.friction = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_FrictionGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config Friction",
|
|
{
|
|
RETURN_FLOAT(Fur->OrientationMeca.friction);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_NbOrientationSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_INT(Value),
|
|
"Set Fur generator config nbOrientation",
|
|
{
|
|
if (Value > 0)
|
|
{
|
|
if (Fur->OrientationList)
|
|
Fur->OrientationList = (Vector *)CC_realloc(Fur->OrientationList, Value*sizeof(Vector));
|
|
else
|
|
Fur->OrientationList = (Vector *)CC_malloc(Value*sizeof(Vector));
|
|
} else
|
|
if (Fur->OrientationList)
|
|
{
|
|
CC_free(Fur->OrientationList);
|
|
Fur->OrientationList = NULL;
|
|
}
|
|
if (Fur->nbOrientation < Value)
|
|
memset(Fur->OrientationList + Fur->nbOrientation, 0, (Value-Fur->nbOrientation)*sizeof(Vector));
|
|
Fur->nbOrientation = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_NbOrientationGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur),
|
|
"Get Fur generator config nbOrientation",
|
|
{
|
|
RETURN_FLOAT(Fur->nbOrientation);
|
|
})
|
|
|
|
DEFINE_SCRIPT(FUR_CONF_OrientationSet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_INT(index) PARAM_VECTOR(Value),
|
|
"Set Fur generator config Orientation",
|
|
{
|
|
if (index < Fur->nbOrientation)
|
|
Fur->OrientationList[index] = Value;
|
|
})
|
|
DEFINE_SCRIPT(FUR_CONF_OrientationGet,
|
|
CATEGORY(Fur generator config) PARAM_FUR(Fur) PARAM_INT(index),
|
|
"Get Fur generator config Orientation",
|
|
{
|
|
if (index < Fur->nbOrientation)
|
|
{ RETURN_VECTOR(&Fur->OrientationList[index]);}
|
|
})
|
|
|
|
DEFINE_SCRIPT(PICK_EpsilonSet,
|
|
CATEGORY(Picking) PARAM_FLOAT(Epsilon),
|
|
"Change picking Z tolerance",
|
|
{
|
|
extern float PIKING_EPSILLON;
|
|
PIKING_EPSILLON = Epsilon;
|
|
})
|
|
DEFINE_SCRIPT(PICK_EpsilonGet,
|
|
CATEGORY(Picking),
|
|
"Get current picking Z tolerance",
|
|
{
|
|
extern float PIKING_EPSILLON;
|
|
RETURN_FLOAT(PIKING_EPSILLON);
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(PICK_FlagSet, PICK_SetFlag,CATEGORY(Picking) PARAM_STRING(FlagName),"If the name is not empty and different than '0', enable picking (!! Time consuming !! )<br/>This Flag allow you to know when picking happen",
|
|
{
|
|
if (*FlagName == 0 || !strcmp(FlagName, "0") || (SkipFunctions & SKIP_PICKING))
|
|
{
|
|
*PickReportCurrent.PickingClass = 0;
|
|
DI->PickingEnable = 0;
|
|
} else
|
|
{
|
|
strcpy(PickReportCurrent.PickingClass, FlagName);
|
|
DI->PickingEnable = hasFocus;
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(PICK_FlagGet, PICK_GetFlag,CATEGORY(Picking),"Return the pick flag active when picking occurs",
|
|
{
|
|
RETURN_STRING(PickReportToWatch.PickingClass);
|
|
})
|
|
DEFINE_SCRIPT(PICK_FlagCurrentGet,CATEGORY(Picking),"Return the pick flag active when picking occurs",
|
|
{
|
|
RETURN_STRING(PickReportResult.PickingClass);
|
|
})
|
|
DEFINE_SCRIPT(PICK_CaptureSet,CATEGORY(Picking) PARAM_INT(OnOff),"Force to keep focus if 1, even if mouse is outside the main window. 0 will release this option",
|
|
{
|
|
extern void WINMAIN_SETCAPTURE(u32 OnOff);
|
|
CaptureMode = OnOff && *PickReportFinal.PickingClass;
|
|
WINMAIN_SETCAPTURE(CaptureMode);
|
|
})
|
|
DEFINE_SCRIPT(PICK_CoordLocalGet,CATEGORY(Picking),"If a small scene has been picked, return LOCAL XYZ else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedSmallSceneGameObjectName[0])
|
|
{ RETURN_VECTOR(&PickReportToWatch.PickingCoordXYZ_Local); }
|
|
})
|
|
DEFINE_SCRIPT(PICK_CoordGlobalGet,CATEGORY(Picking),"If a small scene has been picked, return GLOBAL XYZ else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedSmallSceneGameObjectName[0])
|
|
{ RETURN_VECTOR(&PickReportToWatch.PickingCoordXYZ_Global); }
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(PICK_SmallSceneNameGet, PICK_GetSmallSceneName,CATEGORY(Picking),"If a small scene has been picked, return SmallScene Name, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedSmallSceneName[0])
|
|
{ RETURN_STRING(PickReportToWatch.CollidedSmallSceneName); }
|
|
})
|
|
DEFINE_SCRIPT_REN(PICK_SmallSceneObjectNameGet, PICK_GetSmallSceneObjectName,CATEGORY(Picking),"If a small scene has been picked, return SmallScene Object Name, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedSmallSceneGameObjectName[0])
|
|
{ RETURN_STRING(PickReportToWatch.CollidedSmallSceneGameObjectName); }
|
|
})
|
|
DEFINE_SCRIPT(PICK_SmallMaterialNameGet,CATEGORY(Picking),"If a small scene has been picked, return SmallScene Material Name, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedSmallMaterialName[0])
|
|
{ RETURN_STRING(PickReportToWatch.CollidedSmallMaterialName); }
|
|
})
|
|
|
|
DEFINE_SCRIPT(SCN_PointScreenToScene,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_VECTOR(ScreenPoint) ,
|
|
"Transform screen point into the smallescene coordinate",
|
|
{
|
|
ScreenPoint = ScreenPointToScene(Smsc, ScreenPoint);
|
|
RETURN_VECTOR(&ScreenPoint);
|
|
})
|
|
DEFINE_SCRIPT(SCN_PointSceneToScreen,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_VECTOR(ScenePoint) ,
|
|
"Transform screen point into the smallescene coordinate",
|
|
{
|
|
ScenePoint = ScenePointToScreen(Smsc, ScenePoint);
|
|
RETURN_VECTOR(&ScenePoint);
|
|
})
|
|
DEFINE_SCRIPT_REN(PICK_MediaNameGet, PICK_GetPickedMediaName,CATEGORY(Picking),"If a media was associated to the picking return his name, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedMap)
|
|
{
|
|
if (PickReportToWatch.CollidedMediaName[0] == 0)
|
|
{
|
|
for (u32 Counter = 0 ; Counter < MAX_INPMED ; Counter++)
|
|
{
|
|
if (ID_MEDIA[Counter] && (&ID_MEDIA[Counter]->Image == PickReportToWatch.CollidedMap))
|
|
{
|
|
strcpy((char*)PickReportToWatch.CollidedMediaName,(char*)ID_MEDIA[Counter]->MediaName);
|
|
Counter = MAX_INPMED;
|
|
}
|
|
}
|
|
}
|
|
if (PickReportToWatch.CollidedMediaName[0] == 0)
|
|
PickReportToWatch.CollidedMap = NULL;
|
|
else
|
|
{ RETURN_STRING(PickReportToWatch.CollidedMediaName); }
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(PICK_MediaNicknameGet,CATEGORY(Picking),"If a media was associated to the picking return his nickname, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedMap)
|
|
{
|
|
if (PickReportToWatch.CollidedMediaNickname[0] == 0)
|
|
{
|
|
for (u32 Counter = 0 ; Counter < MAX_INPMED ; Counter++)
|
|
{
|
|
if (ID_MEDIA[Counter] && (&ID_MEDIA[Counter]->Image == PickReportToWatch.CollidedMap))
|
|
{
|
|
strcpy((char*)PickReportToWatch.CollidedMediaNickname,(char*)ID_MEDIA[Counter]->Nickname);
|
|
Counter = MAX_INPMED;
|
|
}
|
|
}
|
|
}
|
|
if (PickReportToWatch.CollidedMediaNickname[0] != 0)
|
|
{ RETURN_STRING(PickReportToWatch.CollidedMediaNickname); }
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(PICK_ColorGet, PICK_GetColor,CATEGORY(Picking),"If a media was associated to the picking, return the color of the pick, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedMap)
|
|
{
|
|
if (PickReportToWatch.CollidedMediaName[0] == 0)
|
|
{
|
|
for (u32 Counter = 0 ; Counter < MAX_INPMED ; Counter++)
|
|
{
|
|
if (ID_MEDIA[Counter] && (&ID_MEDIA[Counter]->Image == PickReportToWatch.CollidedMap))
|
|
{
|
|
strcpy((char*)PickReportToWatch.CollidedMediaName,(char*)ID_MEDIA[Counter]->MediaName);
|
|
Counter = MAX_INPMED;
|
|
}
|
|
}
|
|
}
|
|
if (PickReportToWatch.CollidedMediaName[0] == 0)
|
|
PickReportToWatch.CollidedMap = NULL;
|
|
else
|
|
{ RETURN_COLOR(0xFFFFFF & PickReportToWatch.CollidedMap->GetValue((int)PickReportToWatch.PickingCoordUV.x + (int)PickReportToWatch.PickingCoordUV.y*PickReportToWatch.CollidedMap->PITCH)); }
|
|
}
|
|
})
|
|
DEFINE_SCRIPT_REN(PICK_MediaXYGet, PICK_GetMediaXY, CATEGORY(Picking),"If a media was associated to the picking return the texture coords of the picking point, else '0'",
|
|
{
|
|
if (*PickReportToWatch.PickingClass && PickReportToWatch.CollidedMap)
|
|
{
|
|
if (PickReportToWatch.CollidedMediaName[0] == 0)
|
|
{
|
|
for (u32 Counter = 0 ; Counter < MAX_INPMED ; Counter++)
|
|
{
|
|
if (ID_MEDIA[Counter] && (&ID_MEDIA[Counter]->Image == PickReportToWatch.CollidedMap))
|
|
{
|
|
strcpy((char*)PickReportToWatch.CollidedMediaName,(char*)ID_MEDIA[Counter]->MediaName);
|
|
Counter = MAX_INPMED;
|
|
}
|
|
}
|
|
}
|
|
if (PickReportToWatch.CollidedMediaName[0] == 0)
|
|
PickReportToWatch.CollidedMap = NULL;
|
|
else
|
|
{ RETURN_POINTF(PickReportToWatch.PickingCoordUV.x, PickReportToWatch.CollidedMap->SY - PickReportToWatch.PickingCoordUV.y); }
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(PICK_CaptureGrowSet,
|
|
CATEGORY(Picking) PARAM_INT(Size),
|
|
"Make grow tolerancy of picking by [SIZE] pixels",
|
|
{
|
|
PickReportCurrent.GrowCaptureSize = Size;
|
|
})
|
|
DEFINE_SCRIPT(PICK_AlphaThresholdSet,
|
|
CATEGORY(Picking) PARAM_INT(ALPHA),
|
|
"Set the alpha picking sensitivity.0 mean pick everything.Range is 0-256",
|
|
{
|
|
PickReportCurrent.AlphaThreshold = ALPHA;
|
|
})
|
|
|
|
DEFINE_SCRIPT_REN(SCN_FocaleSet, SetSmScFocale,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc) PARAM_FLOAT(NewFocale),
|
|
"Negative numbers mean ORTHO (ISOMETRIC) Focale",
|
|
{
|
|
if(Smsc) Smsc->fFocalToUseForNextRender = NewFocale;
|
|
})
|
|
DEFINE_SCRIPT(SCN_FocaleGet,
|
|
CATEGORY(Small Scene) PARAM_SCENE(Smsc),
|
|
"Get the focal of a small scene. Negative numbers mean ORTHO (ISOMETRIC) Focale.",
|
|
{
|
|
float focale = Smsc->fFocalToUseForNextRender;
|
|
if (focale ==0) focale = 2.5;
|
|
if(Smsc) RETURN_FLOAT(focale);
|
|
})
|
|
|
|
DEFINE_SCRIPT(VECTOR_New, CATEGORY(VECTOR) PARAM_FLOAT_OPT(x,0) PARAM_FLOAT_OPT(y,0) PARAM_FLOAT_OPT(z,0) , "Create Null Vector",
|
|
{
|
|
Vector newVector(x,y,z);
|
|
RETURN_VECTOR(&newVector);
|
|
})
|
|
|
|
DEFINE_SCRIPT(QUAT_New, CATEGORY(QUAT) PARAM_FLOAT_OPT(x,0) PARAM_FLOAT_OPT(y,0) PARAM_FLOAT_OPT(z,0) PARAM_FLOAT_OPT(w,0) , "Create Indetity quaternion",
|
|
{
|
|
Quat newQuat(x,y,z,w);
|
|
RETURN_QUAT(&newQuat);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(MATRIX_New, CATEGORY(MATRIX), "Create Indetity matrix",
|
|
{
|
|
MATRIX Identity;
|
|
RETURN_MATRIX(&Identity);
|
|
})
|
|
|
|
DEFINE_SCRIPT(MATRIX_RotateI,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_FLOAT(Angle),"Angle is in degree",
|
|
{
|
|
Pos.RotateAround_I(Angle * 3.1415927f / 180.0f);
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_RotateJ,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_FLOAT(Angle),"Angle is in degree",
|
|
{
|
|
Pos.RotateAround_J(Angle * 3.1415927f / 180.0f);
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_RotateK,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_FLOAT(Angle),"Angle is in degree",
|
|
{
|
|
Pos.RotateAround_K(Angle * 3.1415927f / 180.0f);
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_RotateX,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_FLOAT(Angle),"Angle is in degree",
|
|
{
|
|
Pos.RotateAround_X(Angle * 3.1415927f / 180.0f);
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_RotateY,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_FLOAT(Angle),"Angle is in degree",
|
|
{
|
|
Pos.RotateAround_Y(Angle * 3.1415927f / 180.0f);
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_RotateZ,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_FLOAT(Angle),"Angle is in degree",
|
|
{
|
|
Pos.RotateAround_Z(Angle * 3.1415927f / 180.0f);
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_RotationAmplify,
|
|
CATEGORY(MATRIX) PARAM_MATRIX(RotationMatrix) PARAM_FLOAT(factor) PARAM_FLOAT_OPT(angleLimit, -1),
|
|
"Amplify or reduct a rotation matrix",
|
|
{
|
|
Vector Tranlation = RotationMatrix.T;
|
|
void MatrixStretchAngle(MATRIX *MatrixPtr, float factor, float limit);
|
|
MatrixStretchAngle(&RotationMatrix, factor, angleLimit);
|
|
RotationMatrix.T = Tranlation;
|
|
RETURN_MATRIX(&RotationMatrix);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_ToEuler,
|
|
CATEGORY(MATRIX) PARAM_MATRIX(matrix),
|
|
"Amplify or reduct a rotation matrix",
|
|
{
|
|
Vector EulerVect;
|
|
matrix.ToEuler(EulerVect);
|
|
EulerVect *= 45 / atan(1.0);
|
|
RETURN_VECTOR(&EulerVect);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_FromEuler,
|
|
CATEGORY(MATRIX) PARAM_VECTOR(EulerVect),
|
|
"Amplify or reduct a rotation matrix",
|
|
{
|
|
MATRIX matrix;
|
|
EulerVect *= atan(1.0) / 45;
|
|
matrix.FromEuler(EulerVect);
|
|
RETURN_MATRIX(&matrix);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_ToQuat,
|
|
CATEGORY(MATRIX) PARAM_MATRIX(matrix),
|
|
"Amplify or reduct a rotation matrix",
|
|
{
|
|
Quat quat;
|
|
quat.ComputeFromMatrix(&matrix);
|
|
RETURN_QUAT(&quat);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_FromQuat,
|
|
CATEGORY(MATRIX) PARAM_QUAT(quat),
|
|
"Amplify or reduct a rotation matrix",
|
|
{
|
|
MATRIX matrix;
|
|
quat.TransforToMatrix(&matrix);
|
|
RETURN_MATRIX(&matrix);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_Inverse,
|
|
CATEGORY(MATRIX) PARAM_MATRIX(matrix),
|
|
"Inverse the matrix",
|
|
{
|
|
MATRIX matrixDst;
|
|
matrix.Inverse(matrixDst);
|
|
RETURN_MATRIX(&matrixDst);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_ZoomSet,CATEGORY(MATRIX) PARAM_MATRIX(Pos) PARAM_VECTOR(Zoom),"Zoom is a Factor",
|
|
{
|
|
Pos.I.Normalize();
|
|
Pos.J.Normalize();
|
|
Pos.K.Normalize();
|
|
Pos.I *= Zoom.x;
|
|
Pos.J *= Zoom.y;
|
|
Pos.K *= Zoom.z;
|
|
RETURN_MATRIX(&Pos);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_ZoomGet,CATEGORY(MATRIX) PARAM_MATRIX(Pos),"",
|
|
{
|
|
Vector Zoom;
|
|
Zoom.x = Pos.I.Norm();
|
|
Zoom.y = Pos.J.Norm();
|
|
Zoom.z = Pos.K.Norm();
|
|
RETURN_VECTOR(&Zoom);
|
|
})
|
|
DEFINE_SCRIPT(MATRIX_Blend,CATEGORY(MATRIX) PARAM_MATRIX(Pos1) PARAM_MATRIX(Pos2) PARAM_FLOAT(Factor),"",
|
|
{
|
|
Pos1.Blend(Pos2,Factor);
|
|
RETURN_MATRIX(&Pos1);
|
|
})
|
|
DEFINE_SCRIPT(TRK_ComputeBackground,
|
|
CATEGORY(Tracking) PARAM_INT(Activate) PARAM_INT(Relearn),
|
|
"Compute back. Store result in alpha channel",
|
|
{
|
|
u32 TRK_AE_ComputeBackground(u32 Activate, u32 Relearn);
|
|
RETURN_INT(TRK_AE_ComputeBackground(Activate,Relearn));
|
|
})
|
|
DEFINE_SCRIPT(TRK_ComputeBackgroundParrams,
|
|
CATEGORY(Tracking) PARAM_INT(Blur) PARAM_INT(Blur_Summ),
|
|
"Compute back denoise parrams. ",
|
|
{
|
|
void TRK_AE_ComputeBackgroundParrams(s32 FactorBlur, s32 FactorBlurSumm);
|
|
TRK_AE_ComputeBackgroundParrams(Blur, Blur_Summ);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(TRK_FrameHasBeenSkipped,
|
|
CATEGORY(Tracking),
|
|
"Return 0 if tracker has been called",
|
|
{
|
|
RETURN_INT(ulSkippedFrameCounter);
|
|
})
|
|
|
|
|
|
|
|
DEFINE_SCRIPT(MAT_SaveIn,
|
|
CATEGORY(Material) PARAM_SCENE_MATERIAL(Smsc, Material) PARAM_STRING(SmscToAdd) PARAM_STRING(MaterialToAdd),
|
|
"save material",
|
|
{
|
|
SaveMaterial(Material, SmscToAdd, MaterialToAdd);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_Check,
|
|
CATEGORY(IK) PARAM_SCENE(SmSc),
|
|
"Check IK",
|
|
{
|
|
if (!SmSc->IK)
|
|
{
|
|
SmSc->IK = (SmallScene_IK *)CC_malloc(sizeof(SmallScene_IK));
|
|
memset(SmSc->IK, 0, sizeof(SmallScene_IK));
|
|
SmSc->IODico.Init();
|
|
}
|
|
})
|
|
DEFINE_SCRIPT(IK_Reset,
|
|
CATEGORY(IK) PARAM_STRING(SceneName),
|
|
"Set an empty IK (reset existing or create)",
|
|
{
|
|
SmallSceneIKReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_Save,
|
|
CATEGORY(IK) PARAM_STRING(SceneName),
|
|
"Save IK File",
|
|
{
|
|
char NameIK[2048];
|
|
u32 res;
|
|
SmallScene *Smsc = SmallNameToScene(SceneName);
|
|
sprintf(NameIK,".\\media\\%s\\Modified\\SmSc.IKM",SceneName);
|
|
IKPatchInitToObj(Smsc);
|
|
res = SaveSmallScene_IK(Smsc->IK,NameIK, &Smsc->IODico);
|
|
IKPatchProcess(Smsc);
|
|
RETURN_BOOL(res == NULL);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchNumberSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK(SceneName) PARAM_INT(Number),
|
|
"Set Patch number",
|
|
{
|
|
if (IKPtr->ulInitNumberOfPatchs < Number)
|
|
{
|
|
if (!IKPtr->pInitObjPatchs)
|
|
IKPtr->pInitObjPatchs = (IK_ObjectPatch *)CC_malloc(SceneName->ulNumberOfObjects*sizeof(IK_ObjectPatch));
|
|
memset(IKPtr->pInitObjPatchs + IKPtr->ulInitNumberOfPatchs, 0, (Number - IKPtr->ulInitNumberOfPatchs)*sizeof(IK_ObjectPatch));
|
|
}
|
|
IKPtr->ulInitNumberOfPatchs = Number;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchNumberGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK(SceneName),
|
|
"Get Patch number",
|
|
{
|
|
RETURN_INT(IKPtr->ulInitNumberOfPatchs);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchObjectSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(Smsc, patch) PARAM_STRING(ObjectName),
|
|
"Set patch Object",
|
|
{
|
|
UnicID ObjectID = -1;
|
|
UnicID ObjectREF= -1;
|
|
char *lastSlash = ObjectName;
|
|
while (strchr(lastSlash, '\\'))
|
|
lastSlash = strchr(lastSlash, '\\') + 1;
|
|
while (strchr(lastSlash, '/'))
|
|
lastSlash = strchr(lastSlash, '/') + 1;
|
|
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(lastSlash);
|
|
if (ObjectREF != -1)
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
//ObjectID = Smsc->IODico.IsExist(Object);
|
|
if (ObjectREF != -1)
|
|
{
|
|
Smsc->IODico.GetUnic(&ObjectID, ObjectName);
|
|
Smsc->IODico.mpst_Dico[ObjectID].AssociatedValue = ObjectREF;
|
|
patch->ObjectID = ObjectID;
|
|
patch->ObjectRefIndex = ObjectREF;
|
|
IKPatchProcess(Smsc);
|
|
SmallSceneIKInstancesReset(Smsc);
|
|
}
|
|
RETURN_BOOL(patch->ObjectID != -1);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchObjectGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get patch Object Name",
|
|
{
|
|
char ObjectName[2048];
|
|
SceneName->IODico.GetName(&patch->ObjectID, ObjectName);
|
|
RETURN_STRING(ObjectName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchFlagSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch) PARAM_INT(Flag),
|
|
"Set Patch Flag",
|
|
{
|
|
patch->ulFlags = Flag;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchFlagGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get Patch Flag",
|
|
{
|
|
RETURN_INT(patch->ulFlags);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchHeritageStartSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch) PARAM_INT(HeritageStart),
|
|
"Set Patch HeritageStart",
|
|
{
|
|
patch->HeritageStart = HeritageStart;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchHeritageStartGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get Patch HeritageStart",
|
|
{
|
|
RETURN_INT(patch->HeritageStart);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchSpringStrengthSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch) PARAM_FLOAT(SpringStrength),
|
|
"Set Patch SpringStrength",
|
|
{
|
|
patch->fSpringStrength = SpringStrength;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchSpringStrengthGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get Patch SpringStrength",
|
|
{
|
|
RETURN_FLOAT(patch->fSpringStrength);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchVelocityAbsorbtionSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch) PARAM_FLOAT(VelocityAbsorbtion),
|
|
"Set Patch VelocityAbsorbtion",
|
|
{
|
|
patch->VelocityAbsorbtion = VelocityAbsorbtion;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchVelocityAbsorbtionGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get Patch VelocityAbsorbtion",
|
|
{
|
|
RETURN_FLOAT(patch->VelocityAbsorbtion);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchMaxAngleSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch) PARAM_FLOAT(MaxAngle),
|
|
"Set Patch MaxAngle in degrees",
|
|
{
|
|
patch->MaxAngle = MaxAngle/90.0f;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchMaxAngleGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get Patch MaxAngle in degrees",
|
|
{
|
|
RETURN_FLOAT(patch->MaxAngle*90.0f);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchWeightSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch) PARAM_VECTOR(Weight),
|
|
"Set Patch Weight",
|
|
{
|
|
patch->vWeight = Weight;
|
|
IKPatchProcess(SceneName);
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_PatchWeightGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_PATCH(SceneName, patch),
|
|
"Get Patch Weight",
|
|
{
|
|
RETURN_VECTOR(&patch->vWeight);
|
|
})
|
|
|
|
|
|
DEFINE_SCRIPT(IK_ColliderNumberSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK(SceneName) PARAM_INT(Number),
|
|
"Set Collider number",
|
|
{
|
|
if (Number != IKPtr->ulNumberOfCollider)
|
|
{
|
|
if (Number == 0)
|
|
{
|
|
if (IKPtr->pColliders) CC_free(IKPtr->pColliders);
|
|
IKPtr->pColliders = NULL;
|
|
} else
|
|
{
|
|
if (!IKPtr->pColliders)
|
|
IKPtr->pColliders = (IK_Collider *)CC_malloc(Number*sizeof(IK_Collider));
|
|
else
|
|
IKPtr->pColliders = (IK_Collider *)CC_realloc(IKPtr->pColliders, Number*sizeof(IK_Collider));
|
|
}
|
|
if (IKPtr->ulNumberOfCollider < Number)
|
|
memset(IKPtr->pColliders + IKPtr->ulNumberOfCollider, 0, (Number - IKPtr->ulNumberOfCollider)*sizeof(IK_Collider));
|
|
IKPtr->ulNumberOfCollider = Number;
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
}
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderNumberGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK(SceneName),
|
|
"Get Collider number",
|
|
{
|
|
RETURN_INT(IKPtr->ulNumberOfCollider);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderObjectSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_COLLIDER(Smsc, collider) PARAM_STRING(ObjectName),
|
|
"Set Collider Object",
|
|
{
|
|
UnicID ObjectID = -1;
|
|
UnicID ObjectREF= -1;
|
|
char *lastSlash = ObjectName;
|
|
while (strchr(lastSlash, '\\'))
|
|
lastSlash = strchr(lastSlash, '\\') + 1;
|
|
while (strchr(lastSlash, '/'))
|
|
lastSlash = strchr(lastSlash, '/') + 1;
|
|
|
|
ObjectREF = Smsc->ObjectNameDico.IsExist(lastSlash);
|
|
if (ObjectREF != -1)
|
|
ObjectREF = Smsc->ObjectNameDico.mpst_Dico[ObjectREF].AssociatedValue;
|
|
//ObjectID = Smsc->IODico.IsExist(Object);
|
|
if (ObjectREF != -1)
|
|
{
|
|
Smsc->IODico.GetUnic(&ObjectID, ObjectName);
|
|
Smsc->IODico.mpst_Dico[ObjectID].AssociatedValue = ObjectREF;
|
|
collider->ObjectID = ObjectID;
|
|
collider->ObjectRefIndex = Smsc->IODico.mpst_Dico[collider->ObjectID].AssociatedValue;
|
|
SmallSceneIKInstancesReset(Smsc);
|
|
}
|
|
RETURN_BOOL(collider->ObjectID != -1);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderObjectGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_COLLIDER(SceneName, collider),
|
|
"Get Collider Object Name",
|
|
{
|
|
char ObjectName[2048];
|
|
SceneName->IODico.GetName(&collider->ObjectID, ObjectName);
|
|
RETURN_STRING(ObjectName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderRadiusSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_COLLIDER(SceneName, collider) PARAM_VECTOR(V),
|
|
"Set Collider Radius",
|
|
{
|
|
collider->Radius = V;
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderRadiusGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_COLLIDER(SceneName, collider),
|
|
"Get Collider Radius",
|
|
{
|
|
RETURN_VECTOR(&collider->Radius);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderCenterSet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_COLLIDER(SceneName, collider) PARAM_VECTOR(V),
|
|
"Set Collider Center",
|
|
{
|
|
collider->Center = V;
|
|
SmallSceneIKInstancesReset(SceneName);
|
|
})
|
|
|
|
DEFINE_SCRIPT(IK_ColliderCenterGet,
|
|
CATEGORY(IK) PARAM_SCENE_IK_COLLIDER(SceneName, collider),
|
|
"Get Collider Center",
|
|
{
|
|
RETURN_VECTOR(&collider->Center);
|
|
})
|