Creating a canvas Node

MikeMike's Avatar

MikeMike

16 Jul, 2014 10:52 PM

Is it possible to create a Node that uses canvasHeight & canvasWidth? I'm trying to create a background node.

thanks

  1. Support Staff 1 Posted by Frederik De Ble... on 23 Jul, 2014 08:30 AM

    Frederik De Bleser's Avatar

    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

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

23 Mar, 2023 09:43 PM
23 Mar, 2023 09:24 AM
21 Mar, 2023 11:00 AM
21 Mar, 2023 09:32 AM
21 Mar, 2023 04:46 AM

 

12 Mar, 2023 03:02 AM
11 Mar, 2023 02:11 AM
10 Mar, 2023 06:47 AM
10 Mar, 2023 12:46 AM
02 Mar, 2023 08:49 PM
27 Feb, 2023 01:29 PM