Skip to content

Commit

Permalink
Convert camera object to camera part
Browse files Browse the repository at this point in the history
Added button to toolbar to convert camera object in scene into rigid part helper with camera properties.
  • Loading branch information
treewyrm committed Jul 7, 2022
1 parent 2452119 commit f5f5e3c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions macroscripts/MAXLancer-Toolbox.mcr
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ macroScript Toolbox category:"MAXLancer" tooltip:"MAXLancer Panel" buttontext:"M

group "Miscellaneous" (
button createWireframesButton "Create Wireframes" width:128 height:24 align:#center tooltip:"Create wireframe shapes for selected editable meshes from visible edges."
button createCameraButton "Create Camera" width:128 height:24 align:#center tooltip:"Create camera part from selected camera object."
button resetXFormButton "Reset Transforms" width:128 height:24 align:#center tooltip:"Applies and collapses XForm Reset to selected editable meshes."
button centerPivotButton "Reset Center Pivots" width:128 height:24 align:#center tooltip:"Resets pivot for selected editable meshes."
)
Expand All @@ -490,6 +491,27 @@ macroScript Toolbox category:"MAXLancer" tooltip:"MAXLancer Panel" buttontext:"M

fn filterTargetHardpoint target = targetPart != undefined and damagePart != undefined and MAXLancer.IsHardpointHelper target and target.parent == targetPart.parent

fn filterCamera target = isValidNode target and superClassOf target == camera

on createCameraButton pressed do (
local target = MAXLancer.PickSceneObject filterCamera message:"Select camera object."

if target != undefined then (
local result = MAXLancer.CreateRigidPartHelper target.name

result.transform = RotateXMatrix -90 * target.transform
result.isCamera = true
result.fovX = target.fov
result.fovY = 2 * atan(1 / getRendImageAspect() * tan(target.fov * .5))
result.zNear = target.nearClip
result.zFar = target.farClip

select result
)

OK
)

on assignDestructibleButton pressed do (
targetPart = if selection.count == 1 and filterTargetPart selection[1] then selection[1] else pickObject message:"Pick target part" filter:filterTargetPart

Expand Down

0 comments on commit f5f5e3c

Please sign in to comment.