Kenzor
03-30-2006, 11:55 AM
What is the correct way to change the active viewport whilst in tool Mode?
I'm writing a script which requires the user to pick a point in each viewport.
I started off by looking at PEN and Bobo's very nice onion skin scripts..
I've got the the script working so that when the user picks a point in the initially active view a marker appears where you click. ..
But when I try and change the viewport no marker appears... The viewport keeps reseting to the initial viewport when you click..
DestroyDialog CamRoll
rollout CamRoll "camera match"
(
Checkbutton chkPoint "pick point"
fn TheMousePos v = [v.x,v.y,0]
fn CheckView v =
(
AVNum = viewport.activeViewport
if v.x < 0 then AVNum -=1 else if v.x > gw.getWinSizeX() do AVNum +=1
if v.y < 0 then AVNum -=2 else if v.y > gw.getWinSizeY() do AVNum +=2
AVNum
)
fn drawFn=
(
viewport.setLayout #layout_4
gw.setTransform (viewport.getTM())
tool screenDraw
(
On MousePoint arg do
(
viewport.activeViewport = CheckView viewPoint
gw.setTransform (viewport.getTM())
curPoint = TheMousePos viewPoint
gw.wMarker curPoint #xMarker
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
On MouseAbort arg do
(
#stop
)
)
startTool screenDraw
print "test"
enableSceneRedraw()
)
on ChkPoint changed arg do
(
if arg then
(
enableSceneRedraw()
disableSceneRedraw()
drawFn()
)else
(
enableSceneRedraw()
)
)
)
CreateDialog CamRoll 200 200
What do I need to do?
Do I have to restart the tool somehow??
Thanks for your help..
I'm writing a script which requires the user to pick a point in each viewport.
I started off by looking at PEN and Bobo's very nice onion skin scripts..
I've got the the script working so that when the user picks a point in the initially active view a marker appears where you click. ..
But when I try and change the viewport no marker appears... The viewport keeps reseting to the initial viewport when you click..
DestroyDialog CamRoll
rollout CamRoll "camera match"
(
Checkbutton chkPoint "pick point"
fn TheMousePos v = [v.x,v.y,0]
fn CheckView v =
(
AVNum = viewport.activeViewport
if v.x < 0 then AVNum -=1 else if v.x > gw.getWinSizeX() do AVNum +=1
if v.y < 0 then AVNum -=2 else if v.y > gw.getWinSizeY() do AVNum +=2
AVNum
)
fn drawFn=
(
viewport.setLayout #layout_4
gw.setTransform (viewport.getTM())
tool screenDraw
(
On MousePoint arg do
(
viewport.activeViewport = CheckView viewPoint
gw.setTransform (viewport.getTM())
curPoint = TheMousePos viewPoint
gw.wMarker curPoint #xMarker
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
On MouseAbort arg do
(
#stop
)
)
startTool screenDraw
print "test"
enableSceneRedraw()
)
on ChkPoint changed arg do
(
if arg then
(
enableSceneRedraw()
disableSceneRedraw()
drawFn()
)else
(
enableSceneRedraw()
)
)
)
CreateDialog CamRoll 200 200
What do I need to do?
Do I have to restart the tool somehow??
Thanks for your help..
