Notifications
Clear all

[Closed] Extending the Pick button

Hi,

I’m develpoing a script where in I need to pick an object which I can manage with the pick button. The problem is that :

  1. The object has to be picked from either the same scene or merged from another. These options are specified using a radio button on top of the pick button. If the object has to be merged fom another file, on clicking the pick button it should open the open file menu, wherein I can selecet the desired max file which contains my desired object.

  2. Upon Selecting the maxfile it should open a new lsitbox containing a list of objects in that particular file.

When a pick button is active (pressed) it is somehow mandatory to select an object. If I use a normal button, it’s not interactive for the user if the object is the same scene.

Any help will be appretiated,

Thanks,
Vikram

5 Replies

Hi,

not with max atm, but maybe something like:


local obj

on Mybutton pressed do
(
if MyRadio.state==2 then
(
f=getopenfileName caption “Merge File” types:“3ds Max (.max)|.max|” filename:((getdir #scene)+”\”)
if f != undefined do (mergeMAXFile f #prompt #select) – choose obj to merge
obj=selection[1]
)
else obj=pickobject()
)

Hey Thanks,

Not at Max right now either, but I will get back to you with this. But can we define pickobject as a function???

pickObject() is a pre-defined MAXScript function. If used with no arguments, the user has to pick by “hit” on scene objects. It returns the object picked.

  • Michele

Alternativley, create 2 rollout objects: one pick button and one normal button on top of each other then simply hide or unhide each one depending on the radio button selection…


 rollout buttonExample "Buttons" width:120 height:120
 (
 	radioButtons buttonType "Button Type:" pos:[16,16] width:90 height:46 labels:#("Pick Button", "Normal Button")
 	button normal "Normal Button" pos:[16,72] width:88 height:40 visible:false
 	pickButton pick "Pick Button" pos:[16,72] width:88 height:40
 	
 	on buttonType changed sel do
 	(
 		case sel of
 		(
 			1:	(
 					normal.visible = false
 					pick.visible = true
 				)
 			2:	(
 					normal.visible = true
 					pick.visible = false
 				)
 		)
 	)
 )
 
 createdialog buttonExample
 

Thanks Moosley,

I didnt know you could interactively hide/unhide user interface items. Thanks a lot for this,

Vikram