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) {
try {
if (userCodeMap[thangID][spellID].originalOptions.includeFlow === true &&
userCodeMap[thangID][spellID].originalOptions.noSerializationInFlow === true)
var options = userCodeMap[thangID][spellID].originalOptions;
if (options.includeFlow === true && options.noSerializationInFlow === true)
return;
else
{
userCodeMap[thangID][spellID].originalOptions.includeFlow = true;
userCodeMap[thangID][spellID].originalOptions.noSerializationInFlow = true;
options.includeFlow = true;
options.noSerializationInFlow = true;
var temporaryAether = Aether.deserialize(userCodeMap[thangID][spellID]);
temporaryAether.transpile(temporaryAether.raw);
userCodeMap[thangID][spellID] = temporaryAether.serialize();

View file

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

View file

@ -85,6 +85,12 @@ module.exports = class World
frameToLoadUntil = @totalFrames
i = @frames.length
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
@getFrame(i)
++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: =>
time = @currentFrame / @frameRate
console.log "Current frame is",@currentFrame
console.log "Current framerate is",@frameRate
mins = Math.floor(time / 60)
secs = (time - mins * 60).toFixed(1)
"#{mins}:#{@pad2 secs}"