PDA

View Full Version : Max Title


galagast
03-12-2005, 05:51 AM
is there a way to retrieve the name or title of a currently opened max scene? even if its untitled?..
coz the function cui.setApptitle doesnt have a counterpart...
Any way to get the current filename string will do.. ive been digging the docs and i cant seem to find an appropriate approach...
hmm.. is parsing the ini file [filelist] the only way to get the most current filename title string? coz this aint applicable if the user is working on an untitled scene...

here is the current code im working on... it updates the title much like how adobe after effects works whenever you're rendering...

macroscript Update_Frame_Title category:"Render" tooltip:"Update Frame Title"
(
local render_title_enabled = false
fn setrendertitle =
(
the_Start = (rendStart/160) as integer
the_End = (rendEnd/160) as integer
the_Frame = (currentTime/160) as integer
the_Total = (the_End - the_Start)+1
the_Time = (the_Frame - the_Start)+1
the_String = ("(" + the_Frame as string + "f) " + the_Time as string + " of " + the_Total as string)
cui.setAppTitle the_String
)
fn setrendertitleback =
(
the_Root = getdir #maxroot
the_Path = (the_Root + "3dsmax.ini")
the_Filepath = getinisetting the_Path "FileList" "File1"
the_Filename = filenameFromPath the_Filepath
the_Title = (the_Filename + " - 3ds max 6 - Stand-alone License")
cui.setAppTitle the_Title
)
on ischecked return render_title_enabled
on execute do
(
render_title_enabled = not render_title_enabled
if render_title_enabled then
(
callbacks.addscript #preRenderFrame "setrendertitle()" id:#render_title_info
callbacks.addscript #postRender "setrendertitleback()" id:#render_titleback_info
)
else
(
callbacks.removescripts #preRenderFrame id:#render_title_info
callbacks.removescripts #postRender id:#render_titleback_info
)
)
)

the only bug for now is if you're working with an unsaved max scene... it would return the most recent filename as the title after rendering.. which is quite wrong..

and as always... any help is much appreciated. :)

Bobo
03-12-2005, 04:43 PM
Aren't you trying to be overly complex in this case? ;)
Why don't you just snapshot the current maxFileName before you start rendering and set it back into the title when the rendering ends. If the value returned by maxFileName was "", then you can replace it with "Untitled" and everything would be peachy...

galagast
03-13-2005, 12:12 PM
good heavens almighty bobo! that was my very first initial intention! i just didnt know where to get that function! i searched everywhere in the helpfile! :bounce:

now i tried to searh for it again, and all the while, it was just under the "3ds Max System Globals" category... i was searching along the lines of UI or Interface... hehe... you just saved my day! as always, thanks a zillion for the help!

galagast
03-13-2005, 01:25 PM
well... might as well post the working code...


macroscript Update_Frame_Title category:"Render" tooltip:"Update Frame Title"
(
local render_title_enabled = false
fn setrendertitle =
(
the_Start = (rendStart/160) as integer
the_End = (rendEnd/160) as integer
the_Frame = (currentTime/160) as integer
the_Total = (the_End - the_Start)+1
the_Time = (the_Frame - the_Start)+1
the_String = ("(" + the_Frame as string + "f) " + the_Time as string + " of " + the_Total as string)
cui.setAppTitle the_String
)
fn setrendertitleback =
(
the_Filename = maxfilename
if the_Filename == "" then the_Filename = "Untitled"
the_Title = (the_Filename + " - 3ds max 6 - Stand-alone License")
cui.setAppTitle the_Title
)
on ischecked return render_title_enabled
on execute do
(
render_title_enabled = not render_title_enabled
if render_title_enabled then
(
callbacks.addscript #preRenderFrame "setrendertitle()" id:#Render_title_info
callbacks.addscript #postRender "setrendertitleback()" id:#Render_titleback_info
)
else
(
callbacks.removescripts #preRenderFrame id:#Render_title_info
callbacks.removescripts #postRender id:#Render_titleback_info
)
)
)

CGTalk Moderation
03-13-2005, 01:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.