[Closed] How to create a movable dialog while rendering?
by the way, there is actually Autodesk.Max.dll in 3dsMax Design 2014
i added the code you mentioned, to this:
thedll = "C:\Program Files\Autodesk\3ds Max Design 2014\Autodesk.Max.dll"
dotnet.loadAssembly thedll
g = (dotnetclass "Autodesk.Max.GlobalInterface").Instance
g.Coreinterface8.RegisterModelessRenderWindow (dotnetobject "System.IntPtr" test.hwnd)
it is loaded succesfully,
but still gives the same error… –Unknown property: “Coreinterface8” in undefined
That is the same version I got here at work. You should not have to load the assembly, it is loaded at startup. Try pasting this into the listener:
show (dotnetclass "Autodesk.Max.GlobalInterface")
The Instance variable should show up. Are you sure that the “test” rollout is created before you do call the RegisterModelessRenderWindow method?
i cant make it to work…im having headaches already… what am i missing?
and yes running this code:
show (dotnetclass "Autodesk.Max.GlobalInterface")
results in :
– .Instance : <Autodesk.Max.IGlobal>, static
true
this is the whole code:
(
global test
local timerstate = 1
try(destroydialog test) catch()
rollout test "test dialog"
(
label lab1 ""
timer timer1 interval:500
on timer1 TICK do
(
case timerstate of
(
0:
(
lab1.text = "sample information"
timerstate = 1
)
1:
(
lab1.text = ""
timerstate = 0
)
)
)
)
createdialog test width:250 height:60 pos:[35,120] style: #(#style_toolwindow)
g = (dotnetclass "Autodesk.Max.GlobalInterface").Instance
g.Coreinterface8.RegisterModelessRenderWindow (dotnetobject "System.IntPtr" test.hwnd)
while not (keyboard.escpressed) do --as long as esc is not press, render
(
max quick render
exit with (escispressed = keyboard.escpressed)
)
if escispressed == false then --
(
--my code here
"Render Done!"
)
else --if esc is pressed do the ff:
(
--my code here
try(destroydialog test) catch()
"interrupted"
)
)
always results:
– Unknown property: “Coreinterface8” in undefined
tried replacing:
g = (dotnetclass "Autodesk.Max.GlobalInterface").Instance
g.Coreinterface8.RegisterModelessRenderWindow (dotnetobject "System.IntPtr" test.hwnd)
to
g = (dotnetclass "Autodesk.Max.GlobalInterface")
g.Coreinterface8.RegisterModelessRenderWindow (dotnetobject "System.IntPtr" test.hwnd)
now variable “g” works but now results in
– Unknown property: “Coreinterface8” in dotNetClass:Autodesk.Max.GlobalInterface
yahhh :banghead: i dont know whats happening… tried restarting my max already
anyways thanks for the help… but is my code working perfectly in your system?
(dotnetclass “Autodesk.Max.GlobalInterface”).Instance is not undefined on my system.
by the way … whats the result in the listener when you run this… ill try to explicitly declare it
so its not only in my system…
i still cant make it to work…
explicitly declaring
dotnetObject "Autodesk.Max.Global"
does not work also,
returns runtime error
glad to know its working in your system… now i know theres really something wrong in my 3dsmax… i will try to run the same code to other computer and see if it runs… thanks again
ok, i’ve solved it …
now my dialog can be move while rendering also ui timer works… been researching in maxcript documentation and found this DialogMonitorOPS function… i just need to set up before the rendering starts …then when the rendering starts it will trigger the callback–i just need to get the hwnd of the “rendering” dialog… then create my own scripted dialog with a parent property set to hwnd of the “rendering” dialog… thats it…
thanks for all the help to all of you guys…
you can search the maxscript documentation about “DialogMonitorOPS” and “UIAccessor”
to get information of how this callback works
anyways heres the sample code :
-----------------------------------callback
DialogMonitorOPS.UnRegisterNotification ID:#anyname
DialogMonitorOPS.Enabled = false
fn callbackmonitor =
(
hwnd = DialogMonitorOPS.GetWindowHandle() --get the handle of the dialog that popups
if (uiAccessor.getWindowText hwnd == "Rendering") do --if the dialog that popups is rendering dialog do the ff..
(
createdialog test parent:hwnd -- this is the key ..add a parent property of the dialog to the handle of rendering dialog
)
---------------
true
)
DialogMonitorOPS.RegisterNotification callbackmonitor ID:#anyname
DialogMonitorOPS.Enabled = true --start the DialogMonitorOPS
-----------------------------------