Exemple #1
0
void Variable::setupDefaultInAnimation(Animation * animation, int objectId, int variableId)
{
    Timeline *newVariableTimeline = animation->setVariableTimeline(objectId, variableId);
    if (newVariableTimeline)
    {
        UniversalObjectInterface *newObjectInfo = getNewObjectInfoInstance();
        switch (variableType)
        {
        case VARIABLETYPE_STRING:
            newObjectInfo->setStringValue(defaultValue->getStringValue());
            break;

        case VARIABLETYPE_INT:
            newObjectInfo->setIntValue(defaultValue->getIntValue());
            break;

        case VARIABLETYPE_REAL:
            newObjectInfo->setRealValue(defaultValue->getRealValue());
            break;

        default:
            Settings::error("Variable::setupDefaultInAnimation - invalid variable type");
            break;
        }

        TimelineKey *newTimelineKey = newVariableTimeline->pushBackKey(new TimeInfo(0, 0, new InstantEasingCurve()), newObjectInfo);
        newTimelineKey->setNextObjectInfo(newObjectInfo);
    }
}
Exemple #2
0
void Swatch::assemble( Timeline &timeline )
{
	float dur = 0.2f;
//	mPos = mAnchorPos + vec2( 15.0f, 0.0f );
	timeline.apply( &mPos, mAnchorPos, dur, EaseOutAtan( 10 ) ).finishFn( bind( &Swatch::setDeselected, this ) );
	timeline.apply( &mScale, 1.0f, dur, EaseOutAtan( 10 ) );
}
Exemple #3
0
//печать анимации
void dump (const Timeline& timeline, int level)
{
  print_space (level++);
  printf      ("Timeline '%s'\n", timeline.Name ());

  dump ("layers", timeline.Layers (), level);
}
Exemple #4
0
bool TimelineCommand::onChecked(Context* ctx) {
  MainWindow* mainWin = App::instance()->mainWindow();
  if (!mainWin)
    return false;

  Timeline* timelineWin = mainWin->getTimeline();
  return (timelineWin && timelineWin->isVisible());
}
Exemple #5
0
TEST(Timeline,empty) {
	EXPECT_TRUE(Timeline().empty());
	Timeline t;
	t.emplace_back();
	t.emplace_back();
	EXPECT_TRUE(t.empty());
	t.front().add(0, Clip { 1 });
}
bool CmdTransaction::isDocRangeEnabled() const
{
#ifdef ENABLE_UI
  if (App::instance()) {
    Timeline* timeline = App::instance()->timeline();
    if (timeline && timeline->range().enabled())
      return true;
  }
#endif
  return false;
}
Exemple #7
0
void
TimelineGroup::OnCollectionChanged (Collection *col, CollectionChangedEventArgs *args)
{
	if (PropertyHasValueNoAutoCreate (TimelineGroup::ChildrenProperty, col)) {
		if (args->GetChangedAction() == CollectionChangedActionAdd ||
		    args->GetChangedAction() == CollectionChangedActionReplace) {
			Timeline *timeline = args->GetNewItem()->AsTimeline ();
			if (timeline)
				timeline->SetHadParent (true);
		}
	}
}
Timeline* Timeline::clone()
{
    Timeline* timeline = Timeline::create();
    timeline->_actionTag = _actionTag;

    CCObject* object = NULL;
    CCARRAY_FOREACH(_frames, object)
    {
        Frame* frame = static_cast<Frame*>(object);
        Frame* newFrame = frame->clone();
        timeline->addFrame(newFrame);
    }
Exemple #9
0
bool Timelines::Get(const string& key, Timeline& results) {
	int size = (int)sizeof(double);
	void* records = tcbdbget(this->database, key.c_str(), key.size(), &size);
	
	if(records != NULL) {
		size_t count = size / sizeof(double);
		results.insert(results.end(), (double*)records, (double*)records + count);
		free(records);
		return true;
	} else {
		return false;
	}
}
NS_TIMELINE_BEGIN

Timeline* Timeline::create()
{
    Timeline* object = new Timeline();
    if (object && object->init())
    {
        object->autorelease();
        return object;
    }
    CC_SAFE_DELETE(object);
    return NULL;
}
Exemple #11
0
Timeline* Timeline::clone()
{
    Timeline* timeline = Timeline::create();
    timeline->_actionTag = _actionTag;

    for (auto frame : _frames)
    {
        Frame* newFrame = frame->clone();
        timeline->addFrame(newFrame);
    }

    return timeline;
}
Exemple #12
0
NS_TIMELINE_BEGIN

Timeline* Timeline::create()
{
    Timeline* object = new (std::nothrow) Timeline();
    if (object)
    {
        object->autorelease();
        return object;
    }
    CC_SAFE_DELETE(object);
    return nullptr;
}
void testFind(const Timeline<int>& timeline, FindMode findMode, const initializer_list<Timed<int>*> expectedResults) {
	int i = -1;
	for (Timed<int>* expectedResult : expectedResults) {
		auto it = timeline.find(centiseconds(++i), findMode);
		if (expectedResult != nullptr) {
			EXPECT_NE(it, timeline.end()) << "Timeline: " << timeline << "; findMode: " << static_cast<int>(findMode) << "; i: " << i;
			if (it != timeline.end()) {
				EXPECT_EQ(*expectedResult, *it) << "Timeline: " << timeline << "; findMode: " << static_cast<int>(findMode) << "; i: " << i;
			}
		} else {
			EXPECT_EQ(timeline.end(), it) << "Timeline: " << timeline << "; findMode: " << static_cast<int>(findMode) << "; i: " << i;
		}
	}
}
Exemple #14
0
DocRange CmdTransaction::calcDocRange() const
{
#ifdef ENABLE_UI
  // TODO We cannot use Context::activeSite() because it losts
  //      important information about the DocRange() (type and
  //      flags).
  if (App::instance()) {
    Timeline* timeline = App::instance()->timeline();
    if (timeline)
      return timeline->range();
  }
#endif
  return DocRange();
}
Exemple #15
0
// Validate this TimelineGroup by validating all of it's children
bool
TimelineGroup::Validate ()
{
	TimelineCollection *collection = GetChildren ();
	Timeline *timeline;
	
	int count = collection->GetCount ();
	for (int i = 0; i < count; i++) {
		timeline = collection->GetValueAt (i)->AsTimeline ();
		if (!timeline->Validate ())
			return false;
	}
	
	return Timeline::Validate ();
}
Exemple #16
0
    void
    Plan::fillTimeline(Timeline& tl)
    {
      float execution_duration = getExecutionDuration();

      std::vector<IMC::PlanManeuver*>::const_iterator itr;
      itr = m_seq_nodes.begin();

      // Maneuver's start and end ETA
      float maneuver_start_eta = -1.0;
      float maneuver_end_eta = -1.0;

      // Iterate through plan maneuvers
      for (; itr != m_seq_nodes.end(); ++itr)
      {
        if (itr == m_seq_nodes.begin())
          maneuver_start_eta = execution_duration;
        else
          maneuver_start_eta = maneuver_end_eta;

        TimeProfile::const_iterator dur;
        dur = m_profiles->find((*itr)->maneuver_id);

        if (dur == m_profiles->end())
          maneuver_end_eta = -1.0;
        else if (dur->second.durations.size())
          maneuver_end_eta = execution_duration - dur->second.durations.back();
        else
          maneuver_end_eta = -1.0;

        // Fill timeline
        tl.setManeuverETA((*itr)->maneuver_id, maneuver_start_eta, maneuver_end_eta);
      }
    }
Exemple #17
0
void Item::mouseOff( Timeline &timeline )
{
	if( !mIsBeingSelected ){
		float dur = 0.4f;
		
		// title
		timeline.apply( &mTitlePos, mTitleStart, dur, EaseOutBounce( 1.0f ) );
		timeline.apply( &mTitleColor, Color( 0.7f, 0.7f, 0.7f ), 0.05f, EaseOutAtan( 10 ) );
		
		// bar
		timeline.apply( &mBarColor, Color( 0, 0, 0 ), 0.2f, EaseOutAtan( 10 ) );
		timeline.apply( &mBarAlpha, 0.0f, 0.2f, EaseOutAtan( 10 ) );
		timeline.apply( &mBarWidth, 0.0f, 0.2f, EaseInAtan( 10 ) );

		for( std::vector<Swatch>::iterator swatchIt = mSwatches.begin(); swatchIt != mSwatches.end(); ++swatchIt ) {
			swatchIt->mouseOff( timeline );
		}
	}
}
Exemple #18
0
void Item::mouseOver( Timeline &timeline )
{
	if( !mIsBeingSelected ){
		float dur = 0.2f;
		
		// title
		timeline.apply( &mTitlePos, mMouseOverDest, dur, EaseOutAtan( 10 ) );
		timeline.apply( &mTitleColor, Color( 1, 1, 1 ), 0.05f, EaseOutAtan( 10 ) );
		
		// bar
		timeline.apply( &mBarColor, Color( 0, 0, 0 ), dur, EaseOutAtan( 10 ) );
		timeline.apply( &mBarAlpha, 0.4f, dur, EaseOutAtan( 10 ) );
		timeline.apply( &mBarWidth, mMaxBarWidth, dur, EaseOutAtan( 10 ) );

		for( std::vector<Swatch>::iterator swatchIt = mSwatches.begin(); swatchIt != mSwatches.end(); ++swatchIt ) {
			swatchIt->mouseOver( timeline );
		}
	}
}
Exemple #19
0
void ActClipSetTimeRange::operator()(int currentTime, int value)
{
    Projet& projet = Projet::getInstance();
    Timeline timeline = projet.getTimeline();

    std::string idClip = timeline.findCurrentClip(currentTime);

    std::ostringstream oss;
    oss<<value;
    IUndoRedoCommand* cmd = new CmdClipSetTimeRange(idClip,"Commande Clip Set Time Range"+oss.str()
    , value);

    //find the command manager thanks to the application (core)
    CommandManager& cmdMng = projet.getCommandManager();

    //add the command to the command manager
    cmdMng.pushNewCommand(cmd);
    
}
Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json)
{
    Timeline* timeline = nullptr;

    // get frame type 
    const char* frameType = DICTOOL->getStringValue_json(json, FRAME_TYPE);
    if(frameType == nullptr)
        return nullptr;

    if(frameType && _funcs.find(frameType) != _funcs.end())
    {
        timeline = Timeline::create();

        int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
        timeline->setActionTag(actionTag);

        FrameCreateFunc func = _funcs.at(frameType);

        int length = DICTOOL->getArrayCount_json(json, FRAMES);
        for (int i = 0; i<length; i++)
        {
            const rapidjson::Value& dic = DICTOOL->getSubDictionary_json(json, FRAMES, i);

            Frame* frame = nullptr;

            if (func != nullptr)
            {
                frame = func(dic);

                int frameIndex = DICTOOL->getIntValue_json(dic, FRAME_INDEX);
                frame->setFrameIndex(frameIndex);

                bool tween = DICTOOL->getBooleanValue_json(dic, TWEEN, false);
                frame->setTween(tween);
            }

            timeline->addFrame(frame);
        }
    }

    return timeline;
}
Exemple #21
0
Timeline* CreateTimelineFromArray(Body* body,
                                  Universe& universe,
                                  ValueArray* timelineArray,
                                  const string& path,
                                  ReferenceFrame* defaultOrbitFrame,
                                  ReferenceFrame* defaultBodyFrame)
{
    Timeline* timeline = new Timeline();
    double previousEnding = -numeric_limits<double>::infinity();

    for (ValueArray::const_iterator iter = timelineArray->begin(); iter != timelineArray->end(); iter++)
    {
        Hash* phaseData = (*iter)->getHash();
        if (phaseData == NULL)
        {
            clog << "Error in timeline of '" << body->getName() << "': phase " << iter - timelineArray->begin() + 1 << " is not a property group.\n";
            delete timeline;
            return NULL;
        }

        bool isFirstPhase = iter == timelineArray->begin();
        bool isLastPhase = *iter == timelineArray->back();

        TimelinePhase* phase = CreateTimelinePhase(body, universe, phaseData,
                                                   path,
                                                   defaultOrbitFrame,
                                                   defaultBodyFrame,
                                                   isFirstPhase, isLastPhase, previousEnding);
        if (phase == NULL)
        {
            clog << "Error in timeline of '" << body->getName() << "', phase " << iter - timelineArray->begin() + 1 << endl;
            delete timeline;
            return NULL;
        }

        previousEnding = phase->endTime();

        timeline->appendPhase(phase);
    }

    return timeline;
}
Exemple #22
0
Timeline::Timeline(const Timeline &other):
	Action(other),
	_currentActionIndex(other._currentActionIndex),
	_bindingObject(nullptr)
{
	Timeline *rtl = other.GetRootTimeline();
	Action::SetRootTimeline(rtl != &other ? rtl : this);
	Object::Clone(other._actions, &_actions, this->GetRootTimeline(), this);
	
	this->InitProperties();
}
Exemple #23
0
void ItemContaWidget::removeLancamento(){
  CabureApplication *cabure = CabureApplication::cabureApplication();
  Contabilidade *contabilidade = cabure->contabilidade_;
  Timeline *timeline = cabure->timeline_;

  StandardButton result = 
    WMessageBox::show(tr("confirm").toUTF8(), 
          tr("msg-delete-transaction").toUTF8(),
		      Ok | Cancel);

  if(result == Ok) {
    contabilidade->removeLancamento(id_diario_);
    ItemTimeline itemTimeline("",
            tr("msg-delete-transaction-success").arg(descricao_).toUTF8(), 
			      "ItemContaWidget::removeLancamento()",
			      "");
    timeline->adiciona(itemTimeline);
  }

  view_->viewHome(); 
}
Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json)
{
    Timeline* timeline = NULL;

    // get frame type 
    const char* frameType = DICTOOL->getStringValue_json(json, FRAME_TYPE);
	if(frameType == NULL)
		return NULL;

    FrameCreateCallFunc* func = static_cast<FrameCreateCallFunc*>(_funcs->objectForKey(frameType));

    if(frameType && func)
    {
        timeline = Timeline::create();

        int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
        timeline->setActionTag(actionTag);


        int length = DICTOOL->getArrayCount_json(json, FRAMES);
        for (int i = 0; i<length; i++)
        {
            const rapidjson::Value& dic = DICTOOL->getSubDictionary_json(json, FRAMES, i);

            Frame* frame = NULL;
            frame = func->excute(dic);

            int frameIndex = DICTOOL->getIntValue_json(dic, FRAME_INDEX);
            frame->setFrameIndex(frameIndex);

            bool tween = DICTOOL->getBooleanValue_json(dic, TWEEN, false);
            frame->setTween(tween);

            timeline->addFrame(frame);
        }
    }

    return timeline;
}
Exemple #25
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setOrganizationName("CamelCorp");
    a.setApplicationName("Timeline");
    a.setApplicationVersion("1.0");

    QTranslator translator;
    translator.load(a.applicationDirPath() + "/timeline_" + QLocale::system().name().left(2));
    bool locale = a.installTranslator(&translator);

    QTranslator qtTranslator;
    if(locale)
        qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    else
        qtTranslator.load("qt_" + QLocale(QLocale::English).name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    a.installTranslator(&qtTranslator);

    Timeline w;
    w.show();
    
    return a.exec();
}
Exemple #26
0
void Item::deselect( Timeline &timeline )
{
	mIsBeingSelected = false;
	
	float dur1 = 0.2f;
	float dur2 = 0.2f;
	
	// set title position
	// set deselected after initial animation
	timeline.apply( &mTitlePos, mTitleDest2, dur1, EaseInAtan( 10 ) ).finishFn( bind( &Item::setDeselected, this ) );
	timeline.appendTo( &mTitlePos, mTitleDest1, 0.0001f, EaseNone() );
	timeline.appendTo( &mTitlePos, mTitleStart, dur2, EaseOutElastic( 2.0f, 0.5f ) );
	
	// set title color
	timeline.apply( &mTitleColor, Color( 1, 1, 1 ), dur1, EaseInAtan( 10 ) );
	timeline.appendTo( &mTitleColor, Color( 0.7f, 0.7f, 0.7f ), 0.05f, EaseOutAtan( 10 ) );
	
	// set title alpha
	timeline.apply( &mTitleAlpha, 0.0f, dur1, EaseInAtan( 10 ) );
	timeline.appendTo( &mTitleAlpha, 1.0f, dur2, EaseOutAtan( 10 ) );
	
	// set desc position
	timeline.apply( &mDescPos, mDescStart, dur1, EaseInAtan( 10 ) ).timelineEnd();
	
	// set desc alpha
	timeline.apply( &mDescAlpha, 0.0f, dur1, EaseInQuad() ).timelineEnd( -dur1 );
	
	// set bar
	timeline.apply( &mBarWidth, 0.0f, dur1, EaseInAtan( 10 ) );
	mBarAlpha = 0.3f;
	
	mIsSelected = false;
	
	for( std::vector<Swatch>::iterator swatchIt = mSwatches.begin(); swatchIt != mSwatches.end(); ++swatchIt ){
		swatchIt->assemble( timeline );
	}
}
void BulletExample::drawEvent() {
    GL::defaultFramebuffer.clear(GL::FramebufferClear::Color|GL::FramebufferClear::Depth);

    /* Housekeeping: remove any objects which are far away from the origin */
    for(Object3D* obj = _scene.children().first(); obj; )
    {
        Object3D* next = obj->nextSibling();
        if(obj->transformation().translation().dot() > 100*100)
            delete obj;

        obj = next;
    }

    /* Step bullet simulation */
    _bWorld.stepSimulation(_timeline.previousFrameDuration(), 5);

    /* Draw the cubes */
    if(_drawCubes) _camera->draw(_drawables);

    /* Debug draw. If drawing on top of cubes, avoid flickering by setting
       depth function to <= instead of just <. */
    if(_drawDebug) {
        if(_drawCubes)
            GL::Renderer::setDepthFunction(GL::Renderer::DepthFunction::LessOrEqual);

        _debugDraw.setTransformationProjectionMatrix(
            _camera->projectionMatrix()*_camera->cameraMatrix());
        _bWorld.debugDrawWorld();

        if(_drawCubes)
            GL::Renderer::setDepthFunction(GL::Renderer::DepthFunction::Less);
    }

    swapBuffers();
    _timeline.nextFrame();
    redraw();
}
Exemple #28
0
TEST(Timeline,range) {
	Timeline timeline;
	EXPECT_EQ(Range::EMPTY, timeline.getRange());
	//no tracks
	timeline.emplace_back();
	EXPECT_EQ(Range::EMPTY, timeline.getRange());
	// empty tracks
	timeline[0].add(10, Clip { 1 });
	EXPECT_EQ(Range(10,10), timeline.getRange());
	timeline.emplace_back();
	timeline[1].add(15, Clip { 6 });
	EXPECT_EQ(Range(10,20), timeline.getRange());
}
Exemple #29
0
TEST(Timeline,findClips) {
//setup
	Track track1;
	track1.insert(make_pair(5, Clip { 1, make_shared<DummyMediaStream>() }));
	track1.insert(make_pair(7, Clip { 1, make_shared<DummyMediaStream>() }));
	Track track2;
	track2.insert(make_pair(4, Clip { 5, make_shared<DummyMediaStream>() }));
	Track track3;
	Timeline timeline;
	timeline.push_back(track1);
	timeline.push_back(track2);
	timeline.push_back(track3);
// test
	vector<MediaFrameReference> refs;
	auto check = [&](int frameA, int frameB, int frameC) {
		ASSERT_EQ(3, refs.size());
		auto checkOne = [](int frame, MediaFrameReference actual) {
			if(frame<0) {
				EXPECT_EQ(MediaFrameReference(), actual);
			} else {
				EXPECT_EQ(frame, actual.second);
			}
		};
		checkOne(frameA, refs[0]);
		checkOne(frameB, refs[1]);
		checkOne(frameC, refs[2]);
	};
	timeline.populateMediaAt(4, refs);
	check(-1, 0, -1);
	timeline.populateMediaAt(5, refs);
	check(0, 1, -1);
	timeline.populateMediaAt(6, refs);
	check(-1, 2, -1);
	timeline.populateMediaAt(7, refs);
	check(0, 3, -1);
	timeline.populateMediaAt(8, refs);
	check(-1, 4, -1);
	timeline.populateMediaAt(9, refs);
	check(-1, -1, -1);
}
Exemple #30
0
Duration
ParallelTimeline::GetNaturalDurationCore (Clock *clock)
{
	TimelineCollection *collection = GetChildren ();
	Duration d = Duration::Automatic;
	TimeSpan duration_span = 0;
	Timeline *timeline;
	
	int count = collection->GetCount ();

	if (count == 0)
		return Duration::FromSeconds (0);
	
	for (int i = 0; i < count; i++) {
		timeline = collection->GetValueAt (i)->AsTimeline ();
		
		Duration duration = timeline->GetNaturalDuration (clock);
		if (duration.IsAutomatic())
			continue;
		
		if (duration.IsForever())
			return Duration::Forever;
		
		TimeSpan span = duration.GetTimeSpan ();
		
		RepeatBehavior *repeat = timeline->GetRepeatBehavior ();
		if (repeat->IsForever())
			return Duration::Forever;
		
		if (repeat->HasCount ())
			span = (TimeSpan) (span * repeat->GetCount ());
		
		if (timeline->GetAutoReverse ())
			span *= 2;

		// If we have duration-base repeat behavior, 
		// clamp/up our span to that.
		if (repeat->HasDuration ())
			span = repeat->GetDuration ();
		
		if (span != 0)
			span = (TimeSpan)(span / timeline->GetSpeedRatio());

		span += timeline->GetBeginTime ();

		if (duration_span <= span) {
			duration_span = span;
			d = Duration (duration_span);
		}
	}

	return d;
}