<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MEL command to set zoom in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433090#M8635</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Try This....&lt;/P&gt;
&lt;PRE&gt;window;
rowColumnLayout ;
string $perspCameras[] = `listCameras -p`;
text -l "Select Camera";
textScrollList -allowMultiSelection false myCameraObj;
for($i=0;$i&amp;lt;size($perspCameras);$i++)
{
    textScrollList -e -append $perspCameras[$i] myCameraObj;
}
button -l "ZOOM IN" -command "rsZoomIn";
button -l "ZOOM OUT" -command "rsZoomOut";
showWindow;
global proc rsZoomIn()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    float $rsCurVal = `getAttr ($rsSlCamera[0]+".translateZ")`; 
    setAttr ($rsSlCamera[0]+".translateZ") ($rsCurVal-0.5);
}
global proc rsZoomOut()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    float $rsCurVal = `getAttr ($rsSlCamera[0]+".translateZ")`; 
    setAttr ($rsSlCamera[0]+".translateZ") ($rsCurVal+0.5);
}&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Nov 2018 13:00:54 GMT</pubDate>
    <dc:creator>rajasekaransurjen</dc:creator>
    <dc:date>2018-11-29T13:00:54Z</dc:date>
    <item>
      <title>MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8432571#M8634</link>
      <description>&lt;P&gt;Hey, Does anyone know how to use MEL to zoom an active viewport? I have tried following various avenues but my programming abilities are next to non. I think panZoom should be able to do it but I can't get it to work. I would like to be able to reliably return to a known zoom; something I can't do with the analog zoom with mouse.&amp;nbsp;Panning about without changing the zoom, in fear of loosing &amp;nbsp;the zoom position, can be a real tiring exercise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Thanks in advance for any help. Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 09:21:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8432571#M8634</guid>
      <dc:creator>EkDoreo</dc:creator>
      <dc:date>2018-11-29T09:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433090#M8635</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Try This....&lt;/P&gt;
&lt;PRE&gt;window;
rowColumnLayout ;
string $perspCameras[] = `listCameras -p`;
text -l "Select Camera";
textScrollList -allowMultiSelection false myCameraObj;
for($i=0;$i&amp;lt;size($perspCameras);$i++)
{
    textScrollList -e -append $perspCameras[$i] myCameraObj;
}
button -l "ZOOM IN" -command "rsZoomIn";
button -l "ZOOM OUT" -command "rsZoomOut";
showWindow;
global proc rsZoomIn()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    float $rsCurVal = `getAttr ($rsSlCamera[0]+".translateZ")`; 
    setAttr ($rsSlCamera[0]+".translateZ") ($rsCurVal-0.5);
}
global proc rsZoomOut()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    float $rsCurVal = `getAttr ($rsSlCamera[0]+".translateZ")`; 
    setAttr ($rsSlCamera[0]+".translateZ") ($rsCurVal+0.5);
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 13:00:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433090#M8635</guid>
      <dc:creator>rajasekaransurjen</dc:creator>
      <dc:date>2018-11-29T13:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433464#M8636</link>
      <description>&lt;P&gt;Thanks for the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Effects as I see them. Only "persp" camera is in the list. Clicking the zoom in button only shifts the object down and is reflected in its translation value.&amp;nbsp;Reverse for the Zoom out button. I&amp;nbsp;noticed you have .translateZ in the code a few times... I like your windowed approach. Would make it easier to use than I expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Amended&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 14:49:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433464#M8636</guid>
      <dc:creator>EkDoreo</dc:creator>
      <dc:date>2018-11-29T14:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433475#M8637</link>
      <description>&lt;P&gt;Strange. I created a new project and it stopped moving the object. but would still only effect the perspective camera by shifting the camera up and down. I see I just noticed that it appears to translate up or down any object I have selected when i run the script. Persp camera by default. Also is the only one that updates live.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Amended&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 14:53:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8433475#M8637</guid>
      <dc:creator>EkDoreo</dc:creator>
      <dc:date>2018-11-29T14:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435138#M8638</link>
      <description>&lt;P&gt;if you want we can add front side top cameras too....&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 04:17:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435138#M8638</guid>
      <dc:creator>rajasekaransurjen</dc:creator>
      <dc:date>2018-11-30T04:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435157#M8639</link>
      <description>&lt;P&gt;Hey, That would be god since&amp;nbsp;most liklyto use in thise views. But&amp;nbsp;no matter what I do it will only translate and not zoom.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I havd been previously creating a cube of the correct size. I move it. Select it. Press F to frame the cube&amp;nbsp;which zooms to fit the cube. Subject to error if the interface changes. I suspect other methods might as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 04:57:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435157#M8639</guid>
      <dc:creator>EkDoreo</dc:creator>
      <dc:date>2018-11-30T04:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435220#M8640</link>
      <description>&lt;P&gt;Try this....&lt;/P&gt;
