Notifications
Clear all

[Closed] maxscript help for a beginner

hi, im VERY new to scripting and i may be asking really dumb questions, but here it goes.

what im trying to do is:

create a camera01
move/rotate
set render width/height
set the camera01 as the viewport
hide the object CLIPPING_01
hide bone objects
make preview at 100% and set a name for the preview file as the scene name

what ive got:

macroScript Macro6
category:“DragAndDrop”
toolTip:“CamSetup”
(
Freecamera fov:45 targetDistance:160 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off
move $Camera01 [0,-245,131.2]
renderWidth = 480
renderHeight = 640
rotate $Camera01 (angleaxis 90 [1,0,0])
max vpt camera
select $CLIPPING_01
max hide selection
)

thats all ive got so far, but setting the vpt camera and hiding the object doesnt seem to work when i run the script. can anyone tell me why?
and is there a command to get the scene name?

thanks.

6 Replies

Try this:

macroScript Macro6
      category:"DragAndDrop"
      toolTip:"CamSetup"
  (
local cam = Freecamera fov:45 targetDistance:160 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off
      move cam [0,-245,131.2]
      renderWidth = 480
      renderHeight = 640
      rotate cam (angleaxis 90 [1,0,0])
viewport.activeViewport = 1
viewport.setCamera cam
hide $CLIPPING_01
)

ooh thanks that works!

would you know how to hide bone objects in the scene?

unhide $object_name

sorry, i meant how do you hide bone objects in one command rather than go through an entire skeleton hiding bones individually. i thought this would be possible as there is a box in the preview dialog where you can turn bones off.

hidebycategory.bones = true

woohoooo! thanks!