idflood / ThreeNodes.js

vvvv "clone" in javascript/webgl
http://idflood.github.com/ThreeNodes.js/
Other
2.18k stars 316 forks source link

Optional timeline #31

Open poliveira89 opened 11 years ago

poliveira89 commented 11 years ago

I have done some changes on UI.coffee (and on the templates too) to disable some features on Sidebar and Timeline. And everytime I add an Node to container this appears (browser console):

Uncaught ReferenceError: anim is not defined Node.js:315

And I can't add other Node from the same type, eg: add "Number" can't add again impossible do drag&drop.

I have looked into the code and the line that throws the error is res = anim("nid-" + @get("nid"), @fields.inputs) from models/Node.coffee:

createAnimContainer: () =>
      res = anim("nid-" + @get("nid"), @fields.inputs)
      # enable track animation only for number/boolean
      for f of @fields.inputs
        field = @fields.inputs[f]
        if field.is_animation_property() == false
          @disable_property_anim(field)
      return res

Where is the anim(..)function? I can't find anywhere...

Thanks for the help :)

idflood commented 11 years ago

You are right, there is something wrong here. I think the anim should in fact be Anim. This function is part of timeline.js (https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/libs/timeline.js/timeline.js#L185)

But I quickly tried to reproduce the error without success. And if I change anim to Anim I have some other issue. So I will need to investigate this a little further.

By curiosity, which browser are you using (with version and OS) ?

poliveira89 commented 11 years ago

OS: Linux MInt 14 (64-bit) Kernel: 3.5.0-17-generic Browser: Chrome (Version 25.0.1364.172)

So, if anim or Anim is a part of timeline.js and I comment that line, there is no need to look to other block code to run "smoothly"?

idflood commented 11 years ago

Hmm, don't know exactly. You could try to add a return false or or return {} just before the res = anim(.... But I'm not sure if this will be enough.

poliveira89 commented 11 years ago

Now, the error have stopped...

I have done this ugly solution:

createAnimContainer: () =>
      return false
      (...)
      return res
@model.bind("node:showAnimations", @highlighAnimations)
ob.anim.objectTrack.name = ob.get("name")
anims.push(ob.anim)

And the error "flooding" stopped. What must be done to fully delete/disable timeline.js?

idflood commented 11 years ago

Looking again at the timeline.js there is a 'anim' function in lowercase: https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/libs/timeline.js/timeline.js#L354

The timeline path is defined in require-config.js ( https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/require-config.js#L26 ) And the timeline library is loaded in threenodes/views/Timeline.coffee ( https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/threenodes/views/Timeline.coffee#L5 )

So your solution is perfectly fine if you removed the timeline. Do you think I should make the timeline optional?

poliveira89 commented 11 years ago

Looking again at the timeline.js there is a 'anim' function in lowercase: https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/libs/timeline.js/timeline.js#L354

The timeline path is defined in require-config.js ( https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/require-config.js#L26 ) And the timeline library is loaded in threenodes/views/Timeline.coffee ( https://github.com/idflood/ThreeNodes.js/blob/master/src/scripts/threenodes/views/Timeline.coffee#L5 )

Thank you! I will take this in mind! :smile:

So your solution is perfectly fine if you removed the timeline. Do you think I should make the timeline optional?

I don't think, because I the only one that was talking about this.. :neutral_face: But, I have a suggestion, if you decide that could be optional, you can make throw arguments/options on boot.cofffee or App.coffee, this way the application it would much more modular as you pretended to be! :smile: and after this you could open a "window" to others optionals configurations :wink:

So, the error/issue has been handled (not in the best way), if you think that it's a finished subject you could close the issue! :wink:

idflood commented 11 years ago

The idea of having something modular is a goal, but the road to have something finished is still long : ) I've changed the title of the issue and will left it open since it's a good idea.