On 01/01/2017 at 07:10, xxxxxxxx wrote:
are we able to write something like XpressoNode Plugins similar to the PointNode?
Of course, I could do it with the PythonNode, but I´d like to restict the inports and outports to what the node is able to work with. And if, is there an example somewhere?
Thx, a happy new year ans greetings
On 01/01/2017 at 09:09, xxxxxxxx wrote:
As I know you can't create custom xpresso node in python (which is really sad. it will be a really nice feature).
You can do it in c++ look at this https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_gv_operator_data.html
After if you want to stick to python you can make an Xgroup with the python code and lock it so people won't have acces to the python code.
For dealing with multiple type of input you can probably do it with https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.modules/graphview/GvNode/index.html#c4d.modules.graphview.GvNode for getting the parented xgroup of your python node andthen change his input/output.
Hope it was helpful.
On 01/01/2017 at 13:38, xxxxxxxx wrote:
I think working with GvNode is a quite good idea to control inports and outports, but dealing with it isn´t really intuitive. I was able to remove ports, but creating ... :(
import c4d #PYTHON NODE def main() : xgroup = op.GetUp() objectInbool = xgroup[c4d.ID_USERDATA,2] cornerINbool = xgroup[c4d.ID_USERDATA,3] radiusINbool = xgroup[c4d.ID_USERDATA,4] #for i in xrange(op.GetInPortCount()) : #xgroup.RemovePort(xgroup.GetInPort(0)) ID = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(2)) port = xgroup.AddPort(c4d.GV_PORT_INPUT, ID, c4d.GV_PORT_FLAG_IS_VISIBLE, True)
And anyway, is it possible or recommended from pythonNode?
Thx and greetings
Ok, adding outport for op works, but for the xgroup doesnt work.
import c4d #PYTHON NODE def main() : xgroup = op.GetUp() print xgroup port = xgroup.AddPort(c4d.GV_PORT_OUTPUT, c4d.OUT_LONG, c4d.GV_PORT_FLAG_IS_VISIBLE, True) print port #port = op.AddPort(c4d.GV_PORT_OUTPUT, c4d.OUT_LONG) #print port
On 01/01/2017 at 15:06, xxxxxxxx wrote:
Ok, it seems it is simply not possible to add ports to xgroups alike all other operators (of course) beside the python operator. :(
On 03/01/2017 at 03:44, xxxxxxxx wrote:
The Python XPresso node source code can only operate within itself. It's not meant to be used to change anything outside of its context e.g. in other XPresso nodes, in the active document etc.
Some operations could work but that's not recommended and could lead to crashes/strange behaviors sooner or later.
On 03/01/2017 at 04:37, xxxxxxxx wrote:
thx for your reply. I´ll keep it mind.