[Closed] A bunch of MAXScript questions
Hi guys, during the development of IllusionCatalyst I came up with some questions I couldn’t answer neither digging the comprehensive MAXScript Reference, nor querying the web. Some features I have in mind for future versions depend on possibilities given by the language. Some questions could sound a bit trivial, don’t be disappointed, it’s for personal curiosity too. Before asking here I tried out everything I could figure (working in 3ds Max 9).
1 - Is it possible to detect the status of "Selection Lock Toggle" and "Show End Result on/off Toggle" checkbuttons? Is there a way to catch their change as event?
2 - Is it possible to catch the editable poly "Ignore Backfacing" checkbox change as event?
3 - Is it possible to manage the editable poly vertex/edge color via script like in soft selection? I mean assigning colors to vertices/edges depending on parameters set by script like array of values, multipliers, and so on.
4 - Is it possible to End Paint Session of thePainterInterface by right clicking like the standard 3ds Max behavior?
5 - Why does casting a Point3 to Point2 throws an error? According to MAXScript Reference this should give a Point2 type by cutting the .z or [3] value.
[1,1,1] as Point2
-- Unable to convert: [1,1,1] to type: Point2
local p3vector = [1,1,1]
local p2vector = p3vector as Point2
-- Unable to convert: [1,1,1] to type: Point2
6 - The following (useless) script draws a line in screen space based on the gw methods. The issue is that it flickers a little while redrawing, in example during viewport rotation, not too much but quite annoying. I do not have problems with Max built in features like visualizing poly count, which I guess is based upon the same library. Is there anything wrong?
6b - Am I obliged to use an intermediate function (regDrawLine) to pass parameters to the drawing function (drawLine)?
function drawLine sTextHead sTextTail =
(
gw.setTransform(Matrix3 1)
local p3Head = gw.wtransPoint [50, -50, 25]
local p3Tail = gw.wtransPoint [-50, 50, 25]
gw.wMarker [p3Head.x, p3Head.y, 0] #hollowBox color:white
gw.wMarker [p3Tail.x, p3Tail.y, 0] #hollowBox color:white
gw.wText [p3Head.x+10, p3Head.y+2, 0] sTextHead color:white
gw.wText [p3Tail.x+10, p3Tail.y+2, 0] sTextTail color:white
gw.wPolyline #([p3Tail.x, p3Tail.y, 0], [p3Head.x, p3Head.y, 0]) false rgb:#(white, white)
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
function regDrawLine =
(
drawLine "Head" "Tail"
)
registerRedrawViewsCallback(regDrawLine)
completeRedraw()
[further questions]
7 – Is it possible to get access to the arrow with plus sign “Add to current selection” and the arrow with minus sign “Remove from current selection” mouse cursors?
8 – Is it possible to manage cursor visibility? In example, in painting mode it would be nice to hide the arrow and see the advanced brush cursor only.
Thank you very much.
The only way I can think of to do this is with a when parameters $ changes… call. It would mean the callback would happen when ANY parameters change in the selected object, including the backfacing, so you could do a case statement for the callback function, but it may also be called frequently due to any parameter change triggering.
5 – Why does casting a Point3 to Point2 throws an error? According to MAXScript Reference this should give a Point2 type by cutting the .z or [3] value.
You’re right… this doesn’t work! The only way around seems to be the convoluted method of defining the Point2 as the first 2 elements of the Point3.
Not sure why it doesn’t. Has it ever? I tested this in 2009.
the node event system in 2008 has a propertiesOtherEvent and userPropertiesChanged callback – im posturing here as I havent used it yet, but that might filter the frequency.
I attempted the userPropertiesChanged callback but couldn’t get it to work. That may be my limited knowledge of it’s functionality though.
Thanks Erilaz and LoneRobot,
I hoped to receive more answers, anyway I understand some of them are a bit tricky. I’m sorry for the doubled question, I guess I looked for it some time before decon’s good workaround.
This question list seems to be more like a trivia.
I’m sorry to post just to revive this old thread of mine. I’m still in need of answers. Even a “No, it can’t be done by MaxScript” would be appreciated. Maybe many of my questions can be solved by C++ (like edge coloring?), but I don’t have a clue. It would be a good reason to start studying it.
Thank you.
- Enrico