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.
I'm loading custom colors via CSV Import in NodeBox3 but have no clue how to convert them to a real color.
I think I should use a custom Node for that (probably Python) but because there are no examples and documentation I have no clue how to do it.
Thanks for any advice.
Benny
FB
FBFrederik De BleserNodeBox team
The Color class has a constructor that takes a hexadecimal value. Just use
But how does python have access to the Color class in Java?
JO
JOjohn
Hi Jerimee,
Benny's original question was posted in January, 2013. Since then, after version 3.0.39 in March 2014, it is no longer necessary to create custom nodes to import colors from CSV files.
If your CSV has a color column with values formatted as hex values (e.g. #ECE8CE), you can just do a lookup on that column and pass the result directly into a color node or to the fill port of a colorize node. Other functions of that Java color class can be handled using existing NodeBox color nodes.
If your question was not so much about handling colors but about accessing Java code from within custom Python-based nodes, Frederik (NodeBox's creator) is much more knowledgeable than I am. My understanding is that some NodeBox nodes include references to original Java code accessed via Jython, "a version of Python 2.7 that runs on the JVM."
Please let us know if you are having a specific issue with either handling colors or accessing classes from within custom nodes. I can probably help with the former and Frederick or some other staff member should be able to help with the latter case.
Thanks,
John
FB
FBFrederik De BleserNodeBox team
John is absolutely right — the version of Python running in NodeBox is Jython, which has direct access to the Java VM. The Color class is not the one defined in Java, but NodeBox's own nodebox.graphics.Color, which is loaded into the Jython script for you by default.
Know something that helps?
Sign in with your email address to reply. No password needed.