I’ve written my first and very simple sine wave node using the python maya api.
In order to use the node I need to connect the time1 nodes outputTime to an attribute in my custom sine node called input.
I can do this manually every time I create the node, but thats not fun, I was wondering how to do it via the api, so everytime I create the node it automatically connects the two attributes together.
The typical “api approach” to this type of problem is to create a command along with your node in the same plug-in.
If all you’re doing is connecting attributes though, it’s an awful lot of overhead, so you’d be just as well to write a simple python function to do the same thing.
If you want to do it “properly” and create an API command to go with your node, check out RobTheBloke’s site. Look for API/SimpleNode example 2, where he does exactly what you want.
Many thanks, had a quick read and it certainly seems a lot of work for something so simple, I’ll have a dig through it tomorrow see if I can convert it to python.
If you’re wanting to do this in Python, then I don’t think it’s especially helpful to look at a site with C++ examples when there are plenty of free Python examples out there.
I have a few freebies on my site at the bottom of this page. I’d suggest looking at the Expose Transform plug-in, since it’s a bit cleaner and clearer than some others.