&lt;P&gt;window;&lt;BR /&gt;rowColumnLayout ;&lt;BR /&gt;string $perspCameras[] = `listCameras`;&lt;BR /&gt;text -l "Select Camera";&lt;BR /&gt;textScrollList -allowMultiSelection false myCameraObj;&lt;BR /&gt;for($i=0;$i&amp;lt;size($perspCameras);$i++)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; textScrollList -e -append $perspCameras[$i] myCameraObj;&lt;BR /&gt;}&lt;BR /&gt;button -l "ZOOM IN" -command "rsZoomIn";&lt;BR /&gt;button -l "ZOOM OUT" -command "rsZoomOut";&lt;BR /&gt;showWindow;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;global proc rsZoomIn()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($rsSlCamera[0]=="top"||$rsSlCamera[0]=="front"||$rsSlCamera[0]=="side")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float $rsCurVal = `getAttr ($rsSlCamera[0]+"Shape.orthographicWidth")`;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setAttr ($rsSlCamera[0]+"Shape.orthographicWidth") ($rsCurVal-1);&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float $rsCurVal = `getAttr ($rsSlCamera[0]+".translateZ")`; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setAttr ($rsSlCamera[0]+".translateZ") ($rsCurVal-0.5);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;global proc rsZoomOut()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($rsSlCamera[0]=="top"||$rsSlCamera[0]=="front"||$rsSlCamera[0]=="side")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float $rsCurVal = `getAttr ($rsSlCamera[0]+"Shape.orthographicWidth")`;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setAttr ($rsSlCamera[0]+"Shape.orthographicWidth") ($rsCurVal+1);&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float $rsCurVal = `getAttr ($rsSlCamera[0]+".translateZ")`; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setAttr ($rsSlCamera[0]+".translateZ") ($rsCurVal+0.5);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 05:37:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435220#M8640</guid>
      <dc:creator>rajasekaransurjen</dc:creator>
      <dc:date>2018-11-30T05:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435256#M8641</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Try This...Skip the above one.&lt;/P&gt;
&lt;PRE&gt;window;
rowColumnLayout ;
string $perspCameras[] = `listCameras`;
text -l "Select Camera";
textScrollList -allowMultiSelection false myCameraObj;
for($i=0;$i&amp;lt;size($perspCameras);$i++)
{
    textScrollList -e -append $perspCameras[$i] myCameraObj;
}
button -l "ZOOM IN" -command "rsZoomIn";
button -l "ZOOM OUT" -command "rsZoomOut";
showWindow;

global proc rsFram()
{
     
     viewFit -all cameraShape1;
}
    
global proc rsZoomIn()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    if($rsSlCamera[0]=="top"||$rsSlCamera[0]=="front"||$rsSlCamera[0]=="side")
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+"Shape.orthographicWidth")`;
         setAttr ($rsSlCamera[0]+"Shape.orthographicWidth") ($rsCurVal-1);   
    }
    else
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+".overscan")`; 
         setAttr ($rsSlCamera[0]+".overscan") ($rsCurVal-0.5);
    }
}
global proc rsZoomOut()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    if($rsSlCamera[0]=="top"||$rsSlCamera[0]=="front"||$rsSlCamera[0]=="side")
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+"Shape.orthographicWidth")`;
         setAttr ($rsSlCamera[0]+"Shape.orthographicWidth") ($rsCurVal+1);   
    }
    else
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+".overscan")`; 
         setAttr ($rsSlCamera[0]+".overscan") ($rsCurVal+0.5);
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 06:16:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8435256#M8641</guid>
      <dc:creator>rajasekaransurjen</dc:creator>
      <dc:date>2018-11-30T06:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8442809#M8642</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&amp;nbsp;Rajasekaransurjen,&lt;/P&gt;
