NodeBox and Blender

szmarci's Avatar

szmarci

07 Nov, 2012 01:58 PM

Would it be possible to run the code (that is coming from NodeBox) inside Blender (that is scriptable with python)?

  1. Support Staff 1 Posted by Frederik De Ble... on 09 Nov, 2012 08:39 AM

    Frederik De Bleser's Avatar

    Not directly, no. The issue is the drawing library: we don't have a graphics API that is compatible with Blender's graphics API.

    If we (or someone from the community) could provide a bridge that links the two, then it would be possible.

  2. 2 Posted by Spirou4D on 23 Aug, 2017 05:19 PM

    Spirou4D's Avatar

    Hi Frederik De Ble...,

    I study the code of Nodebox because I need a python lib for create an addon that use a palette pie with Harmonies pattern like triade or opposite color etc...
    Is it a possibility to code a blender drawing lib to draw with the colors lib of Nodebox?
    or is it possible to use Nodebox OpenGL for that (with python and java).

    "colors lib" is amazing and simple. but contain drawing function from coca for MAC.

    If the drawing lib would be for blender: bpy, bgl, and blf, we must re-writte all the colors lib, no?

    I am very interesting to discuss with you about that, please?
    friendly.
    Patrick Depoix
    aka Spirou4D (blenderartist.com)

  3. Support Staff 3 Posted by Frederik De Ble... on 25 Aug, 2017 06:59 PM

    Frederik De Bleser's Avatar

    It's been a while since I've looked at the colors library, but AFAIK it would be possible to just use the color harmony algorithms (which return simple Python data structures) without using the drawing part (which would use the NodeBox drawing API).

    Is there a specific error you run in to?

  4. 4 Posted by Patrick Depoix on 27 Aug, 2017 07:55 AM

    Patrick Depoix's Avatar

    >>It's been a while since I've looked at the colors library, but as far as
    I know it would be possible to just use the color harmony algorithms (which
    return simple Python data structures) without using the drawing part (which
    would use the NodeBox drawing API).

    but "ximport" don't run with python because ximport is special to nodebox

    *and colors/__init__.py :*

    try:
        # NodeBox / Cocoa specific functionality.
        # Our library can still do a lot of interesting stuff without these!
        from nodebox.graphics import Grob, RGB, HSB, CMYK, CORNER
        from nodebox.graphics.cocoa import _restore, _save
        from AppKit import NSShadow, NSColor
        from AppKit import CIImage, CIColor, CIFilter, CIVector,
    NSGraphicsContext
    except:
        class Grob: pass

    This don't be used but I have a traceback with it!

    And I tried the first "colors example 1" and I must rewrite the import code
    like this:

    try:
        colors = __import__("colors")
    except ImportError:
        colors = __import__("__init__")
       #reload(colors)

    BUT "reload(colors)" don't run on my Python 3,5!!! Do you have a solution,
    please?

    I tried this "exec.module(colors)" but don't run too!

    Excuse me if I speak of details problems. I wanted to speak only about the
    use of the code with standart python: You answer me there are not problem
    with drawing module so I will try to code my custom bpy, bgl, blf, module
    for your colors module.
    Thanks
    At soon.

    Patrick Depoix

    Patrick Depoix *φ*Architecte D.P.L.G.Historien-chercheur en histoire de
    l'ArchitectureEx-Maître de conférence de l'Ecole d'Architecture de
    Lille-Région Nord
    Recherche en cours: Cimetière Brion.
    <https://plus.google.com/u/0/+PatrickDepoix/posts/7kLH8yzKpUh>

    http://www.linkedin.com/
    <http://www.linkedin.com/pub/patrick-depoix/40/b3b/542>
    <http://www.linkedin.com/profile/view?id=146146370&authType=name&authToken=m19Q&pvs=pp>136,
    rue d'Esquermes59000 LilleFranceTel (+33/0) 952 51 33 25
    Fax (+33/0) 957 51 33 25Port (+33/0) 06 23 13 73 71Skype:oikakeruPour
    répondre --> Mailto:[email blocked]
    <http://---%20http//www.linkedin.com/pub/patrick-depoix/40/b3b/542%20Patrick%20Depoix%20Architecte%20D.P.L.G.%20Historien-chercheur%20en%20histoire%20de%20l'Architecture%20Ex-Ma%C3%AEtre%20de%20conf%C3%A9rence%20de%20l'Ecole%20d'Architecture%20de%20Lille-R%C3%A9gion%20Nord136,%20rue%20d'Esquermes%2059000%20Lille%20France%20Tel%20%20%20(+33/0)%20952%2051%2033%2025%20Port%20%20(+33/0)%2006%2023%2013%2073%2071%20Fax%20%20(+33/0)%20826%2070%2004%2040%20Skype:oikakeru%20%20Pour%20r%C3%A9pondre%20--%3E%20Mailto:[email blocked]>

  5. 5 Posted by Patrick Depoix on 27 Aug, 2017 10:08 AM

    Patrick Depoix's Avatar

    Hi,

    After installed colors folder in Blender python/lib/site-packages/
    and run blender and in console windows, I typed this:

    >>> colors = __import__('colors')
    >>> clr2 = colors.olive()

    Traceback (most recent call last):
      File "<blender_console>", line 1, in <module>
      File "<string>", line 50, in <lambda>
      File
    "C:\Users\lenovo\Downloads\BLENDER\APPLICATION\blender-2.79-rc2-windows64\2.79\python\lib\site-packages\colors\__init__.py",
    line 640, in __init__
        elif kwargs.has_key("mode") \
    AttributeError: 'dict' object has no attribute 'has_key'

    => I don't understand why there are an error?

  6. 6 Posted by Patrick Depoix on 27 Aug, 2017 06:25 PM

    Patrick Depoix's Avatar

    OK Frederick,

    I corrected the code with python 3.0 functions because "has_key" for
    example is removed now!
    And the new code run:

    $ colors = __import__('colors')
    $ clr1 = colors.olive()
    $ print(str(clr1))
    $ Color(0.500, 0.500, 0.000, 1.000)

    So I will continue to obtain the code run correctly for python 3.6....
    Thanks.

    Friendly.
    Patrick Depoix
    ---
    Patrick Depoix *φ*Architecte D.P.L.G.Historien-chercheur en histoire de
    l'ArchitectureEx-Maître de conférence de l'Ecole d'Architecture de
    Lille-Région Nord
    Recherche en cours: Cimetière Brion.
    <https://plus.google.com/u/0/+PatrickDepoix/posts/7kLH8yzKpUh>

    http://www.linkedin.com/
    <http://www.linkedin.com/pub/patrick-depoix/40/b3b/542>
    <http://www.linkedin.com/profile/view?id=146146370&authType=name&authToken=m19Q&pvs=pp>136,
    rue d'Esquermes59000 LilleFranceTel (+33/0) 952 51 33 25
    Fax (+33/0) 957 51 33 25Port (+33/0) 06 23 13 73 71Skype:oikakeruPour
    répondre --> Mailto:[email blocked]
    <http://---%20http//www.linkedin.com/pub/patrick-depoix/40/b3b/542%20Patrick%20Depoix%20Architecte%20D.P.L.G.%20Historien-chercheur%20en%20histoire%20de%20l'Architecture%20Ex-Ma%C3%AEtre%20de%20conf%C3%A9rence%20de%20l'Ecole%20d'Architecture%20de%20Lille-R%C3%A9gion%20Nord136,%20rue%20d'Esquermes%2059000%20Lille%20France%20Tel%20%20%20(+33/0)%20952%2051%2033%2025%20Port%20%20(+33/0)%2006%2023%2013%2073%2071%20Fax%20%20(+33/0)%20826%2070%2004%2040%20Skype:oikakeru%20%20Pour%20r%C3%A9pondre%20--%3E%20Mailto:[email blocked]>

    =============================================================

  7. Support Staff 7 Posted by Frederik De Ble... on 15 Nov, 2017 04:59 PM

    Frederik De Bleser's Avatar

    Hi Patrick,

    Do you by any chance have a list of fixes that we could apply to the colors library to have it work in Blender and Python 3?

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

24 Mar, 2019 08:45 PM
24 Mar, 2019 12:07 AM
23 Mar, 2019 09:00 PM
22 Mar, 2019 06:37 AM
17 Mar, 2019 10:13 PM