[Closed] #CropSelected Render Option Broken/Missing from 3dsmax 2009? Replacement?
Hi Guys, just been doing some work in max 2009 and found that the very useful Crop Selected render option is no longer available, it’s still in the maxscript help file but the render option doesn’t seem to work… I really need this working as otherwise i’m going to be cropping a LOT of files manually!
Anyone got a script for getting the cropping points in a viewport so I can put them as a cropbox render option instead?
Very frustrated they’ve changed this…
I don’t understand what is not working?
setRenderType #cropselected
getRenderType()
--#cropselected
render renderType:#cropselected
Everything works for me. Max renders right and bottom frame line with double thickness, but it always was like that.
Same here. It works fine with the “Auto Region Selected” option checked, which however doesn’t seem to be exposed. At least I didn’t find it in the reference.
Based on the “How to … Develop a Vertex Renderer” tutorial I came up with this to calculate the screen bounds. The code is slightly untidy and I still need to test a few things…
function fnRenderScene = (
renderWidth = iRWidth = 500
renderHeight = iRHeight = 500
pnRenderImage = @"E: est.jpg"
select (for o in geometry collect o)
aB1 = $selection.min
aB2 = $selection.max
aX = #()
aY = #()
aP3WBounds = #(aB1, [aB2.x, aB1.y, aB1.z], [aB2.x, aB2.y, aB1.z], [aB1.x, aB2.y, aB1.z], [aB1.x, aB1.y, aB2.z], [aB2.x, aB1.y, aB2.z], aB2, [aB1.x, aB2.y, aB2.z])
for v = 1 to aP3WBounds.count do (
thePos = aP3WBounds[v] * viewport.getTM()
screen_origin = mapScreenToView [0,0] (thePos.z) [iRWidth,iRHeight]
end_screen = mapScreenToView [iRWidth,iRHeight] (thePos.z) [iRWidth,iRHeight]
world_size = screen_origin-end_screen
x_aspect = iRWidth/(abs world_size.x)
y_aspect = iRHeight/(abs world_size.y)
screen_coords = point2 (x_aspect*(thePos.x-screen_origin.x)) (-(y_aspect*(thePos.y-screen_origin.y)))
append aX screen_coords.x
append aY screen_coords.y
)
iXmin = amin aX
iYmin = amin aY
iXmax = amax aX
iYmax = amax aY
fRw = (iXmax - iXmin)
fRh = (iYmax - iYmin)
if fRw > fRh then (
iRa = fRw
iYmin -= ((fRw - fRh) / 2)
)
else (
iRa = fRh
iXmin -= ((fRh - fRw) / 2)
)
b2Reg = (Box2 [iXmin, iYmin] [iXmax, iYmax])
bBlowup = false
if bBlowup then (
b2Reg.w = b2Reg.h = iRa
viewport.setBlowupRect viewport.activeViewport b2Reg
undisplay (render renderType:#blowUp outputfile:pnRenderImage vfb:true progressbar:true)
)
else (
viewport.setRegionRect viewport.activeViewport b2Reg
bmpReg = bitmap iRWidth iRHeight color:black
undisplay (render renderType:#crop to:bmpReg vfb:true progressbar:true)
a1 = (bmpReg.width - 1)
b1 = (bmpReg.height - 1)
bmpCrop = bitmap a1 b1 color:red filename:pnRenderImage
pasteBitmap bmpReg bmpCrop (box2 0 0 a1 b1) [0,0]
save bmpCrop quiet:true
close bmpCrop
close bmpReg
)
)
Furthermore I have the problem that the renderType #crop adds another row/column of black pixels to the right and bottom of the image…thats why I have to copy&paste the rendered image…
I also tried to set the “Auto Region Selected” checkbox via UI Accessor but since I haven’t done alot with it yet, it mostly failed.
This doesn’t work for me either (Max 2010 64 or 32 bit):
setRenderType #cropselected
getRenderType()
render renderType:#cropselected
It just doesn’t crop. However if I render using
max quick render
it works. I’m not sure where to go from here yet, I’ll be trying to save the image from the VFB to a file I guess…
EDIT:
This works for me:
setRenderType #cropselected
rendSaveFile = true
rendOutputFilename = "C:\ est.jpg"
max quick render