1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Embedding NodeBox in a Cocoa App

Posted by Matthew Tylee Atkinson on Jun 19, 2008

I am new to Mac development (but have done development on both Linux and Windows in the past). I would very much like to embed NodeBox -- specifically the output of the Graph library -- into a Cocoa application. The type of execution model I'm after is actually very similar to the web-app side of Perception.

I would like to have an output window and some other GUI elements that allow the user to add/remove nodes to the graph, and have the graph animate to show these changes. For this to work, I gather the best way would probably to have the NodeBox/Graph script as the main program and somehow link the other Cocoa Controls to this -- ideally using the standard XCode + Interface Builder approach to development. It's actually very important to me that I would be able to use XCode et al because I would like to incorporate a number of other frameworks. I know it is possible to create a PyObjC app with XCode, but not how to integrate NodeBox with this.

I noticed some stuff in the docs about drawing to a Cocoa canvas (using _drawRect()), but I was not sure (a) if this was the right approach or, (b) if what I want to do is actually possible :-).

Really what I'm looking for is an answer as to if it's possible and ideally also some pointers on what I need to learn before I can start implementing it.

Thanks for this great application! (I'd also love to know how you did the web-app -- I can't find any documentation on it and it seems to work in many browsers, too, so doesn't appear to be Mac-specific.)


 
Posted by _toby on Jun 23, 2008

It seems that you look for the same options like me.

We also looking for GUI Elements to integrate it to the NodeBox Player - or to use NodeBox as rich Library for Python.
The possibilities are impressive.
Looking forward for a statement about that.



Posted by Tom De Smedt on Jul 03, 2008

Hi guys,

There are some notes in the Console tutorial, though I'd need to run some tests if that is still up to date. Support for embedding will improve greatly in the future. Right now I can't put a date on it when that will happen, but it will happen, rest assured.

A first step we're working on now is the improvement of GUI's in NodeBox (i.e. what is now the var() command.

The web-app for Perception uses the HTML Canvas element, which is a drawing canvas addressed with Javascript. This way it can run on Mac/PC in both Safari and Firefox (and possibly other browsers as well).



Posted by Matthew Tylee Atkinson on Jul 08, 2008

Thanks very much for your reply and the information you've provided (including how the web-app works; very impressive!)

I will await further developments regarding embedding.

It's interesting that you mentioned that var() feature as my research is partly concerned with the connection between UI elements and data. I was wondering, for example, if you have had to make .nib files to enable that feature to work -- a question I will hopefully be able to answer for myself soon after looking at the NodeBox source :-).

Thanks again; this is a great project! I very much look forward to more embedding support in the future.

best regards,


Matthew