writing a simple toggle?

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
  10 October 2004
writing a simple toggle?

Hello,

I am used to mel, and have no experience in perl, unfortunately.
i was wondering if anyone can help me out in writing a simple toggle that i can then bind to a key.
something like a wireframe toggle.
i just want to be able to switch from no wire to colored.
this is what i wrote, but it doesn't work, hehe:

#perl
if((viewport.3dView wireframe:?) == "none")
{viewport.3dView wireframe:"colored";}
else
{viewport.3dView wireframe:"none";}


i saved it as a perl file and named it "wireframeTGL.pl"
then i typed "@E:\modoStuff\scripts\wireFrameTGL.pl" into the cmd line.
it said it was a success in the results, but nothing happens, and i am not quite sure how to use lxout and stuff yet.

thanks for your time,
-zeebit
 
  10 October 2004
why do not you just use a single command line and assign to a shortcut?. i have assigned many shortcuts to different view functions, like enabling vertices, wireframe etc. just run the viewport properties and enable something and track it from command line, i am guessing that you knew this but just in case
__________________
ben bir çok oturgaçli götürgecim.
http://portfolio.plecxus.com/
 
  10 October 2004
i love your shit kursad, just so you know.
i check your site all the time.
hehe

i wanted to have a single button that can toggle the functionality as opposed to having to make a button for on and a button for off.

armaduck in #luxology on efnet helped me make this modo compliant.

#perl
if(lxq("viewport.3dView wireframe:?") == "none")
{
lx("viewport.3dView wireframe:\"colored\"");
}
else
{
lx("viewport.3dView wireframe:\"none\"");
}

-zee
 
  10 October 2004
If you look in your resource directory (on my computer it is in: C:\Documents and Settings\Me\Application Data\Luxology\modo\resrc) you will find: MSWireframeToggle.pl.

This does just what you want. There are a few options that I like to toggle off and on, so I assigned them to a pie menu. Search in here about pie menu's, because someone (I forget who) wrote very descriptive steps on how to set them up. Here's the contents of the wireframe toggle perl program:

#perl
my $cages, $guides;
$wire = lxq("viewport.3dView wireframe:?");
if ($wire) {
$wire = 0;
}
else {
$wire = 2;
}
lx("viewport.3dView wireframe:$wire");

Now I have a question for all the perl gurus that might view this. I was trying to create my own toggle for changing select style from lasso to rectangle. Here is what I got:

#perl
my $selStyle;
$selStyle = lxq("select.lassoStyle:?");
if ($selStyle) {
$selStyle = 0;
}
else {
$selStyle = 1;
}
lx("select.lassoStyle:$selStyle");


I'm new to perl. Anyone know how I may debug this? Anyone know how I might be able to step through this code line by line and see the value of the variables?

Anyways, I hope this is what you needed zeebit. Good luck.
 
  01 January 2006
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 07:56 AM.


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