how to create a node and add a custom attribute

122 views
Skip to first unread message

alexander pena

unread,
May 1, 2012, 9:08:05 AM5/1/12
to coral-app
I am trying to add BREP scripting into CORAL using a language I
developed OpenShapefactory based on Opencascade.

does anyone know how to do the following:

- how to Create a simple C++ node where I can add my Opencascade
Snippets to execute in the update function. (after creating the python
boost part, how is that node compiled, can this be done from visual
studio or is it compiled with scons using bjam, how is this setup
done?).

- how to extend coral and Add a custom c++ class attribute to the
existing attribute types, namely a TopoDS_Shape (class object) which
is the base object for all BREP operations.

-create a custom front-end QT widget for node, (I am trying to create
a node which when double clicked shows a texteditor then in this
window the user would type code written in my language, this way with
a single node which is a script node, I can do Any operation I already
have in my system, and the user can make custom brep scripts).

is there a way of using only the coral-standalone editor with depenout
any dependencies to openimage or other libraries, except for TBB which
is needed for the multithreading part of the dataflow.

I only really need the interface and a way for me to add my own
nodes,I can tessellate my Brep objects and send that array of
triangles and other drawing data to opengl easily.

Any Ideas?

Alex


Andrea Interguglielmi

unread,
May 1, 2012, 11:42:41 AM5/1/12
to cora...@googlegroups.com
Hi Alexander,

I'd suggest starting from this example node: http://code.google.com/p/coral-repo/source/browse/#git%2Fcoral%2Fexamples%2FjitternNode

As for creating customized widgets for your nodes in the node-editor, this example shows a more complex node with polymorphic data and also has a customized look in the node-editor (look inside jitterNodePluginUi.py):
http://code.google.com/p/coral-repo/source/browse/#git%2Fcoral%2Fexamples%2FjitternNode%253Fstate%253Dclosed

That gives you the most simple entry points to custom nodes, you could then look in the core nodes folder to see more advanced stuff, and if something doesn't make sense just ask away : )

We are discussing the dependency on OpenIMageIO, it is indeed a bit of a drag and it's probably best to isolate the core from that.
If you feel like going ahead and removing it and contributing back, let me know, as I said I'm going to be very busy from now on.

Thanks,
Andrea

Andrea Interguglielmi

unread,
May 1, 2012, 11:50:31 AM5/1/12
to cora...@googlegroups.com
I just noticed I pointed you to the wrong example for customized node-editor widgets, there is no example to that : )
But we have plenty of that stuff in this internal file:
http://code.google.com/p/coral-repo/source/browse/coral/coralUi/py/coralUi/builtinUis.py

You want to look for anything that inherits from NodeUi and AttributeUi.

At the end of the file you'll see the registration entry point.

alexander pena

unread,
May 2, 2012, 1:39:37 PM5/2/12
to cora...@googlegroups.com
Hi Andrea,

Thanks for taking the time to followup and congratulations on your new job.
Ill see the examples you pointed out.

on another note may be for others in the forum to answer: is there any reason why coral is built using scons, could be built using cmake?
I cant figure-out from reading the code if scons is only compiling c++ code or if its also compiling python code (pyd) or if its performing any housekeeping operations like moving a python plugin into the plugin folder or something of that nature).

is scons moving files? as well as compiling?, and is it compiling python code as well? is scons calling bjam(boosts building tool) for the boost python binding?

after c++ code is compiled using boost, where is that plugin placed by the system, does it create a new lib/sitepackage in the users python folder? and does it compile it as an executable or as a shared library ( .Lib or DLL if in windows or So if in linux)

if so how can you make a plugin deploy-able so that I can take a working version of coral with my custom plugins and zip it, and deploy it for others to use, without needing installation of any dependencies?

Best,

Alex

Andrea Interguglielmi

unread,
May 2, 2012, 2:33:03 PM5/2/12
to cora...@googlegroups.com
Hi Alexander,


On Wed, May 2, 2012 at 10:39 AM, alexander pena <arc....@gmail.com> wrote:
Hi Andrea,

Thanks for taking the time to followup and congratulations on your new job.
Ill see the examples you pointed out.

on another note may be for others in the forum to answer: is there any reason why coral is built using scons, could be built using cmake?
I cant figure-out from reading the code if scons is only compiling c++ code or if its also compiling python code (pyd) or if its performing any housekeeping operations like moving a python plugin into the plugin folder or something of that nature).

Scons is used to compile the c++ code into shared libraries, one for the core, one for the ui, and if compiling for maya there will also be the maya-plugin.

Our friends over at http://proceduralinsight.com/ do have a proprietary CMake toolchain, feel free to contact them about getting professional assistance with that.


is scons moving files? as well as compiling?, and is it compiling python code as well? is scons calling bjam(boosts building tool) for the boost python binding?


At the end of the compilation step there's some plain python code for copying the right files into the build dir, we assemble the build depending on the target, coral-standalone or coral-maya.

You could as well use the SConstruct files inside the core and the Ui folders to build the shared libraries and then do your own installation.

We don't use bjam, just plain scons.

after c++ code is compiled using boost, where is that plugin placed by the system, does it create a new lib/sitepackage in the users python folder? and does it compile it as an executable or as a shared library ( .Lib or DLL if in windows or So if in linux)


Everything goes in a build subdirectory in your main coral dir.
 
if so how can you make a plugin deploy-able so that I can take a working version of coral with my custom plugins and zip it, and deploy it for others to use, without needing installation of any dependencies?


When deploying coral as a standalone and self contained app (we do that on mac) we just copy every dependency and a python parser in a folder and expose the parser as an executable.

Hope that clears a bit the overall building process, let me know if something is not yet clear : )

Reply all
Reply to author
Forward
0 new messages