Notifications
Clear all

[Closed] Wiring a node transform to a plugin parameter

Hi,

I’m really stuck undeerstanding why this isnt working, it seesm it should but maybe I’m missing something.

I have made a scripted plugin based on a helper and created a couple of parameters of point3 type to hold node positions. These will be used to calculate a custom curve I need to generate.

I want to wire these up to a couple of dummys or other scene nodes so that when I move them the parameters on the scripted plugin get updated with the new position and the curve calculated.

However whichever way I hook up the nodes position to the scripted help parameters the plugin code does not evaluate the new value. The value has changed if I check it but this change does not trigger an update of the internal code.

I’m using the set and get event handlers so if I query the attribute then the evaluation fires but if I move the node connected by paramwire or scripted controller then it does not re-evaluate.

I’ve tried everything I cna think of and have been pouring over the manual,
Is that something someone has run into before? max 2012 btw.

Thanks for any answers

4 Replies

Could you post the file so I could take a look at it?

Thanks for looking in Viro.

Yes I’ve knocked up a simple example that demonstrates the problem.

So run the code and you should end up with a scene with two Dummy objects and the scripted helper. The Dummypositions are driving the helper attributes by paramater wiring.

You see that when you move one of the dummys that the compute function is not triggered in the helper or the events that call it.

However if you query the attribute value then they get called.

Thanks for any input on this

plugin Helper NodeComputer
  name:"NodeComputer"
  classID:#(0x47db14fe, 0x4e9b5f90)
  category:"Standard"
  extends:dummy
  (
     
  	fn compute start end = 
  	(
  		print "computing"
  		
  		result = end-start
  		print result
  	)
  	
  	parameters pblock
  	(
  		curveStart type:#point3 animatable:true
  		curveEnd type:#point3 animatable:true
  		
  		on curveStart get val do
  		(
  			print "Get curve start"
  			compute val curveEnd
  		)
  		
  		on curveStart set val do
  		(
  			print "Set curve start"
  			compute val curveEnd
  		)
  		
  		on curveEnd get val do
  		(
  			print "Get curve end"
  			compute curveStart val 
  		)
  		
  		on curveEnd set val do
  		(
  			print "Set curve end"
  			compute curveStart val 
  		)
  		
  	)
  	
    
  	tool create
  	(
  		on mousePoint click do
  		(
  			nodeTM.translation = gridPoint;#stop
  		)
  	)
  )
  
  
  (
  	delete $objects
  	
  	Dummy pos:[-62.5657,20.8247,0] isSelected:on
  	Dummy pos:[44.1285,-38.9447,0] isSelected:on
  	
  	NodeComputer pos:[9.44438,-1.7226,0] isSelected:on
  		
  	paramWire.connect $Dummy001.transform.controller[#Position] $NodeComputer001.baseObject[#curveStart] "Position"
  	paramWire.connect $Dummy002.transform.controller[#Position] $NodeComputer001.baseObject[#curveEnd] "Position"
  	
  )
  

If you want to acces properties that you inherited from your extended object you have to use the delegate.
this.position.controller will not work
delegate.position.controller will

Thanks Nysuatro.

But this doesnt solve my problem does it? if i query the plugin instance attribute from the listener e.g $NodeComputer.curveStart then the event is triggered and the compute function is called pringing a result.

However if i move one of the dummys that is wired to the curveStart attr then the event does not trigger, that is the nub of the problem. Forgive me if you have given me the solution but I dont see it.

Thanks