Ok, so I am trying to set up and create a single render which I then want saved. Simple enough eh? Well, I have been trying to do this but keep getting an Image I/O Error dialog box and the file/image does not get saved. The image is rendered, but then error is shown.
first simple code below:
b = bitmap 320 240
render camera: $Camera001 to: b frame: 35
b.filename = “c:\Program Files\Autodesk\3ds Max 2013\scripts\building_maps\” + $Camera002.name + “.bmp”
save b
close b
–end
The above works fine in max 2011 but not in 2013.
Also, working from an old script (below) does the same. I get a render for the camera, then a black image based on the camera target and an Image I/O error.
fn snapCams2 label size:[320, 240] frames: folder:“C:\Program Files\Autodesk\3ds Max 2013\scripts estRenders\” =
(
for c in cameras do
(
local fname = folder + label + “-” + c.name
if frames == unsupplied then
render camera: c outputFile:(fname + “.jpg”) outputSize:size
else
render camera:c frameRange: #current \
outputFile: (fname + “.avi”) outputSize: size
print(“Thats not right!”)
)
)
snapCams2 “Phase1” size:[640,480]
Thanks very muchly.
Maybe some differences in version syntax, but any pointers appreciated.
One thing I did notice : you have inconsistent escaping in your path names between versions: make sure you’ve got the same slashes everywhere or use literals.
In addition to your path slashes, you’re also trying to write to Program Files, which Windows won’t like unless you’re running Max with admin priveleges.
Hi, thanks for the replies, I managed to get it to work (sort of). It will now make an avi, but not a single frame render. I am just in the middle of sorting it out. Will post replies/code when done. Thanks again.
glad you got it working, just a note on using paths in mxs.
You can use @“yourString” when dealing with explicit paths where necessary (or whenever you want to ignore special characters in strings).
Also there’s pathConfig that has some good functions for sorting paths out, ‘pathConfig.normalizePath’ can fix paths for you that mix , / and // (if i remember correctly).
If you want to get a folder that max should be able to write to without Admin privileges try ‘getDir #tmp’, or some other predefined folder, that points to your appdata. I hate using appdata folders but, as far as i’m aware, the reason max uses them is because uac on program files.
Hi peeps, I have got the render to work as image sequence, so that`s good. Can I use maxscript to create a folder that the images will be rendered into or will I need to have a separate script written in something like python? I have yet to fully grasp the use of Python in Max/maxscript, but have used python and Maya, so not a complete beginner.
Cheers
M :nod:
Its ok. I found the makedir code in the help file. RTFM!!!