[Closed] First issues with MaxScript and 3ds Max 2017
I noticed several problems with MAXScript in 3ds Max 2017.
issue 1. The UI of the rollouts are scaled. Here is an example:
- using dotNet buttons in mxs rollout:
(
global rol_UI_test_dN
try(destroyDialog rol_UI_test_dN)catch()
rollout rol_UI_test_dN "Test UI: DotNet buttons"
(
local uiColor = ((dotnetclass "managedservices.CUIupdater").getinstance()).getcontrolcolor()
local dn_size = dotNetClass "System.Drawing.Size"
local dgvPos = [2,43]
-- "works in 3dsMax 2017 only"
-- local scaleFactor = GetUiScaleFactor()
dotNetControl btn_01 "System.Windows.Forms.button" pos:[dgvPos.x, dgvPos.y-42]
dotNetControl btn_02 "System.Windows.Forms.button" pos:[dgvPos.x+35, dgvPos.y-42]
dotNetControl btn_03 "System.Windows.Forms.button" pos:[dgvPos.x+70, dgvPos.y-42]
dotNetControl btn_04 "System.Windows.Forms.button" pos:[dgvPos.x+105, dgvPos.y-42]
dotNetControl btn_05 "System.Windows.Forms.button" pos:[dgvPos.x+140, dgvPos.y-42]
dotNetControl btn_06 "System.Windows.Forms.button" pos:[dgvPos.x+140+35, dgvPos.y-42]
dotNetControl btn_07 "System.Windows.Forms.button" pos:[dgvPos.x+175+35, dgvPos.y-42]
dotNetControl btn_08 "System.Windows.Forms.button" pos:[212+35, dgvPos.y-20]
dotNetControl btn_09 "System.Windows.Forms.button" pos:[233+35, dgvPos.y-20]
dotNetControl btn_10 "System.Windows.Forms.button" pos:[254+35, dgvPos.y-20]
dotNetControl btn_11 "System.Windows.Forms.button" pos:[276+35, dgvPos.y-20]
dotNetControl btn_12 "System.Windows.Forms.button" pos:[297+35, dgvPos.y-20]
dotNetControl btn_13 "System.Windows.Forms.button" pos:[318+35, dgvPos.y-20]
dotNetControl btn_14 "System.Windows.Forms.button" pos:[339+35, dgvPos.y-20]
dotNetControl btn_15 "System.Windows.Forms.button" pos:[360+35, dgvPos.y-20]
dotNetControl btn_16 "System.Windows.Forms.button" pos:[381+35, dgvPos.y-20]
dotNetControl btn_17 "System.Windows.Forms.button" pos:[318+35, dgvPos.y-42]
dotNetControl btn_18 "System.Windows.Forms.button" pos:[339+35, dgvPos.y-42]
dotNetControl btn_19 "System.Windows.Forms.button" pos:[360+35, dgvPos.y-42]
dotNetControl btn_20 "System.Windows.Forms.button" pos:[381+35, dgvPos.y-42]
dotNetControl dataGridView "System.Windows.Forms.DataGridView" pos:[dgvPos.x, dgvPos.y+1] height:(280+111+28+30) width:(402+35)
edittext et_editFullInfo "" text:"" pos:[dgvPos.x - 4, dgvPos.y+285+111+28+30] width:(406+35)
function DefineButtonControl btn w h img txt fColor bColor =
(
btn.size = dotNetObject dn_size w h
btn.margin = dotnetobject "padding" 0
btn.FlatAppearance.BorderSize = 1
btn.flatstyle = (dotNetclass "FlatStyle").flat
if fColor != undefined do btn.foreColor = fColor
if bColor == undefined then btn.backColor = uiColor else btn.backColor = bColor
if img != undefined do btn.image = img
if txt != undefined do
(
btn.text=txt
btn.font = dotNetObject "System.Drawing.Font" "Times New Roman" 6
)
)
on rol_UI_test_dN open do
(
-- "works in 3dsMax 2017 only"
-- format "scaleFactor: %
" scaleFactor
closeIcon64 = undefined
DefineButtonControl btn_01 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_02 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_03 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_04 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_05 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_06 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_07 34 42 closeIcon64 undefined undefined undefined
DefineButtonControl btn_08 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_09 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_10 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_11 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_12 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_13 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_14 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_15 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_16 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_17 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_18 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_19 20 20 closeIcon64 undefined undefined undefined
DefineButtonControl btn_20 20 20 closeIcon64 undefined undefined undefined
)
)
-- "3dsmax 2016 and earlier"
createdialog rol_UI_test_dN 441 517
-- "3dsmax 2017 1920x1080 screen resolution"
-- createdialog rol_UI_test_dN 350 508
)
- using regular mxs buttons in mxs rollout:
(
global rol_UI_test
try(destroyDialog rol_UI_test)catch()
rollout rol_UI_test "Test UI: MaxScript buttons"
(
local dgvPos = [2,43]
-- "works in 3dsMax 2017 only"
-- local scaleFactor = GetUiScaleFactor()
button btn_01 "Btn" width:34 height:42 pos:[dgvPos.x, dgvPos.y-42]
button btn_02 "Btn" width:34 height:42 pos:[dgvPos.x+35, dgvPos.y-42]
button btn_03 "Btn" width:34 height:42 pos:[dgvPos.x+70, dgvPos.y-42]
button btn_04 "Btn" width:34 height:42 pos:[dgvPos.x+105, dgvPos.y-42]
button btn_05 "Btn" width:34 height:42 pos:[dgvPos.x+140, dgvPos.y-42]
button btn_06 "Btn" width:34 height:42 pos:[dgvPos.x+140+35, dgvPos.y-42]
button btn_07 "B" width:34 height:42 pos:[dgvPos.x+175+35, dgvPos.y-42]
button btn_08 "B" width:20 height:20 pos:[212+35, dgvPos.y-20]
button btn_09 "B" width:20 height:20 pos:[233+35, dgvPos.y-20]
button btn_10 "B" width:20 height:20 pos:[254+35, dgvPos.y-20]
button btn_11 "B" width:20 height:20 pos:[276+35, dgvPos.y-20]
button btn_12 "B" width:20 height:20 pos:[297+35, dgvPos.y-20]
button btn_13 "B" width:20 height:20 pos:[318+35, dgvPos.y-20]
button btn_14 "B" width:20 height:20 pos:[339+35, dgvPos.y-20]
button btn_15 "B" width:20 height:20 pos:[360+35, dgvPos.y-20]
button btn_16 "B" width:20 height:20 pos:[381+35, dgvPos.y-20]
button btn_17 "B" width:20 height:20 pos:[318+35, dgvPos.y-42]
button btn_18 "B" width:20 height:20 pos:[339+35, dgvPos.y-42]
button btn_19 "B" width:20 height:20 pos:[360+35, dgvPos.y-42]
button btn_20 "B" width:20 height:20 pos:[381+35, dgvPos.y-42]
dotNetControl dataGridView "System.Windows.Forms.DataGridView" pos:[dgvPos.x, dgvPos.y+1] height:(280+111+28+30) width:(402+35)
edittext et_editFullInfo "" text:"" pos:[dgvPos.x - 4, dgvPos.y+285+111+28+30] width:(406+35)
on rol_UI_test open do
(
-- "works in 3dsMax 2017 only"
-- format "scaleFactor: %
" scaleFactor
)
)
-- "3dsmax 2016 and earlier"
createdialog rol_UI_test 441 517
-- "3dsmax 2017 1920x1080 screen resolution"
-- createdialog rol_UI_test 350 508
)
If you run both codes in 3dsmax 2016 and earlier there will be no problems with the position of the buttons. The horizontal gap between buttons is 1 px.
If you run both codes in 3dsmax 2017 the rollout will be bigger. The distance between mxs buttons is bigger. The mxs buttons are bigger. The dotNet buttons are with the same size, but the distance between them are bigger.
To have the same rollout, with dotNet buttons I have to change the positions between buttons and to reduce the size of the rollout to 350×508. But, when this code is executed in 3dsMax2016 the buttons are overlaped.
On my monitor(1920×1080) GetUiScaleFactor() gives the value of 1.25. In 3dsMax 2017 the rollout is bigger 1,26 times in horizontal and 1.0177 in vertical direction. I think that in monitors with higher resolution than mine the UI size will be even bigger,
issue 2. Go To dialog(Ctrl+G) not works. Run it, enter the line number where you want to go, press the Enter(or Go To button) – nothing happens.
issue 3. Find dialog(Ctrl+F) not works. Run it, enter the word you want to find, press the Find Next button – the next occurrence will be highlighted, click anywhere in the Maxscript Editor – if the code is scrolled you will be returned to the previous marked row(or something similar).
Issues 2 and 3 makes navigation impossible.
Issue 4. gw.text color property not works as described in the reference file.
If you run this code(from maxscript help file) the text in the screen will be white, not yellow as t should be.
unregisterRedrawViewsCallback GW_displayObjectNames
fn GW_displayObjectNames =
(
gw.setTransform (matrix3 1)
for o in objects where not o.isHiddenInVpt do
gw.text o.pos (o as string) color:yellow
gw.enlargeUpdateRect #whole
)
registerRedrawViewsCallback GW_displayObjectNames
Stumbled over this too yesterday, made it pretty impossible to keep the overview when using search …
What I use is to press the Mark All button and then wit F2 to go to desired line. Very annoying.
When there is an error in the listener is printed the line number of that error, but with Go To not working is very hard to go to that line. I found a workaround, but…
By the way, did someone know why the listener prints the error messages in new manner – stack level 1, 2, top level, externals, and so on? Is there explenation somewhere in the net?
issue 5. When multiple scripts are open changing between them(using the tabs) leads to resetting the scroll position – each script will be shown from line 1, not from the line where the cursor was before switching to another tab.
The solution I found is to move the scripts to another view(dual view) and then go move the script back(one view).