Added setCurrentFrame to skeletal animations
This commit is contained in:
parent
2db62da4ce
commit
97c17692e8
@ -2,10 +2,9 @@ void onUpdate()
|
||||
{
|
||||
|
||||
TrackObject @t_obj = getTrackObject("anim_sheep2.b3d");
|
||||
//t_obj.setEnable(false);
|
||||
Mesh @sheepMesh = t_obj.getMesh();
|
||||
//displayMessage("moo");
|
||||
//sheepMesh.setLoop(1,1); //rapid-nod sheep
|
||||
if (sheepMesh.getCurrentFrame()>=0)sheepMesh.setLoop(1,15);
|
||||
|
||||
if (sheepMesh.getCurrentFrame()==2){
|
||||
sheepMesh.setLoop(8,48);
|
||||
sheepMesh.setCurrentFrame(9);
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ namespace Scripting
|
||||
{
|
||||
((TrackObjectPresentationMesh*)(memory))->setLoop(start,end);
|
||||
}
|
||||
void setCurrentFrame(int frame,void *memory)
|
||||
{
|
||||
((TrackObjectPresentationMesh*)(memory))->setCurrentFrame(frame);
|
||||
}
|
||||
void getCurrentFrame(void *memory)
|
||||
{
|
||||
((TrackObjectPresentationMesh*)(memory))->getCurrentFrame();
|
||||
@ -119,17 +123,21 @@ namespace Scripting
|
||||
r = engine->RegisterGlobalFunction("TrackObject @getTrackObject(string &in)", asFUNCTION(getTrackObject), asCALL_GENERIC); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "void setEnable(bool status)", asMETHOD(TrackObject, setEnable), asCALL_THISCALL); assert(r >= 0);
|
||||
|
||||
|
||||
//PhysicalObject
|
||||
r = engine->RegisterObjectType("PhysicalObject", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "PhysicalObject @getPhysicalObject()", asMETHOD(TrackObject, getPhysicalObjectForScript), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("PhysicalObject", "bool isFlattener()", asMETHOD(PhysicalObject, isFlattenKartObject), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("PhysicalObject", "void disable()", asFUNCTION(disable), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
|
||||
|
||||
//Mesh or Skeletal Animation
|
||||
r = engine->RegisterObjectType("Mesh", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("TrackObject", "Mesh @getMesh()", asMETHOD(TrackObject, getMesh), asCALL_THISCALL); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("Mesh", "void setLoop(int start, int end)", asFUNCTION(setLoop), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("Mesh", "int getCurrentFrame()", asFUNCTION(getCurrentFrame), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("Mesh", "void setCurrentFrame(int frame)", asFUNCTION(setCurrentFrame), asCALL_CDECL_OBJLAST); assert(r >= 0);
|
||||
|
||||
|
||||
//Curve based Animation
|
||||
r = engine->RegisterObjectType("Animator", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
|
||||
|
@ -432,6 +432,16 @@ int TrackObjectPresentationMesh::getCurrentFrame()
|
||||
return -1; //Not a skeletal animation
|
||||
}
|
||||
|
||||
void TrackObjectPresentationMesh::setCurrentFrame(int frame)
|
||||
{
|
||||
if (m_node->getType() == scene::ESNT_ANIMATED_MESH)
|
||||
{
|
||||
scene::IAnimatedMeshSceneNode *a_node =
|
||||
(scene::IAnimatedMeshSceneNode*)m_node;
|
||||
|
||||
a_node->setCurrentFrame((f32)frame);
|
||||
}
|
||||
}
|
||||
|
||||
void TrackObjectPresentationMesh::setLoop(int start, int end)
|
||||
{
|
||||
|
@ -224,6 +224,8 @@ public:
|
||||
|
||||
void setLoop(int start, int end); //set custom loops, as well as pause by scripts
|
||||
|
||||
void setCurrentFrame(int frame);
|
||||
|
||||
int getCurrentFrame();
|
||||
|
||||
virtual ~TrackObjectPresentationMesh();
|
||||
|
Loading…
Reference in New Issue
Block a user