How to bind components of a point3 custom attribute to separate UI spinners?


#1

Hi I expect this is pretty obvious to someone who knows. I’m working with a point3 custom attribute but I’m not sure how I’d display/interact with that in the UI which has sliders/spinners etc for floats but not vectors. How would I bind the components of the single point3 parameter to there own spinners? (On the assumption this is the correct way to approach it). Cheers

attributes TEST_CA
version:0
(
    Parameters main rollout:params
    (
        colorExample    Type:#color           UI:colorExample
        vectorExample    Type:#Point3     --UI:vectorExample
    )

    Rollout Params "Parameters"
    (
        colorpicker colorExample "Color Example:" color:[0,0,255] modal:false

        spinner vectorExampleX     "x" Height:16 Align:#Right Width:40 across:3
        spinner vectorExampleY     "y" Height:16 Align:#Right Width:40
        spinner vectorExampleZ     "z" Height:16 Align:#Right Width:40
    )
)

#2

SwordSlayer kindly assisted with this over discord. I’m providing their suggestion for others who may need it:

attributes TEST_CA attribID:#(0x50c62e9d, 0x3b9b5e48)
(
    parameters main rollout:params
    (
        vectorExample type:#Point3
    )

    rollout params "Parameters"
    (
        spinner vectorExampleX "x" height:16 align:#Right width:40 range:[-1e3, 1e3, 0] controller:vectorExample.controller.x.controller across:3
        spinner vectorExampleY "y" height:16 align:#Right width:40 range:[-1e3, 1e3, 0] controller:vectorExample.controller.y.controller
        spinner vectorExampleZ "z" height:16 align:#Right width:40 range:[-1e3, 1e3, 0] controller:vectorExample.controller.z.controller
    )

    on postCreate do this.vectorExample.controller = Point3_XYZ()
)

#3
testCA = attributes testCA attribid:#(12345,6789)
(
	parameters params rollout:params
	(
		tab type:#floattab tabsize:3 ui:(px_sp, py_sp, pz_sp)
		pos type:#point3
		
		on pos get val do
		(
			[tab[1],tab[2],tab[3]]
		)
		on tab set val index do 
		(
			--format "val:% index:%\n" val index
			pos = [tab[1],tab[2],tab[3]]
		)
		
	)
	rollout params "Params" width:191
	(
		spinner px_sp "X: " type:#float range:[-1e6,1e6,0] 
		spinner py_sp "Y: " type:#float range:[-1e6,1e6,0] 
		spinner pz_sp "Z: " type:#float range:[-1e6,1e6,0] 
	)
)

#4

this is a good solution, but what if you want a non-animatable point3 parameter?


#5

Hi Dennis thanks for your response, I didn’t get an alert so have only just seen it. Much appreciated.