[Closed] Change Material rollout order
hi,
i’d need to change the order of rollouts inside a material via maxscript
i added a custom attributes rollout wich will display on bottm and would like to put it on top, however i can drag it by hand but not keep persistency so when i close the sme or scene it will be put on the bottom again
also i can’t set persistency of “rolledup” state in material
so let’ say i want all the rollups to be closed i can’t do it
i saw there is a cfg file and methods for the command panel but not for material panel
use
on <rollout> open
event
But I’m not sure if it will work in Qt versions of max.
attr = attributes ca attribid:#(1442424,464646)
(
parameters params rollout:main
(
)
rollout main "params"
(
button btn "one" across:2
button btn2 "two"
on reload main do
(
format "reload\n"
)
on main open do
(
format "we're open\n"
format "this: %\n" this
format "hwnd: %\n" this.main.hwnd
hwnd = this.main.hwnd
format "--\n"
parent = UIAccessor.GetParentWindow hwnd
format "%\n" (windows.getHWNDData parent)
-- rollup with name 'params' must be 0'th rollup in RollupWindow
titles = #( "params" ) -- titles of rollups we want to move, can contain multiple values
indexes = #( 0 ) -- new indexes, one index for one corresponding title
for i=1 to 5 do
(
format "--\n"
parent = UIAccessor.GetParentWindow parent
data = windows.getHWNDData parent
format "%: %\n" i data
if data[4] == "RollupWindow" do
(
local g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
local IRollupWindow = g.GetIRollup (dotnetobject "system.intptr" data[1])
format "\nIRollupWindow.numpanels: %\n" IRollupWindow.numpanels
local reordered = false
for i=0 to IRollupWindow.numpanels-1 do
(
local IRollupPanel = IRollupWindow.GetPanel (IRollupWindow.GetPanelDlg i asdotnetobject:true)
if IRollupPanel != undefined do
(
local rollupName = UIAccessor.GetWindowText IRollupPanel.TitleWnd
format "%: % cat:%\n" i rollupName IRollupPanel.category
local index = findItem titles rollupName
if index > 0 and IRollupPanel.category != indexes[index] do
(
IRollupPanel.category = indexes[index]
reordered = true
)
)
)
if reordered do IRollupWindow.updateLayout()
g.ReleaseIRollup IRollupWindow
exit
)
)
)
)
on update do
(
format "update\n"
)
)
try (custAttributes.delete $.material (custAttributes.getDef $.material.ca)) catch()
custAttributes.add $.material attr
to auto-put the attribute’s rollout on top just add ” category:0″ to its rollout definition:
like:
attributes ...
(
parameters ...
(
...
)
rollout ... category:0
(
...
)
)
it is awesome how you made it!
unfortunately it’s not workig in lastest version as you guessed
crazy! it works like a rollout floater
i had a look to my material rollup panels and i saw that everyone has 4000 as category.
so if you want to put it on the bottom you’ll need category >=4000 but since they are all the same there’s no way to put it in the middle. so what’s the point in setting a category identical for every rollup?
i dont need to put it in the middle but it’s just to understand
thanks a lot everybody!
the category is used to pre-define the order in the IRollupWindow (RolloutFloater is a case).
yes i get it, but if all the other “original” rollups all share the same category how can they define (or redefine) the order?
it’s up to developer how to define categories. High categories numbers are probably used to put Cust Attribute rollouts at the bottom for sure.