&lt;P&gt;Sorry about my delay in getting back to you. Work and all that. Anyway I&amp;nbsp;just tried both script. Both worked as expected. Using the third script as per your wise judgement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I were to make changes:&amp;nbsp; Would it be possible to either.&lt;/P&gt;
&lt;P&gt;(1) have a number field to enter an exact value to zoom to? Instead of incrementing. Not all views start out equal if framing a selection. Also would want it to remember the value across the session. If you are able to do this based on my grid spacing I would be able to predict the value.&lt;/P&gt;
&lt;P&gt;(2)&amp;nbsp;Or, I would be happy editing the script as needed with an easy accessible variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, thanks for all your efforts. Really appreciate it. This will be a valuable tool on my shelf.&amp;nbsp;Should be others who can use this as well. - Brook&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 05:24:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8442809#M8642</guid>
      <dc:creator>EkDoreo</dc:creator>
      <dc:date>2018-12-04T05:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8443478#M8643</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Try This....&lt;/P&gt;
&lt;PRE&gt;window;
rowColumnLayout ;
string $perspCameras[] = `listCameras`;
text -l "Select Camera";
textScrollList -allowMultiSelection false myCameraObj;
for($i=0;$i&amp;lt;size($perspCameras);$i++)
{
    textScrollList -e -append $perspCameras[$i] myCameraObj;
}
text -l "Enter Zoom Value";
string $rsFltFld = `floatField rsFltFld`;
button -l "ZOOM IN" -command "rsZoomIn";
button -l "ZOOM OUT" -command "rsZoomOut";
showWindow;

global proc rsZoomIn()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    if($rsSlCamera[0]=="top"||$rsSlCamera[0]=="front"||$rsSlCamera[0]=="side")
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+"Shape.orthographicWidth")`;
         float $rsZmVal = `floatField -q -v rsFltFld`;
         setAttr ($rsSlCamera[0]+"Shape.orthographicWidth") ($rsCurVal-$rsZmVal);   
    }
    else
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+".overscan")`; 
         float $rsZmVal = `floatField -q -v rsFltFld`;
         setAttr ($rsSlCamera[0]+".overscan") ($rsCurVal-$rsZmVal);
    }
}
global proc rsZoomOut()
{
    string $rsSlCamera[] = `textScrollList -q -si myCameraObj`;
    if($rsSlCamera[0]=="top"||$rsSlCamera[0]=="front"||$rsSlCamera[0]=="side")
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+"Shape.orthographicWidth")`;
         float $rsZmVal = `floatField -q -v rsFltFld`;
         setAttr ($rsSlCamera[0]+"Shape.orthographicWidth") ($rsCurVal+$rsZmVal);   
    }
    else
    {
         float $rsCurVal = `getAttr ($rsSlCamera[0]+".overscan")`; 
         float $rsZmVal = `floatField -q -v rsFltFld`;
         setAttr ($rsSlCamera[0]+".overscan") ($rsCurVal+$rsZmVal);
    }
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Dec 2018 11:28:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8443478#M8643</guid>
      <dc:creator>rajasekaransurjen</dc:creator>
      <dc:date>2018-12-04T11:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8458767#M8644</link>
      <description>&lt;P&gt;Hey, Thanks again,&lt;/P&gt;
&lt;P&gt;Much better. Not exactly what I suggested but is a good addition. Now I can zoom out and back in much quicker to a fixes size. Does behave weird. Is this a limitation of Maya's mel portal zoom accessibility?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to set this as accepted. you have done more than enough free work for me. It is awesome what you have done for me. Thanks you so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Brook&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 03:49:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8458767#M8644</guid>
      <dc:creator>EkDoreo</dc:creator>
      <dc:date>2018-12-11T03:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: MEL command to set zoom</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8458814#M8645</link>
      <description>&lt;P&gt;You are welcome.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 04:55:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-command-to-set-zoom/m-p/8458814#M8645</guid>
      <dc:creator>rajasekaransurjen</dc:creator>
      <dc:date>2018-12-11T04:55:49Z</dc:date>
    </item>
  </channel>
</rss>

