unsigned WebAnimationControllerImpl::numberOfActiveAnimations() const
{
    AnimationController* controller = animationController();
    if (!controller)
        return 0;
    return controller->numberOfActiveAnimations(m_frameImpl->frame()->document());
}
static int tolua_lua_cocos2dx_userext_AnimationController_stop00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"AnimationController",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  AnimationController* self = (AnimationController*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'stop'", NULL);
#endif
  {
   self->stop();
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'stop'.",&tolua_err);
 return 0;
#endif
}
Exemple #3
0
  bool AnimationScheduler::queueAnimation(AnimationGroup& group, double speed, double offset, bool reset = false)
  {
    for(auto& pair : group.mAnimations)
    {
      if(!pair.second.isInitialized())
        return false;

      if(mAnimationQueues.count(pair.first) == 0)
        mAnimationQueues[pair.first] = AnimationQueue();

      AnimationController c = AnimationController(pair.second, speed, offset);
      if(reset)
      {
        AnimationQueue empty;
        mAnimationQueues[pair.first].swap(empty);
      }

      if(mAnimationQueues[pair.first].size() == 0)
      {
        if(mAnimations.count(pair.first) != 0)
        {
          // TODO: add dependency on animation speed
          mAnimations[pair.first]->disable();
        }
        c.start();
      }
      mAnimationQueues[pair.first].push(c);
    }
    return true;
  }
static int tolua_lua_cocos2dx_userext_AnimationController_setMovementEventCallFunc00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"AnimationController",0,&tolua_err) ||
     (tolua_isvaluenil(tolua_S,2,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err)) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  AnimationController* self = (AnimationController*)  tolua_tousertype(tolua_S,1,0);
  LUA_FUNCTION handler = (  toluafix_ref_function(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setMovementEventCallFunc'", NULL);
#endif
  {
   self->setMovementEventCallFunc(handler);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'setMovementEventCallFunc'.",&tolua_err);
 return 0;
#endif
}
static int tolua_lua_cocos2dx_userext_AnimationController_load00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"AnimationController",0,&tolua_err) ||
     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  AnimationController* self = (AnimationController*)  tolua_tousertype(tolua_S,1,0);
  const char* armatureName = ((const char*)  tolua_tostring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'load'", NULL);
#endif
  {
   self->load(armatureName);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'load'.",&tolua_err);
 return 0;
#endif
}
static int tolua_lua_cocos2dx_userext_AnimationController_checkCollider00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"AnimationController",0,&tolua_err) ||
     
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  AnimationController* self = (AnimationController*)  tolua_tousertype(tolua_S,1,0);
  cocos2d::Rect rect;
  luaval_to_rect(tolua_S, 2, &rect);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'checkCollider'", NULL);
#endif
  {
   bool tolua_ret = (bool)  self->checkCollider(rect);
   tolua_pushboolean(tolua_S,(bool)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'checkCollider'.",&tolua_err);
 return 0;
#endif
}
void StateCharacterTurning::Update(float timeStep)
{
	StateCharacterGrounded::Update();
	
	RigidBody* body = pawn_->GetBody();
	AnimationController* animCtrl = static_cast<PawnAnimated*>(pawn_)->GetAnimationController();

	//apply a force to slow it down further, since we are changing direction
	body->ApplyImpulse(moveDir_ * pawn_->GetMoveForce() *0.25);//0.25 to dampen it

    //get the speed that we are travelling, that will determine when we turn around
    if(!flipped_)
    {
        //before we are flipped around, we drive the turning animation
        //float spd = pawn_->GetPlaneVelocity().Length();
        //float turnTime = Fit(spd,0.0f,speed_,1.0f,0.0f);
        
        animCtrl->PlayExclusive("Models/Man/MAN_TurnSkidGunning.ani", 0,false, 0.1f);
        //animCtrl->SetTime("Models/Man/MAN_TurnSkidGunning.ani",turnTime);

        if(animCtrl->IsAtEnd("Models/Man/MAN_TurnSkidGunning.ani"))
        {
            Turn();
            animCtrl->Play("Models/Man/MAN_TurnSkidGunningFlipped.ani", false, 0.0f);
            flipped_=true;
        }
    }
    else
    {
        animCtrl->Play("Models/Man/MAN_TurnSkidGunningFlipped.ani", false, 0.0f);
        //now that we are flipped we can set it to the next state too
        pawn_->SetState( new StateCharacterRunning(context_) );
    }
}
Exemple #8
0
bool DiHdfImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   if (!RasterElementImporterShell::execute(pInArgList, pOutArgList))
   {
      return false;
   }
   SpatialDataView* pView = (pOutArgList == NULL) ? NULL : pOutArgList->getPlugInArgValue<SpatialDataView>("View");
   if (pView != NULL)
   {
      if (pView->createDefaultAnimation() == NULL)
      {
         return false;
      }
      AnimationController* pController = Service<AnimationServices>()->getAnimationController(pView->getName());
      if (pController == NULL)
      {
         return false;
      }
      pController->setAnimationCycle(REPEAT);
      pController->setCanDropFrames(false);
      pController->setIntervalMultiplier(2);
      AnimationToolBar* pToolbar = static_cast<AnimationToolBar*>(Service<DesktopServices>()->getWindow("Animation", TOOLBAR));
      VERIFY(pToolbar);
      pToolbar->setAnimationController(pController);
   }
   return true;
}
unsigned WebAnimationControllerImpl::numberOfActiveAnimations() const
{
    AnimationController* controller = animationController();
    if (!controller)
        return 0;
    return controller->numberOfActiveAnimations();
}
static int tolua_lua_cocos2dx_userext_AnimationController_play00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"AnimationController",0,&tolua_err) ||
     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
     !tolua_isnoobj(tolua_S,4,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  AnimationController* self = (AnimationController*)  tolua_tousertype(tolua_S,1,0);
  const char* movementName = ((const char*)  tolua_tostring(tolua_S,2,0));
  int playMode = ((int)  tolua_tonumber(tolua_S,3,AnimationController::Default));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'play'", NULL);
#endif
  {
   self->play(movementName,playMode);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'play'.",&tolua_err);
 return 0;
#endif
}
static int tolua_lua_cocos2dx_userext_AnimationController_getArmature00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"AnimationController",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  AnimationController* self = (AnimationController*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getArmature'", NULL);
#endif
  {
   cocostudio::Armature* tolua_ret = (cocostudio::Armature*)  self->getArmature();
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"cocostudio::Armature");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'getArmature'.",&tolua_err);
 return 0;
#endif
}
Exemple #12
0
AnimationController* _3dsLoader::loadFromFile(const string &fileName) const
{
	PropertyBag xml;
	bool truespaceModel = false;
	string skin;

	TRACE(string("Loading 3DS model from \"") + fileName + string("\""));
	
	xml.loadFromFile(fileName);

	AnimationController* controller = new AnimationController();

	xml.get_optional("Truespace", truespaceModel);
	xml.get_optional("forceSkin", skin);

	for(size_t i=0, numAnimations=xml.count("animation"); i<numAnimations; ++i)
	{
		PropertyBag animation;
		string name;
		float fps = 0.0;
		bool looping = false;
		float priority = 0.0f;

		xml.get("animation", animation, i);

		animation.get("name", name);
		animation.get_optional("fps", fps);
		animation.get_optional("looping", looping);
		animation.get_optional("priority", priority);

		// Load all the keyframes
		vector<KeyFrame> keyFrames;
		const size_t length=animation.count("keyframe");
		for(size_t j=0; j<length; ++j)
		{
			string keyFrameFile;

			animation.get("keyframe", keyFrameFile, j);

			Model keyFrame = loadKeyFrame(keyFrameFile);

			cullDegenerateMeshes(keyFrame);

			if(!skin.empty()) forceSkin(keyFrame, skin);

			if(truespaceModel) fixTrueSpaceVertices(keyFrame);

			keyFrames.push_back(keyFrame);
		}

		TRACE(string("Adding 3DS animation \"") + name + string("\" from ") + fileName);

		// Add it to the controller
		AnimationSequence animationSequence(keyFrames, name, priority, looping, 0, length, fps);
		controller->addAnimation(animationSequence);
	}

	return controller;
}
AnimationController * AnimatedEntity::LoadAnimationFromFile(std::string fileName,std::string id)
{
	AnimationHandler handler = resMgr->GetAnimationFromFile(fileName,id);
	AnimationController controller;
	controller.Init(skeletonHandler.Get(),handler);

	animations.push_back(controller);
	return &animations[animations.size()-1];
}
void WebAnimationControllerImpl::resumeAnimations() const
{
    AnimationController* controller = animationController();
    if (!controller)
        return;
    if (!m_frameImpl->frame())
        return;
    controller->resumeAnimations();
}
void WebAnimationControllerImpl::suspendAnimations() const
{
    AnimationController* controller = animationController();
    if (!controller)
        return;
    if (!m_frameImpl->frame())
        return;
    controller->suspendAnimations(m_frameImpl->frame()->document());
}
Exemple #16
0
void WebFrame::suspendAnimations()
{
    if (!m_coreFrame)
        return;

    AnimationController* controller = m_coreFrame->animation();
    if (!controller)
        return;

    controller->suspendAnimations();
}
Exemple #17
0
void WebFrame::resumeAnimations()
{
    if (!m_coreFrame)
        return;

    AnimationController* controller = m_coreFrame->animation();
    if (!controller)
        return;

    controller->resumeAnimations();
}
Exemple #18
0
unsigned WebFrame::numberOfActiveAnimations() const
{
    if (!m_coreFrame)
        return 0;

    AnimationController* controller = m_coreFrame->animation();
    if (!controller)
        return 0;

    return controller->numberOfActiveAnimations();
}
bool WebAnimationControllerImpl::pauseTransitionAtTime(WebElement& element,
        const WebString& propertyName,
        double time)
{
    AnimationController* controller = animationController();
    if (!controller)
        return 0;
    return controller->pauseTransitionAtTime(PassRefPtr<Element>(element)->renderer(),
            propertyName,
            time);
}
Exemple #20
0
void webkit_web_frame_resume_animations(WebKitWebFrame* frame)
{
    Frame* coreFrame = core(frame);
    if (!coreFrame)
        return;

    AnimationController* controller = coreFrame->animation();
    if (!controller)
        return;

    controller->resumeAnimations(coreFrame->document());
}
Exemple #21
0
void DumpRenderTreeSupportQt::resumeAnimations(QWebFrame *frame)
{
    Frame* coreFrame = QWebFramePrivate::core(frame);
    if (!coreFrame)
        return;

    AnimationController* controller = coreFrame->animation();
    if (!controller)
        return;

    controller->resumeAnimations();
}
Exemple #22
0
// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
{
    Frame* coreFrame = QWebFramePrivate::core(frame);
    if (!coreFrame)
        return false;

    AnimationController* controller = coreFrame->animation();
    if (!controller)
        return false;

    return controller->numberOfActiveAnimations();
}
unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
{
    Frame* coreFrame = core(frame);
    if (!coreFrame)
        return 0;

    AnimationController* controller = coreFrame->animation();
    if (!controller)
        return 0;

    return controller->numberOfActiveAnimations();
}
// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrameAdapter *adapter)
{
    Frame* coreFrame = adapter->frame;
    if (!coreFrame)
        return false;

    AnimationController* controller = coreFrame->animation();
    if (!controller)
        return false;

    return controller->numberOfActiveAnimations(coreFrame->document());
}
Exemple #25
0
// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame *qframe)
{
    Frame* frame = QWebFramePrivate::core(qframe);
    if (!frame)
        return false;

    AnimationController* controller = frame->animation();
    if (!controller)
        return false;

    return controller->numberOfActiveAnimations();
}
Exemple #26
0
int WebFrame::numberOfActiveAnimations()
{
    Frame* coreFrame = core(this);
    if (!coreFrame)
        return 0;

    AnimationController* controller = coreFrame->animation();
    if (!controller)
        return 0;

    return controller->numberOfActiveAnimations();
}
Exemple #27
0
void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const
{
    if (!document || !document->frame()) {
        ec = INVALID_ACCESS_ERR;
        return;
    }

    AnimationController* controller = document->frame()->animation();
    if (!controller)
        return;

    controller->resumeAnimations();
}
void CompositeAnimationPrivate::setWaitingForStyleAvailable(bool waiting)
{
    if (waiting)
        m_numStyleAvailableWaiters++;
    else
        m_numStyleAvailableWaiters--;
    m_animationController->setWaitingForStyleAvailable(waiting);
}
bool ModelImporter::ImportAnimation(const String& filename, const String& name, float startTime, float endTime)
{
    SharedPtr<OpenAssetImporter> importer(new OpenAssetImporter(context_));

    //importer->SetVerboseLog(true);

    importer->SetScale(scale_);
    importer->SetExportAnimations(true);
    importer->SetStartTime(startTime);
    importer->SetEndTime(endTime);

    if (importer->Load(filename))
    {
        importer->ExportModel(asset_->GetCachePath(), name, true);

        const Vector<OpenAssetImporter::AnimationInfo>& infos = importer->GetAnimationInfos();

        for (unsigned i = 0; i < infos.Size(); i++)
        {
            const OpenAssetImporter::AnimationInfo& info = infos.At(i);

            String pathName, fileName, extension;

            SplitPath(info.cacheFilename_, pathName, fileName, extension);

            ResourceCache* cache = GetSubsystem<ResourceCache>();

            AnimationController* controller = importNode_->GetComponent<AnimationController>();

            if (controller)
            {
                SharedPtr<Animation> animation = cache->GetTempResource<Animation>(fileName + extension);
                if (animation)
                    controller->AddAnimationResource(animation);
            }

            LOGINFOF("Import Info: %s : %s", info.name_.CString(), fileName.CString());
        }

        return true;
    }

    return false;

}
Exemple #30
0
bool WebFrame::pauseAnimationOnElementWithId(const String& animationName, const String& elementID, double time)
{
    if (!m_coreFrame)
        return false;

    AnimationController* controller = m_coreFrame->animation();
    if (!controller)
        return false;

    if (!m_coreFrame->document())
        return false;

    Node* coreNode = m_coreFrame->document()->getElementById(elementID);
    if (!coreNode || !coreNode->renderer())
        return false;

    return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
}