Visual Maxscript and Attibute Editor

Hi all.

I have a problem beacause I'm not a pro in scripting and I need to create a little windows dialog in the Visual MAXScript. In this windows I have a slider and I must to connect this slider with an attribute holder wich control a dummy by a wire parameter. I'm not sure if I'm very clear ^^
So I made a little script but there is a problem and I don't know how to do.
If somebody can help me it will be really fantastic! :)
Thanks!

Here is my wonderfull script:
.
.
.
.

rollout unnamedRollout "Untitled" width:162 height:300
(
slider sld1 "Slider" pos:[8,8] width:141 height:44
on sld1 changed val do
$Circle005.modifiers[#Attribute_Holder].Custom_Attributes.Pied_Milieu = val
)
createdialog unnamedRollout

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

script

Then use this script.
NOTE:As you see i have linked rollout slider with CA slider in
both way.

global testRollout
try (destroyDIalog testRollout) catch()
rollout testRollout "Untitled" width:162 height:300
(
	local ctrlObj
	fn filt obj = (obj.modifiers.count > 0 and (for m in obj.modifiers where m.name == "TestMod" collect m).count == 1)
	slider sld1 "PositionZ:" pos:[5,5] width:140 height:44 range:[0,100,0] 
	pickbutton pb_node "Pick Object" width:140 height:18 filter:filt
	on pb_node picked obj do
	(
		if obj != undefined do
		(
			ctrlObj = obj
			pb_node.text = obj.name
			sld1.controller = ctrlObj.TestMod.testAtt.posZ.track
		)
	)
	on sld1 changed val do
	(
		if ctrlObj != undefined do ctrlObj.TestMod.testAtt.posZ = val
	)
)
createdialog testRollout 150 85

bga

barigazy's picture

edit (second solution with example)

Ok.First, you need to execute this code for the scene creations.

	delete objects
	ca = attributes testAtt
	(
		parameters params rollout:params
		(
			posZ type:#float ui:ui_spin default:0.0 
		)
		rollout params "Parameters"
		(
			slider ui_spin "PositionZ: " fieldwidth:54 type:#integer range:[0,100,0]
			on ui_spin changed val do
			(
				if testRollout != undefined and testRollout.open == true and testRollout.controls[2].text != "Pick Object" do
				(
					testRollout.controls[1].value = val
				)
			)
		)
	)
 
	objModd = EmptyModifier name:"TestMod"
	circShape = circle radius:10
	sphObj = Sphere radius:10 pos:[100,0,0]
	custAttributes.add objModd ca
	addmodifier circShape objModd
	max modify mode
	paramWire.connect circShape.modifiers[#TestMod].testAtt[#posz] sphObj.pos.controller[#Z_Position] "posz"

bga

klemt's picture

Sorry for my poor english

Sorry for my poor english ^^
So, to simplify my request, I made a new scene with a sphere and a circle.

http://postimage.org/image/qejet8rpj/full/

The circle (Arc001) have an attribute holder. The spinner "Param1" control the sphere on Z Rotation.

How to connect the attribute "Param1" to "Slider"?
I hope it's more simple and clear ^^
Cordially,
Klemt

barigazy's picture

If you already make wire

If you already make wire connection then this will help you

rollout unnamedRollout "Untitled" width:162 height:300
(
	local ctrlObj
	fn filterObj obj = isProperty obj "Attribute_Holder" and isProperty obj.Attribute_Holder.Custom_Attributes "Pied_Milieu"
 
	slider sld1 "Slider" pos:[5,5] width:140 height:44 range:[0,100,0] 
	pickbutton pb_node "Pick Object" width:140 height:18 filter:filterObj
	on pb_node picked obj do
	(
		if obj != undefined do
		(
			ctrlObj = obj
			pb_node.text = obj.name
			sld1.controller = ctrlObj.Attribute_Holder.Custom_Attributes.Pied_Milieu.track
		)
	)
	on sld1 changed val do
	(
		if ctrlObj != undefined do ctrlObj.Attribute_Holder.Custom_Attributes.Pied_Milieu = val
	)
)
createdialog unnamedRollout 150 85

bga

barigazy's picture

You are not clear.Post a

You are not clear.Post a screenshot, to see whats do you need connect whit what

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.