void ofxTLFileSelectFlags::bangFired(ofxTLKeyframe* key) { ofxTLBangEventArgs args; args.sender = timeline; args.track = this; //play solo change // args.currentMillis = timeline->getCurrentTimeMillis(); args.currentMillis = currentTrackTime(); args.currentPercent = timeline->getPercentComplete(); args.currentFrame = timeline->getCurrentFrame(); args.currentTime = timeline->getCurrentTime(); // in flags was : //args.flag = ((ofxTLFlag*)key)->textField.text; //args.flag = ((ofxTLDropDownFlag*)key)->menu->getSelectedIndex(); // string selectedLabel; // ofxDatGuiDropdown* fl = ((ofxTLDropDownFlag*)key)->menu; // selectedLabel = ofToString(fl->getSelectedIndex()); // to send just the name of the preset ... not enough so commented it ... // args.flag = ((ofxTLFileSelectFlag*)key)->flagButton->getLabel(); // ofNotifyEvent(events().bangFired, args); // cout << " path_ " << ((ofxTLFileSelectFlag*)key)->path << endl; args.flag = ((ofxTLFileSelectFlag*)key)->path; ofNotifyEvent(events().bangFired, args); }
void ofxTLTrack::_draw(){ ofPushStyle(); if(focused){ ofFill(); ofSetColor(timeline->getColors().highlightColor, 50); ofRect(bounds.x, bounds.y, bounds.width, bounds.height); } ofNoFill(); if(hover){ ofSetColor(timeline->getColors().textColor); } else{ ofSetColor(timeline->getColors().outlineColor); } ofRect(bounds.x, bounds.y, bounds.width, bounds.height); ofPopStyle(); ofPushStyle(); draw(); ofPopStyle(); if(isPlaying){ float playheadScreenX = millisToScreenX(currentTrackTime()); if(isOnScreen(playheadScreenX)){ ofPushStyle(); ofSetColor(timeline->getColors().keyColor); ofLine(playheadScreenX, bounds.getMinY(), playheadScreenX, bounds.getMaxY()); ofPopStyle(); } } viewIsDirty = false; }
void ofxTLNotes::update(){ long thisUpdateSample = timeline->getCurrentTimeMillis(); for (int i = 0; i < keyframes.size(); ++i) { ofxTLNote* key = (ofxTLNote*)keyframes[i]; // track trigger on/off key->wasOn = key->isOn; key->isOn = key->timeRange.contains(thisUpdateSample); if(key->isOn && !key->wasOn){ key->triggeredOn = true; } else if (!key->isOn && key->wasOn){ key->triggeredOff = true; } // reset 'read' flag if we used it if (key->triggerWasRead) { key->triggeredOn = key->triggeredOff = false; key->triggerWasRead = false; } // grow active notes if(key->growing){ key->timeRange.max = currentTrackTime(); } } }
void ofxTLBangs::bangFired(ofxTLKeyframe* key){ ofxTLBangEventArgs args; args.sender = timeline; args.track = this; //play solo change //args.currentMillis = timeline->getCurrentTimeMillis(); args.currentMillis = currentTrackTime(); args.currentPercent = timeline->getPercentComplete(); args.currentFrame = timeline->getCurrentFrame(); args.currentTime = timeline->getCurrentTime(); ofNotifyEvent(events().bangFired, args); }
void ofxTLBangs::update(){ // if(isPlaying || timeline->getIsPlaying()){ long thisTimelinePoint = currentTrackTime(); for(int i = 0; i < keyframes.size(); i++){ if(timeline->getInOutRangeMillis().contains(keyframes[i]->time) && lastTimelinePoint < keyframes[i]->time && thisTimelinePoint >= keyframes[i]->time){ // ofLogNotice() << "fired bang with accuracy of " << (keyframes[i]->time - thisTimelinePoint) << endl; bangFired(keyframes[i]); lastBangTime = ofGetElapsedTimef(); } } lastTimelinePoint = thisTimelinePoint; // } }
void ofxTLCameraTrack::draw3d(){ if(lockCameraToTrack) return; ofxTLCameraFrame interFrame; ofNode n; ofPushStyle(); for(int i = 0; i < keyframes.size(); i++){ ofxTLCameraFrame* frame = (ofxTLCameraFrame*)keyframes[i]; n.setPosition(frame->position); n.setOrientation(frame->orientation); n.draw(); ofPushStyle(); ofPopStyle(); } unsigned long long startMillis = screenXToMillis(bounds.x); unsigned long long endMillis = screenXToMillis(bounds.getMaxX()); unsigned long long step = (endMillis - startMillis)/100; for(unsigned long long millis = startMillis; millis < endMillis; millis += step ){ setCameraFrameToTime(&interFrame, millis); n.setPosition(interFrame.position); n.setOrientation(interFrame.orientation); ofSetColor(0,0,255); ofLine(n.getPosition(), n.getPosition() + n.getLookAtDir()*10); ofSetColor(0,255,0); ofLine(n.getPosition(), n.getPosition() + n.getUpDir()*10); ofSetColor(255,0,0); ofLine(n.getPosition(), n.getPosition() + n.getSideDir()*10); } setCameraFrameToTime(&interFrame, currentTrackTime()); n.setPosition(interFrame.position); n.setOrientation(interFrame.orientation); ofSetLineWidth(3); ofSetColor(0,0,255); ofLine(n.getPosition(), n.getPosition() + n.getLookAtDir()*25); ofSetColor(0,255,0); ofLine(n.getPosition(), n.getPosition() + n.getUpDir()*25); ofSetColor(255,0,0); ofLine(n.getPosition(), n.getPosition() + n.getSideDir()*25); ofNoFill(); ofSetColor(255); ofDrawBox(n.getPosition(), 4); ofPopStyle(); }
//draw your keyframes into bounds void ofxTLLFO::draw(){ //we draw keys our own way //ofxTLKeyframes::draw(); if(bounds.width == 0 || bounds.height < 2){ return; } if(shouldRecomputePreviews || viewIsDirty){ recomputePreviews(); } ofSetColor(timeline->getColors().disabledColor, 30); float currentPercent = sampleAtTime(currentTrackTime()); ofFill(); ofRect(bounds.x, bounds.getMaxY(), bounds.width, -bounds.height*currentPercent); ofPushStyle(); ofSetColor(timeline->getColors().keyColor); preview.draw(); for(int i = 0; i < keyframes.size(); i++){ //make sure it's on screen if(isKeyframeIsInBounds(keyframes[i])){ //we know the type because we created it in newKeyframe() //so we can safely cast ofxTLLFOKey* lfoKey = (ofxTLLFOKey*)keyframes[i]; if(isKeyframeSelected(keyframes[i])){ ofSetLineWidth(2); ofSetColor(timeline->getColors().textColor); } else if(keyframes[i] == hoverKeyframe){ ofSetLineWidth(4); ofSetColor(timeline->getColors().highlightColor); } else{ ofSetLineWidth(4); ofSetColor(timeline->getColors().keyColor); } float screenX = millisToScreenX(keyframes[i]->time); ofLine(screenX, bounds.y, screenX, bounds.y+bounds.height); } } ofPopStyle(); }
bool ofxTLSwitches::isOn(){ return isOnAtMillis(currentTrackTime()); }
bool ofxTLNotes::pitchIsOn(int pitch){ return pitchIsOnAtMillis(pitch, currentTrackTime()); }
void ofxTLKeyframes::draw(){ if(bounds.width == 0 || bounds.height < 2){ return; } if(shouldRecomputePreviews || viewIsDirty){ recomputePreviews(); } ofPushStyle(); //draw current value indicator as a big transparent rectangle ofSetColor(timeline->getColors().disabledColor, 30); //jg play solo change //float currentPercent = sampleAtTime(timeline->getCurrentTimeMillis()); float currentPercent = sampleAtTime(currentTrackTime()); ofFill(); ofRect(bounds.x, bounds.getMaxY(), bounds.width, -bounds.height*currentPercent); //***** DRAW KEYFRAME LINES ofSetColor(timeline->getColors().keyColor); ofNoFill(); preview.draw(); //**** DRAW KEYFRAME DOTS //**** HOVER FRAME if(hoverKeyframe != NULL){ ofPushStyle(); ofFill(); ofSetColor(timeline->getColors().highlightColor); ofVec2f hoverKeyPoint = screenPositionForKeyframe( hoverKeyframe ); ofCircle(hoverKeyPoint.x, hoverKeyPoint.y, 6); ofPopStyle(); } //**** ALL CACHED VISIBLE KEYS ofSetColor(timeline->getColors().textColor); ofNoFill(); for(int i = 0; i < keyPoints.size(); i++){ ofRect(keyPoints[i].x-1, keyPoints[i].y-1, 3, 3); } //**** SELECTED KEYS ofSetColor(timeline->getColors().textColor); ofFill(); for(int i = 0; i < selectedKeyframes.size(); i++){ if(isKeyframeIsInBounds(selectedKeyframes[i])){ ofVec2f screenpoint = screenPositionForKeyframe(selectedKeyframes[i]); float keysValue = ofMap(selectedKeyframes[i]->value, 0, 1.0, valueRange.min, valueRange.max, true); if(keysAreDraggable){ string frameString = timeline->formatTime(selectedKeyframes[i]->time); timeline->getFont().drawString(ofToString(keysValue, 4), screenpoint.x+5, screenpoint.y-5); } ofCircle(screenpoint.x, screenpoint.y, 4); } } ofPopStyle(); }
void ofxTLKeyframes::addKeyframe(float value){ //play solo change addKeyframeAtMillis(value, currentTrackTime()); }
float ofxTLKeyframes::getValue(){ return getValueAtTimeInMillis(currentTrackTime()); }
void ofxTLBangs::playbackStarted(ofxTLPlaybackEventArgs& args){ ofxTLTrack::playbackStarted(args); lastTimelinePoint = currentTrackTime(); }
ofColor ofxTLColorTrack::getColor() { //play solo change // return getColorAtMillis(timeline->getCurrentTimeMillis()); return getColorAtMillis(currentTrackTime()); }