Scripted plugin - creating a shape plugin with a spline linked to two nodes
I am in the process of writing a scripted plugin which can do the following;
create a splineshape between two different nodes. When creating the plugin object, I need to initialize a node picking tool, which I cannot seem to get done. Second, when the spline is generated, it needs to be updated when the linked nodes are moved. I suppose this is done using shape instances? I just cannot find any reference to start from.
There is so little information about this in the help files, I figured I would post it in here.
I currently have this as a base for my plugin;
plugin shape Path_segment name:"Path Segment" classID:#(0x48238272, 0x48206285) extends:line replaceUI:true version:1 category:"Carmatools" ( local last_n1pos,last_n2pos,thesegment parameters main rollout:params ( node1_param type:#node ui:node1 node2_param type:#node ui:node2 ) rollout params "Params" ( label node1_label "Node1:" across:2 offset:[0,3] align:#right pickbutton node1 autodisplay:true label node2_label "Node2:" across:2 offset:[0,3] align:#right pickbutton node2 autodisplay:true on node1 picked obj do ( node1_param = obj node1.text = obj.name last_n1pos = obj.pos ) on node2 picked obj do ( node2_param = obj node2.text = obj.name last_n2pos = obj.pos ) ) tool create ( thesegment = splineshape pos:node1_param.pos addKnot thesegment 1 #corner #line node1_param.pos addKnot thesegment 1 #corner #line node2_param.pos updateShape thesegment thesegment ) )
obviously the tool section is a dummy and needs the proper code for my goals.
Has anybody done anything similar or can anybody help me out? Perhaps some of you have seen a similar script before and can point me in that direction?