Notifications
Clear all

[Closed] Change Handler > make the slider control my object

Hi,

I’m not sure how to make the slider to control my object. This is a piece of code from my script:

try(destroyDialog ChangeHandlerTest)catch()
rollout ChangeHandlerTest "ChangeHandlerTest" width:150 height: 450 (

	button __createGrids "Create Grids" pos:[10,85] width:130 height:45
	checkbox __X pos:[15,140] checked:true
	label __createX "Create X plane" pos:[39	,140]
	button __tickX ">" pos:[115,136]

		on __createGrids pressed do (
			if __X.checked == true do (
				visPlaneX = plane length:20 width:20 transform:(matrix3 [0,-1,0] [0,0,1] [-1,0,0] [1,1,1]) boxmode:on
				visPlaneX.wirecolor = red
				visPlaneX.name = "resolutionPlaneX"
				visPlaneX.lengthsegs = 20
				visPlaneX.widthsegs = 20
			)
		)

		on __tickX pressed do (
			rollout posResGridX "Position Resolution Grid X" (
				slider __allignX range:[-100,100,0] type:#float ticks:10 orient:#horizontal
				when __allignX.value change do (
					print "it Works!"
					visPlaneX.pos.x = __allignX.value
				)
			)
			theNewFloater = newRolloutFloater "Position Resolution Grid" 400 80
			addRollout posResGridX theNewFloater
		)
) createDialog ChangeHandlerTest

I know how to make an object control another object by the change handler, but how to make the object use the value (__allignX) in realtime?

1 Reply

Ok i got it.

Change handler was too complicated, forgot that spinner has it’s own function for that:

			on __allignX changed val do (
				pointX.pos.x = __allignX.value
			)