slooper
11-06-2003, 05:06 PM
I am working on a plugin script that creates depth planes in the viewport when a FreeCamera is created. I can create the planes fine, but the camera itself will not appear in the viewport. It seems to happen when I use the 'tool create' command. The FreeCameras I create show up fine, but I still want to see the original camera. Any suggestions?
Here is a section of the code:
tool create
(on mousePoint click do
case click of
(
1: (FreeCamera name:"MainCam" pos:gridpoint
--------------clone cameras------------------
local cloneList = #()
for i = 1 to 8 do
(
maxOps.cloneNodes $MainCam offset:[((4.5-i)*($MainCam.Target_Distance)/(convergence)),0,0] cloneType:#instance newNodes:&cloneList
cloneList.parent=$MainCam
)
--------------make planes-----------------
local planes = #("pNear", "pZero", "pFar")
local offset = #(-$MainCam.Target_Distance/2, -$MainCam.Target_Distance, -$MainCam.Target_Distance*2)
local color = #(red, green, blue)
for i = 1 to 3 do
(Plane name:planes[i] length:100 width:100 pos:(gridpoint + [0,0,offset[i]]) wireColor:color[i] renderable:false backfaceCull:false isFrozen:true showFrozenInGray:false parent:$MainCam
)
-------------set planes visibility---------
local planes2 = #($pNear, $pZero, $pFar)
for i = 1 to 3 do
(planes2[i].visibility=bezier_float()
planes2[i].visibility.controller.value=0.5
)
---testing---
--transformations----
rotate $MainCam (angleaxis 90 [1,0,0])
)
2: #stop
)
on mouseMove click do
case click of
(
2: (nodeTM.pos = gridPoint
$MainCam.pos = gridPoint
)
)
)
Here is a section of the code:
tool create
(on mousePoint click do
case click of
(
1: (FreeCamera name:"MainCam" pos:gridpoint
--------------clone cameras------------------
local cloneList = #()
for i = 1 to 8 do
(
maxOps.cloneNodes $MainCam offset:[((4.5-i)*($MainCam.Target_Distance)/(convergence)),0,0] cloneType:#instance newNodes:&cloneList
cloneList.parent=$MainCam
)
--------------make planes-----------------
local planes = #("pNear", "pZero", "pFar")
local offset = #(-$MainCam.Target_Distance/2, -$MainCam.Target_Distance, -$MainCam.Target_Distance*2)
local color = #(red, green, blue)
for i = 1 to 3 do
(Plane name:planes[i] length:100 width:100 pos:(gridpoint + [0,0,offset[i]]) wireColor:color[i] renderable:false backfaceCull:false isFrozen:true showFrozenInGray:false parent:$MainCam
)
-------------set planes visibility---------
local planes2 = #($pNear, $pZero, $pFar)
for i = 1 to 3 do
(planes2[i].visibility=bezier_float()
planes2[i].visibility.controller.value=0.5
)
---testing---
--transformations----
rotate $MainCam (angleaxis 90 [1,0,0])
)
2: #stop
)
on mouseMove click do
case click of
(
2: (nodeTM.pos = gridPoint
$MainCam.pos = gridPoint
)
)
)
