Notifications
Clear all

[Closed] Can maxscript install / unistall dialogs as extended viewports?

Is it possible with maxscript to install a dialog as an extended viewport. I know how to register the dialog so it CAN be installed by the user manually, but I’d like to also make it be installed / uninstalled with script as well.

Any ideas? Thanks!

6 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

you have to create dialog (or rollout floater) first and using registerViewWindow register this dialog


-- register
createdialog d
registerViewWindow d
 
-- unregister
if not d.inViewport do unRegisterViewWindow d

Thanks, Denis

But notice I said I already know how to register the dialog, but what I’d like to know is if it can actually be installed as an extended viewport with script.

Any ideas? Thanks.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

What do you mean by “being installed”? Do you want to have some dialog registered as view window every time when you open MAX? or do you want to have the dialog’s name in list of Extended views on startup?

When the dialog opens, I’d like it to open up as an extended viewport without the user needing to rightclick on the viewport name and choose views/extended/dialog name. That’s all I’m asking.

Thanks.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

EASY! (works for MAX 2010 and higher :))


 
global myViewWindow
fn registeredViewWindow = if not (act = iskindof myViewWindow RolloutClass) or not myViewWindow.inViewport then
(
rollout testViewWindow "View Window by denisT"
(
fn setLastRegisteredViewWindow = 
(
-- not more then 10 VW can be registered (THANKS DEVELOPERS!)
id = 10 
-- actionMan.executeAction 0 "40404" ------- set VW #1 in active viewport
-- actionMan.executeAction 0 "40405" ------- set VW #2 in active viewport
-- actionMan.executeAction 0 "40406" ------- set VW #3 in active viewport
-- etc.
-- returns TRUE for success and FALSE other way
while id > 0 and not (actionMan.executeAction 0 ((40403 + id) as string)) do id -= 1 
id
)
label lb "Under Construction"
 
on testViewWindow open do
(
registerViewWindow testViewWindow -- registered LAST VW
 
-- Looking for first not VW viewport (active as default)
if viewport.activeViewport == 0 do viewport.activeViewport = amin 1 (viewport.numViews)
-- How the function says...
setLastRegisteredViewWindow()
)
)
if act do destroydialog myViewWindow
myViewWindow = testViewWindow
createdialog myViewWindow
myViewWindow
)
else messageBox "Cannot redo dialog while in viewport." title:"Warning!" beep:off
registeredViewWindow()
 

Enjoy!

I don’t have time to test it yet, but I trust you when you say it’ll work. Thanks so much!