PDA

View Full Version : Exporting Thumbnail Renders, Maps & Archiving


Woolythemammoth
10-16-2006, 02:59 PM
Hi All

This is my first post & I am quite a newbe to Max Script so please forgive any slowness on my part.

I have been going through several help files, tutorials and forums trying to put together a set of 3 buttons within max 8 that I could add to a floating menu.

The first button to Archive the entire scene and pop up the Save to window with a specific network location in the window.

Here's what I have so far but I keep getting

"Compile error: Nested macroScript defintions are not permitted in line: macroScriptA"

When I try and drag it on to a new toolbar also the Archive freezes :-(

macroScript ArchiveScene
category:"-------"
tooltip:"ArchiveScene"
(
checkForSave()
maps_in_scene = usedMaps()
max_ini_file = getMAXIniFile()
get_last_open_file = getinisetting max_ini_file "FileList" "File1"
path_of_file = getFilenamePath get_last_open_file
path_of_collection = getSavePath caption:"Archive Folder" initialDir:path_of_file
if path_of_collection != undefined do
(
rollout cellect_map_floater "Archive Scene" width:480 height:88
(
progressBar prog_bar_copy "ProgressBar" pos:[16,16] width:448 height:16 color:(color 128 30 30)
GroupBox grp1 "" pos:[8,0] width:464 height:80
label file_copy_text "" pos:[16,40] width:448 height:32
on cellect_map_floater open do
(
for i in 1 to maps_in_scene.count do
(
prog_bar_copy.value = 100.*i/maps_in_scene.count
file_copy_text.text = maps_in_scene[i]
copyfile maps_in_scene[i] (path_of_collection + "\\" + getFilenameFile maps_in_scene[i] + getFilenameType maps_in_scene[i])
)
copyfile get_last_open_file (path_of_collection + "\\" + getFilenameFile get_last_open_file + getFilenameType get_last_open_file)

DestroyDialog cellect_map_floater
)
)
createdialog cellect_map_floater style:#(#style_toolwindow)
)
)

As for the second button it is required to render out a thumbnail size view approx 250 * 250 of the item selected in the scene ( can be any object from a varety of scenes) and save it to a network preferebly with a sequential numbering system. Script so far can be seen below.

A big thank you in advance to anyone who helps with this and also to all of you people who keep posting your scripts and comments up on the web for us newbe's to learn from :-)

macroScript RendThumb

category:"Vega3DLibrary"

tooltip:"Save Thumbnail To 3D Library"

(

--Make sure there is a RenderHistory directory to store images into...

makedir ((GetDir #preview)+"\\Network\\3D Library Trial\\Thumbnail\\")



render renderType:#selected outputwidth:250 outputheight:250

callbacks.removeScripts id:#saveLastRendered

fn SaveLastRenderedImage =



(

local thumbnail = GetLastRenderedImage()

local check_for_files = getFiles ((GetDir #image)+("\\Network\\3D Library Trial\\Thumbnail\\Thumb_"+"*.bmp"))

local file_exist = true

local increment = 001

while file_exist do

(

local out_file_name = (GetDir #image)+("\\Network\\3D Library Trial\\Thumbnail\\Thumb_")+(check_for_files.count+increment) as string + ".bmp"

if (getFiles out_file_name).count == 0 then

file_exist = false

else

increment += 1

)

thumbnail.filename = out_file_name

save Thumbnail

thumbnail.getSaveFileName caption:"Save 3D Library Object Thumbnail" filename:("\\Network\\3D Library Trial\\Thumbnail\\REPLACE_WITH_THUMBNAIL_NAME.bmp")

close thumbnail

)

callbacks.addScript #postRender "saveLastRenderedImage()" id:#saveLastRendered

)

CGTalk Moderation
10-16-2006, 02:59 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.