Hobbs
05-02-2008, 10:13 PM
Is there a way to set focus to the viewport after executing a script? I'm having an issue after i run a collect and select script where after i run it, i'm allowed to navigate through a scene, but keyboard short cuts aren't working.
Example, i collect all the boxes in the scene using a collection line, and then select them. I am allowed to navigate through the scene, but i'm not able to switch to wireframe mode etc, or zoom in on selected.
The only way i've been able to solve this problem is clicking in the viewport, which usually makes me lose the items i've just selected.
Here's the code i am using, if it also helps, i'm running Draster's switcher as well.
(
global CollectRollout
try( destroyDialog CollectRollout)catch ()
rollout CollectRollout ""
(
edittext CollectBoxText fieldWidth:120 offset:[0,10]
groupBox CollectGroup "search" pos:[5,0] width: 145 height:40
button CloseButton "x" pos:[160, 2] width:14 height:14
on CloseButton pressed do DestroyDialog CollectRollout
on CollectBoxText entered txt do
(
if txt != "" do
(
clearSelection()
with undo on
(
MultipleNodes = for o in objects where matchpattern o.name pattern:("*"+CollectBoxText.text+"*") collect o
select MultipleNodes
CollectBoxText.text = ""
);
)
);
)
createdialog CollectRollout pos:[38,1003] width:175 height:40 align:#left style:#( #style_sysmenu,#style_resizing) modal:false escapeEnable:true lockHeight:true lockWidth:true
)
Has any one else come across this problem?
.
Example, i collect all the boxes in the scene using a collection line, and then select them. I am allowed to navigate through the scene, but i'm not able to switch to wireframe mode etc, or zoom in on selected.
The only way i've been able to solve this problem is clicking in the viewport, which usually makes me lose the items i've just selected.
Here's the code i am using, if it also helps, i'm running Draster's switcher as well.
(
global CollectRollout
try( destroyDialog CollectRollout)catch ()
rollout CollectRollout ""
(
edittext CollectBoxText fieldWidth:120 offset:[0,10]
groupBox CollectGroup "search" pos:[5,0] width: 145 height:40
button CloseButton "x" pos:[160, 2] width:14 height:14
on CloseButton pressed do DestroyDialog CollectRollout
on CollectBoxText entered txt do
(
if txt != "" do
(
clearSelection()
with undo on
(
MultipleNodes = for o in objects where matchpattern o.name pattern:("*"+CollectBoxText.text+"*") collect o
select MultipleNodes
CollectBoxText.text = ""
);
)
);
)
createdialog CollectRollout pos:[38,1003] width:175 height:40 align:#left style:#( #style_sysmenu,#style_resizing) modal:false escapeEnable:true lockHeight:true lockWidth:true
)
Has any one else come across this problem?
.
