Notifications
Clear all

[Closed] Load Animation with a Spinner

Hi everyone,

I’m trying to load an animation with one Spinner attribute that I have, so I wrote the code for it and works good.

There is a problem though, that when I animate the Spinner nothing happens in viewport, only it works when I change the spinner value myself (I mean using mouse and changing the value). The Spinner gets updated as timeslider moves, but nothing happens in viewport.

Here is the code:

animTriggerAT = attributes animTrigger(
	
	parameters triggerParams rollout:triggerRoll(
		refObjList type:#MaxObjectTab tabSize:0 tabSizeVariable:true
		trgObjList type:#MaxObjectTab tabSize:0 tabSizeVariable:true
		rootObjList type:#MaxObjectTab tabSize:0 tabSizeVariable:true
		triggerSpinnerSp type:#integer animatable:true ui:triggerSpinner
		
	)

	rollout triggerRoll "Drone Trigger" width:162 height:300(
		spinner triggerSpinner "Trigger" range:[0,200,0] type:#integer width:128 height:16
		
		fn calcTM val = (
			for i = 1 to trgObjList.count do(
				with animate off(
					if refObjList[i].node.parent != undefined then(
						trgObjList[i].node.transform = (at time val (refObjList[i].node.transform * inverse refObjList[i].node.parent.transform * refObjList[i].node.parent.transform)) * rootObjList[1].node.transform
					)else(
						trgObjList[i].node.transform = (at time val (refObjList[i].node.transform))	* rootObjList[1].node.transform
					)
				)
			)
		)
		
		on triggerSpinner changed val do(
			calcTM val 
		)
	)
)

custattributes.add $CTRL_Drone.modifiers[1] animTriggerAT

I’d be appreciated if you can see what’s wrong, and feedback me.

Thanks,
Ehsan