Is it possible to create a Node that uses canvasHeight & canvasWidth? I'm trying to create a background node.
thanks
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.
NodeBox 3From the old forum
Is it possible to create a Node that uses canvasHeight & canvasWidth? I'm trying to create a background node.
thanks
Yes, it is. We've built in a way to gain access to the rendering context. There, you can access data on the current document (called the NodeLibrary internally).
So you could create a node with one part called "context" of (custom) type "context". This will take in a NodeContext. Then you can write something like this (in Python):
def cook(context):
library = context.nodeLibrary
width = float(library.getProperty("canvasWidth"))
height = float(library.getProperty("canvasWidth"))
# Do whatever you want with width / height
Hope this helps,
F