Dropdownlist problem


#1

Hi
Why the scaling change is not in realtime and to see the result i have to move the sliderTime ?
But when i use the dropdownlist from the Animation—>parameter editor, the scaling change will be in realtime

delete objects
TheObj = teapot()

MyAt=(EmptyModifier())
	caDef = attributes SclCnt
	(
	Parameters Params Rollout:RO
		(
		Dropp type:#index default:1  animatable:on ui:P_list
		)--end Paramaters

	Rollout RO "Test"
		(		dropdownlist P_list "Drop_test" width:130 height:6 align:#left items:#	("1","2","3")	)	
	)
	addModifier TheObj MyAt
	custAttributes.add MyAt caDef
	


		SclScript=TheObj.scale.controller = scale_script()
		SclScript.addTarget "sclCnt" TheObj.modifiers[#Attribute_Holder].SclCnt		

ss="B=1*sclCnt.Dropp
[B,B,B]
"
SclScript.script = SS

#2

Can anyone help please.
Am i missing something?


#3

I don’t know how it should be done in practice, but maybe something like this will do
add this to your Parameters

on Dropp set val do
(
	for ref in refs.dependents this where isKindOf ref scale_script do
	(
		ref.update()
	)
)

#5

if you want to update a scripted controller in real time you have to put it in dependency of anything that updates in real time too.
custom attribute is not this kind. so you have to use a controller (or subAnim) instead:

delete objects
t = teapot isselected:on

ScaleControlAttr = attributes ScaleControlAttr attribID:#(0x2feb1967, 0x77a9f6e6)
(
	parameters params rollout:params
	(
		drop type:#integer default:1 animatable:on ui:ui_drop
	)

	rollout params "Parameters"
	(		
		dropdownlist ui_drop "Drop:" width:130 height:6 align:#left items:#("1","2","3")
	)	
)

scl_holder = EmptyModifier name:"SCL Holder"

addmodifier t scl_holder
custattributes.add scl_holder ScaleControlAttr
t.scl_holder.drop.controller = linear_float()

sc = t.scale.controller = scale_script()
sc.addTarget "drop" t.scl_holder.drop.controller

ss = "[1,1,1]*drop"
sc.setexpression ss

#6

BTW
the using of subAnim is more ‘pro’ way. And you have a chance to find how to use it yourself :wink:


#8

Thank you very much denis