Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Toggle Isolate Selected (https://simplymaya.com/forum/showthread.php?t=22986)

Falott 04-09-2006 05:49 AM

Toggle Isolate Selected
 
// Toggle Isolate Selected
//

string $visPanel[]=`getPanel -vis`;
int $mode;
if (size($visPanel)>0)
{
for ($panel in $visPanel)
{
if (`match "^modelPanel" $panel`=="modelPanel")
{
$mode=`isolateSelect -q -state $panel`;
if ($mode>0)
isolateSelect -state 0 $panel;
else
isolateSelect -state 1 $panel;
}
}
print ("\nxray="+$mode+".");
} else
print ("\nNo model panels to modify.");

xray=0.editMenuUpdate MayaWindow|mainEditMenu;





there is something wrong with this script. it isolates the selection and toggles unselected back visible when executed again. but no matter which object is selected later on the script is affecting my first isolated object only.




the following script is taken from maya´s embedded scripts and does isolate selected but does not bring it back to visibility.


{ string $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`;
if ($panelType == "modelPanel") {
if (size(`ls -sl`) > 0)
{ enableIsolateSelect $currentPanel true; }
else
{ enableIsolateSelect $currentPanel false; } }}



anyone knows how to fix this?

skywola 04-09-2006 09:00 AM

Not one hundred percent sure if this is what you are attempting, but I modified a bit and the results appear that they may be what you want . . .

string $visPanel[]=`getPanel -vis`;
int $mode;
if (size($visPanel)>0)
{
for ($panel in $visPanel)
{
if (`match "^modelPanel" $panel`=="modelPanel")
{
$mode=`isolateSelect -q -state $panel`;
if ($mode>0)
isolateSelect -state 0 $panel;
else
isolateSelect -state 1 $panel;
}
}
print ("\nxray="+$mode+".");
} else
print ("\nNo model panels to modify.");

// this is the line that was throwing the error:
//xray=0

editMenuUpdate MayaWindow|mainEditMenu;

Congrats on the coding, I have done a lot of MEL and I'm not so familiar with this . . . what the heck are you actually using
it to do?

skywola 04-09-2006 09:09 AM

Are you by any chance attempting to toggle xray at the same time?

If so, I would just call the procedure within the procedure:

toggleXray;

Falott 04-09-2006 02:17 PM

I still don´t know sh* about mel after all. thx for taking your time skywola. what I wanna do is to toggle Isolate Select but it just wont work. I don´t want to toggle xray. I once copied the first script from the topic Maya tips & tricks from this site. tried to find it again but it´s gone.. don´t quite know where the xRay line came from. did a lot of copy and paste to get this working.

tried your suggestion of code and found out that maya on my machine still has the a problem. now nothing is isolated - means everything gets hidden. by now I believe its something with my installation files. :confused:

skywola 05-09-2006 06:14 AM

when I ran the code, the bottom part of the window said "isolate", then after re-running the code it appeared normal.

Didn't notice any changes in the window, I only had one object selected. What exactly is isolate select suppose to do?

Falott 05-09-2006 11:25 AM

if you have say - 2957 objects in your scene and you need to work on one object but that is covered by lots of other objects - isolateSelect it.

selected item remains visible, everything else is hidden. (but not in terms of hide and unhide, cause you can´t unhide the invisible objects when isolateSelected is active.)

find this funtion in any viewport - Show - Isolate Select - View Selected.

skywola 05-09-2006 02:41 PM

I *think* this is what you are trying to do . . .


string $visPanel[]=`getPanel -vis`;
int $mode;
if (size($visPanel)>0){
for ($panel in $visPanel){
if (`match "^modelPanel" $panel`=="modelPanel"){
$mode=`isolateSelect -q -state $panel`;
if ($mode>0){
isolateSelect -state 0 $panel;
isolateSelect -loadSelected $panel;
}
else{
isolateSelect -state 1 $panel;
isolateSelect -addSelected $panel;
}}}}

BTW . . I found the solution by looking up the example code in the MEL command referece, then dispite the fact that I did not know what the hell it was doing, I just played around with it in the script editor til I found the missing essential part that was not contained in the code you had listed . . . . The MEL command reference is a great place to look if you have a problem, because it gives you example code demonstrating how the command works . . . in this case however, their code did not work, but I was still able to extract what I needed from it to get some results . . .

Falott 05-09-2006 08:47 PM

let me say you are my personal superhero!

my problem is I dont understand mel enough to fiddle around in a somewhat constructive way. I can fiddle around but it is so intuitive and mostly doesn´t work. I´d very much like to say I´ve got too less time to learn mel but in fact I guess I´m just a lazy guy.

thx again, it´s working now.


All times are GMT. The time now is 02:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018