Notifications
Clear all

[Closed] A new dynamic text problem

Because this problem is very urgent , I have to post a new thread to look for more help.
I set up a controller and give it to a parameter “myNumber”. The problem is when I move the time slider, the spinner changes its value . While the spinner’s value is changing through time to time, nothing happened to it’s event handle.
thanks everyone’s help!

 plugin simpleObject TestObject 
  name:"TestObject"
  classid:#(0x68175071, 0x60425371)
  category:"Tests"
  (
  	local params --pre-declare the rollout to make it visible to the paramblock
  
  	parameters main rollout: params
  	(
  		myNumber type:#integer animatable:true ui:spnNum default:0 --change to boolean
  		on myNumber set val do (
  			format "mynumber:%
" val
  			params.edtName.text = "myNumber is " + ( val as string)
  		)
  	)
  
  	rollout params "Change text"
  	(
  		button btnTest "setAnimation"
  		edittext edtName text:"None"
  		spinner spnNum "myNumber" range:[-1000,1000,0]
  		 fn setAnimation =
  		 (
  			local tmpCntrl = linear_float()
  			addnewkey tmpCntrl 10
  			addnewkey tmpCntrl 80
  			tmpCntrl.keys[1].value = 100
  			tmpCntrl.keys[2].value = 800		
  			myNumber.controller = tmpCntrl
  		 )
  		on btnTest pressed do setAnimation()
  	)
  
  	tool create
  	(
  		on mousePoint click do
  		(
  			case click of
  			(
  				1: (nodeTM.translation = gridPoint; #stop)
  			)
  		)
  	)
  )
1 Reply

You can start 10 threads, but the “problem” remains the same – the animation controller is not considered a SET event.
If you need something to happen on every update of the plugin including time changes, you can do it inside the buildMesh() handler which WILL be called each time a parameter updates now that you have an animated track in the paramBlock.

	on buildMesh do
	(
		format "mynumber:%
" myNumber
	)

The ‘on someParam set value do()’ handler is only called when something SETS the value of the parameter, but an already keyframed controller is not such an event. See my answer in the original thread.