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.

Show your WorkFrom the old forum

Custom Node Test(Fixed)

9 replies Last reply

  1. Hi ahuman,

    This looks very interesting! I have not tried fooling around with the nodeLibrary stuff in custom nodes myself. What you've done here with retrieving all the node names looks pretty cool. I might find this useful for some upcoming projects. Are you planning on doing anything particular with it?

    As you know by now there is very little documentation about how to make custom nodes. I have about 15 in my node library; the rest of my nodes are actually subnetworks. My custom nodes are all fairly simple, but I had to do a lot of trial and error to get them to work at all. There is much fresh territory to explore here.

    Thanks for sharing this and please feel free to share your future experiments.

    John

    Copy link
  2. John,
    I'm trying to figure out how NodeBox works by exploring NodeBox's source code. I want to make a custom nodelibrary and make referenceable node.

      By the way, I found many links of python libray in zip format on the forum is unavailable. Why? Do you know?
    
      And, I want to make a myown version of NodeBox. Serveral weeks ago, I try to do that, but encountering some compiling problem. After F update the NodeBox, I found the compiling tools F provided is changed. Perhaps this time the problem would be sovled. But I have to understand how NodeBox's source code works in detail first.
    
     I have no plan, just some thoughs.
    
     And I am happy to sharing. I did downlaod many of your ndbx files for learning, and thanks your sharing too.
    

    aman.

    Copy link
  3. Aman,

    When you say "links of python library", do you mean links to zipped attachments to notes in this forum? I am not aware of any such zip files that are unavailable. Do you mean you can't download them at all, or that you can but they come down corrupted?

    Could you please point me to some specific messages and attachments that you are having trouble with?

    I wish you luck with your efforts to fork NodeBox. It is something that others have suggested over the years. Parts of NodeBox are rather sophisticated, and other parts are outdated, and the basic structure of mostly an older version of Python atop Jython atop Java is a bit unusual these days I think. So it will be a challenge.

    Learning how to make referenceable custom nodes - and sharing that progress - is an excellent project and much needed! Thank you for embarking on that. I am eager to see what else you uncover.

    John

    Copy link
  4. John,

       Thanks for sharing some infomation about the Python. I just knew that NodeBox is based on Jython, and didn't know it is based on an older one. Actually I am not familiar with python even Jython, but C#. I will try.
        About the links of python libraries are unavailable, I meant the problem I encountered on downloading from this link https://www.nodebox.net/code/data/media/photobot-intel.zip , which referred from this page https://www.nodebox.net/code/index.php/PhotoBot.html .
    

    aman.

    Copy link
  5. Aman,

    Thanks again for finding the Python code to lookup all the Nodebox names. I expanded on your idea and produced a custom node that retrieves much more, including the node icon and port info.

    I just posted a demo with a complete Node Catalog here:

    https://forum.nodebox.net/t/19551296/node-catalog

    Nice working with you!

    John

    Copy link
  6. Hi, John,
    I just read your python code. This part is a nice demo for me:

    def getNodeIcons(context,nodeName,other):
        library = context.nodeLibrary    
        nodeRepository = library.getNodeRepository()   
        nodes=nodeRepository.getNodes()
        for node in nodes:
            thisNode = node.getName()
            thisCategory = node.getCategory()
            if other == True and thisCategory != 'geometry' and (nodeName == 'reflect' or nodeName == 'sort'): thisNode = 'skip'
    
            if nodeName == thisNode:
                all = []
                bi=NetworkView.getImageForNode(node,nodeRepository)
                raster = bi.raster
                rType = raster.numDataElements
                w = raster.width
                h = raster.height
                for i in [int(x) for x in range(0, int(h))]:
                    for j in [int(x) for x in range(0, int(w))]:
                        c = bi.raster.getPixel(j,i,[0.0,0.0,0.0,0.0])
                        all.append(c[1])
                return all
    
        return 0
    

    Thanks. And , you improved the appearance showing inner info of NodeBox.
    aman.

    Copy link
  7. John,
    About the python library, I want to look for a image library. But After I read enough python code, I think I can create a pure python code version image node.

        Another thing I am concerning these days are creating a perfect curve which is defined by funtion. What's perfect curve? I mean it's real smooth, scalable, just like the other graphics of particular shapes. When you drawing a function curve by connecting straight lines, it's not perfect. Because the contacting point of any two lines are not smooth.
       I hope to create a node, input a function expression to it and it outputs a smooth function curve.
       I believe we can express any picture just by vector graphics, except the photos. A photo contains many infomation we don't archived. When you design something, you have to give out some enough information to form the vector graphics.
    

    aman.

    Copy link
  8. Aman,

    I developed a similar fascination with curves in NodeBox some years ago. I think you've seen my make_curve node, which lets you build paths our of cubic beziers instead of polylines. I use it in some of my other nodes, like waveform, that produce perfect curves. My explode node lets you disassemble paths into separate curves and line segments, which you can then work with directly.

    Internally, NodeBox uses cubic beziers (with 2 control points) extensively, so it's odd there no core node to let us make them directly. The quad node produces curves with only one control point (but is represented internally with two!). The ellipse and arc nodes build curves out of cubic curves which can only cover 90 degrees at a time, so it takes four of them to make a circle. Of course its also possible to create higher order curves with even more control points, though in practice two seems to be enough for most things (when joined to form splines).

    As I became more obsessed with using perfect curves instead of imperfect polylines, I started learning more about the mathematics of curves. It is a very deep topic with many still open questions. There are many different kinds of curves, not all of which can be defined by a function.

    After being on this journey for awhile I have recently gained a renewed appreciation for polylines, however. You say curves are perfect and polylines are not; but in fact all curves on computers are turned into polylines sooner or later, whether they are drawn with a plotter or turned into pixels to be displayed on a screen.

    I do agree with you on the primacy of vectors for pretty much everything other than photos. That's why I love NodeBox.

    John

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply