The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.
How does Nodebox 1 decide whether a bot is an animation or a still image.
In our Shoebot, I think we toggle on whether there is a "draw" function, but I've seen other info that it might be calling speed() with a number > 0 that enables it.
This should help me remove some of the less sane code in Shoebot :)
KA
KAkarstenwo
In file console.py, in class NodeboxRunner method _check_animation() is self-explanatory.
See also usages of this method.
SA
SAStuart Axon
Ah, great - I was thinking that having speed with a default of None might be a way of implementing this.
Reassuring to see I was thinking along similar lines.
This is definitely enough to write some unit tests for Shoebot so our implementation is compatible.
SA
SAStuart Axon
While you're here: the canvas vs context distinction always confused me, is it that the graphics "context" is the current state, of graphics, while canvas is the thing it paints on ?
KA
KAkarstenwo
Hey, I only keep it alive ;-) and write some new stuff; occasionally.
...graphics "context" is the current state
Yes. It's in nodebox/graphics/init.py and should be adaptable to Shoe with minimal changes
...while canvas is the thing it paints on...
Yes. And it has connections to the Cocoa framework
I'll probably implement the same logic, but with tests, the code is pretty different + I'm working to gradually remove the weirder code (that I added about 7 years ago!).
BTW, for Shoebot I've started to add unit tests, including some assertions around image correctness, there stuff you can find useful
BTW, is _ctx when running a nodebox script, the same context ?
For the longest time, I've been working on this + not really understanding the nodebox codebase :) (I may be main dev, but I didn't start this project).
I feel like if I worker on it for long enough the codebase would end up looking like Nodeboxes exactly, but for now I'm happy to fix up the bugs and weirdness + maybe get it to the next release.
KA
KAkarstenwo
_ctx is the connection to the canvas for ximported libs. It's the Context() that is created when a nodebox script is run.
def _initNamespace(self, frame=1):
self.canvas.clear()
self.namespace.clear()
# Add everything from the namespace
for name in graphics.__all__:
self.namespace[name] = getattr(graphics, name)
for name in util.__all__:
self.namespace[name] = getattr(util, name)
# Add everything from the context object
self.namespace["_ctx"] = self.context
Know something that helps?
Sign in with your email address to reply. No password needed.