Recording flow only for frame of interest.

This commit is contained in:
Nick Winter 2014-05-16 16:52:55 -07:00
parent 891471b80a
commit f64e50f85b
4 changed files with 26 additions and 21 deletions

View file

@ -238,13 +238,13 @@ self.retrieveValueFromFrame = function retrieveValueFromFrame(args) {
self.enableFlowOnThangSpell = function (thangID, spellID, userCodeMap) { self.enableFlowOnThangSpell = function (thangID, spellID, userCodeMap) {
try { try {
if (userCodeMap[thangID][spellID].originalOptions.includeFlow === true && var options = userCodeMap[thangID][spellID].originalOptions;
userCodeMap[thangID][spellID].originalOptions.noSerializationInFlow === true) if (options.includeFlow === true && options.noSerializationInFlow === true)
return; return;
else else
{ {
userCodeMap[thangID][spellID].originalOptions.includeFlow = true; options.includeFlow = true;
userCodeMap[thangID][spellID].originalOptions.noSerializationInFlow = true; options.noSerializationInFlow = true;
var temporaryAether = Aether.deserialize(userCodeMap[thangID][spellID]); var temporaryAether = Aether.deserialize(userCodeMap[thangID][spellID]);
temporaryAether.transpile(temporaryAether.raw); temporaryAether.transpile(temporaryAether.raw);
userCodeMap[thangID][spellID] = temporaryAether.serialize(); userCodeMap[thangID][spellID] = temporaryAether.serialize();

View file

@ -20,6 +20,7 @@ module.exports = class Mark extends CocoClass
@build() @build()
destroy: -> destroy: ->
createjs.Tween.removeTweens @mark
@mark?.parent?.removeChild @mark @mark?.parent?.removeChild @mark
@markSprite?.destroy() @markSprite?.destroy()
@sprite = null @sprite = null

View file

@ -85,6 +85,12 @@ module.exports = class World
frameToLoadUntil = @totalFrames frameToLoadUntil = @totalFrames
i = @frames.length i = @frames.length
while i < frameToLoadUntil while i < frameToLoadUntil
if @debugging
for thang in @thangs when thang.isProgrammable
userCode = @userCodeMap[thang.id] ? {}
for methodName, aether of userCode
framesToLoadFlowBefore = if methodName is 'plan' then 200 else 1 # Adjust if plan() is taking even longer
aether._shouldSkipFlow = i < loadUntilFrame - framesToLoadFlowBefore
try try
@getFrame(i) @getFrame(i)
++i # increment this after we have succeeded in getting the frame, otherwise we'll have to do that frame again ++i # increment this after we have succeeded in getting the frame, otherwise we'll have to do that frame again

View file

@ -41,8 +41,6 @@ module.exports = class DebugView extends View
calculateCurrentTimeString: => calculateCurrentTimeString: =>
time = @currentFrame / @frameRate time = @currentFrame / @frameRate
console.log "Current frame is",@currentFrame
console.log "Current framerate is",@frameRate
mins = Math.floor(time / 60) mins = Math.floor(time / 60)
secs = (time - mins * 60).toFixed(1) secs = (time - mins * 60).toFixed(1)
"#{mins}:#{@pad2 secs}" "#{mins}:#{@pad2 secs}"