after action done, close dialog // DestroyDialog rollout

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
after action done, close dialog // DestroyDialog rollout

hello everyone.

i got this simple script her:

rollout modalRollout "rim orientation"
(

button btn_ok "ok"
button btn_rot "flip"

on btn_ok pressed do
DestroyDialog modalRollout

on btn_rot pressed do
rotate $rim (angleaxis 180 [0,0,1]) + DestroyDialog rimOr
)
createdialog modalRollout modal:true


-it creates a dialog and asks if a object is looking right or not
-if yes (pressing ok) dialog closes and script goes on
-if no (pressing flip) the object is rotated by 180 and after that the dialog closes and the script moves on.

problem: the listener shows mit this error:

-- Error occurred in btn_rot.pressed();

the script itself works and no obvious error messages appear, just in the background the lisener shows me some error. any ideas how to fix this....OR any better solution possible?
 
Old 10 October 2012   #2
Post

here's your error, remove red part or replace it by
rotate $rim (angleaxis 180 [0,0,1]); DestroyDialog modalRollout


chechinkg that $rim exist before would be better

rollout modalRollout "rim orientation"
(

button btn_ok "ok"
button btn_rot "flip"

on btn_ok pressed do
DestroyDialog modalRollout

on btn_rot pressed do
rotate $rim (angleaxis 180 [0,0,1]) + DestroyDialog rimOr
)
createdialog modalRollout modal:true
 
Old 10 October 2012   #3
thanks for reply

ok after another round of "google" (i searched after my error message) i know got this and is has no errors anymore and works fine:

rollout modalRollout "rim orientation"
(

button btn_ok "ok"
button btn_rot "flip"

on btn_ok pressed do
DestroyDialog modalRollout

on btn_rot pressed do
(
rotate $rim (angleaxis 180 [0,0,1])
DestroyDialog modalRollout
)
)
createDialog modalRollout modal:true



what i learned:

if this: on btn_rot pressed do has more then one job to do like mine, i have to wrap these two ( ) arround

thanks for your try

Last edited by subframed : 10 October 2012 at 06:46 PM.
 
Old 10 October 2012   #4
I should have replace all code.
It sounded natural for me to put my separate line beetween parenthesis.
At least you will remenber it forever because you learned it the hard way
 
Old 10 October 2012   #5
As suggested above, for added safety I would modify slightly to this:

on btn_rot pressed do
(
if $rim != undefined do
(
rotate $rim (angleaxis 180 [0,0,1])
)
DestroyDialog modalRollout
)
)
__________________
Matt Rennie
Sr. Character Rigger
Rockstar North
 
Old 10 October 2012   #6
thanks all of you for your suggestions!
yes lanimal, sometimes is learning things the hard way the best way
 
Old 10 October 2012   #7
# because the dialog is modal you should check a node existence before its showing.
# i would simply use the queryBox:

   if isvalidnode node and queryBox ("Do you want to flip \"" + node.name + "\"?") beep:off do rotate node ...
   
 
Old 10 October 2012   #8
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:04 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.