snipt

Ctrl+h for KB shortcuts

Python

Maya Batch Render

render -r mr -cam cam1  -s 50 -e 100 -rd /Users/path/ThisIsWhereYourImagesWillBeSaved1 /Users/path/LocationOfMayaFile.mb
https://snipt.net/embed/c839da1d29ac388fcfe2f76a5420c865/
https://snipt.net/raw/c839da1d29ac388fcfe2f76a5420c865/
c839da1d29ac388fcfe2f76a5420c865
python
Python
1
2016-09-17T06:59:55
True
False
False
/api/public/snipt/22250/
maya-batch-render
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="n">render</span> <span class="o">-</span><span class="n">r</span> <span class="n">mr</span> <span class="o">-</span><span class="n">cam</span> <span class="n">cam1</span> <span class="o">-</span><span class="n">s</span> <span class="mi">50</span> <span class="o">-</span><span class="n">e</span> <span class="mi">100</span> <span class="o">-</span><span class="n">rd</span> <span class="o">/</span><span class="n">Users</span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">ThisIsWhereYourImagesWillBeSaved1</span> <span class="o">/</span><span class="n">Users</span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">LocationOfMayaFile</span><span class="o">.</span><span class="n">mb</span> </span></pre></div> </td></tr></table>
maya

Python

meodo listade()

1
2
3
4
5
6
7
8
 def listade(self, tipo):
        import LVmayaObjects.mayaObject as LVmayaObject
        
        lista = mc.ls(type= tipo)
        ret = [LVmayaObject.mayaObject(nombre = object, tipo = tipo).tipificame() for object in lista]
        return  ret
    
    
https://snipt.net/embed/bc9d4b4cd5166c5f82098f54f63ddc0b/
https://snipt.net/raw/bc9d4b4cd5166c5f82098f54f63ddc0b/
bc9d4b4cd5166c5f82098f54f63ddc0b
python
Python
8
2016-09-22T02:09:27
True
False
False
/api/public/snipt/20706/
meodo-listade
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a> <span class="k">def</span> <span class="nf">listade</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tipo</span><span class="p">):</span> </span><span id="L-2"><a name="L-2"></a> <span class="kn">import</span> <span class="nn">LVmayaObjects.mayaObject</span> <span class="kn">as</span> <span class="nn">LVmayaObject</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a> <span class="n">lista</span> <span class="o">=</span> <span class="n">mc</span><span class="o">.</span><span class="n">ls</span><span class="p">(</span><span class="nb">type</span><span class="o">=</span> <span class="n">tipo</span><span class="p">)</span> </span><span id="L-5"><a name="L-5"></a> <span class="n">ret</span> <span class="o">=</span> <span class="p">[</span><span class="n">LVmayaObject</span><span class="o">.</span><span class="n">mayaObject</span><span class="p">(</span><span class="n">nombre</span> <span class="o">=</span> <span class="nb">object</span><span class="p">,</span> <span class="n">tipo</span> <span class="o">=</span> <span class="n">tipo</span><span class="p">)</span><span class="o">.</span><span class="n">tipificame</span><span class="p">()</span> <span class="k">for</span> <span class="nb">object</span> <span class="ow">in</span> <span class="n">lista</span><span class="p">]</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">return</span> <span class="n">ret</span> </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a> </span></pre></div> </td></tr></table>
maya, pipeline, python

Python

metodo graba_seleccionado

1
2
3
4
5
6
7
8
def graba_seleccionado(self, path, formato = 'mayaBinary'):
        basepath = os.path.split(path)[0]
        if not os.path.exists(basepath):os.makedirs(basepath)
        
        mc.file(path, es = True, type=formato, f=True )
        nueva = scene(path = path) 
        return nueva
    
https://snipt.net/embed/fbf13d233c73487efbc81003c25e8cc6/
https://snipt.net/raw/fbf13d233c73487efbc81003c25e8cc6/
fbf13d233c73487efbc81003c25e8cc6
python
Python
8
2016-08-26T05:25:55
True
False
False
/api/public/snipt/20705/
metodo-graba_seleccionado
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">def</span> <span class="nf">graba_seleccionado</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">formato</span> <span class="o">=</span> <span class="s">&#39;mayaBinary&#39;</span><span class="p">):</span> </span><span id="L-2"><a name="L-2"></a> <span class="n">basepath</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">path</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">basepath</span><span class="p">):</span><span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">basepath</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a> <span class="n">mc</span><span class="o">.</span><span class="n">file</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">es</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">formato</span><span class="p">,</span> <span class="n">f</span><span class="o">=</span><span class="bp">True</span> <span class="p">)</span> </span><span id="L-6"><a name="L-6"></a> <span class="n">nueva</span> <span class="o">=</span> <span class="n">scene</span><span class="p">(</span><span class="n">path</span> <span class="o">=</span> <span class="n">path</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a> <span class="k">return</span> <span class="n">nueva</span> </span><span id="L-8"><a name="L-8"></a> </span></pre></div> </td></tr></table>
maya, pipeline, python

Python

metodo selecciona

1
2
3
4
5
6
   def selecciona(self, add = True):
        if add==True:
            mc.select(self.nombre, add = True)
        else:
            mc.select(self.nombre, r = True)
     
https://snipt.net/embed/8d3782bf028f676c12072ce2ddf1146b/
https://snipt.net/raw/8d3782bf028f676c12072ce2ddf1146b/
8d3782bf028f676c12072ce2ddf1146b
python
Python
6
2016-09-03T00:43:35
True
False
False
/api/public/snipt/20704/
metodo-selecciona
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a> <span class="k">def</span> <span class="nf">selecciona</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">add</span> <span class="o">=</span> <span class="bp">True</span><span class="p">):</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">if</span> <span class="n">add</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span> </span><span id="L-3"><a name="L-3"></a> <span class="n">mc</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nombre</span><span class="p">,</span> <span class="n">add</span> <span class="o">=</span> <span class="bp">True</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">else</span><span class="p">:</span> </span><span id="L-5"><a name="L-5"></a> <span class="n">mc</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nombre</span><span class="p">,</span> <span class="n">r</span> <span class="o">=</span> <span class="bp">True</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a> </span></pre></div> </td></tr></table>
maya, pipeline, python

Python

metodo emparenta

1
2
3
4
5
    def emparenta(self, object):
        hijo = object.nombre if object.tipo == 'transform' else object.padre().nombre
        padre = self.nombre if self.tipo == 'transform' else self.padre().nombre        
        mc.parent(hijo, padre)
 
https://snipt.net/embed/a2459c22d09592562bb3281e4cb24cd4/
https://snipt.net/raw/a2459c22d09592562bb3281e4cb24cd4/
a2459c22d09592562bb3281e4cb24cd4
python
Python
5
2016-09-12T06:56:43
True
False
False
/api/public/snipt/20703/
metodo-emparenta
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a> <span class="k">def</span> <span class="nf">emparenta</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">object</span><span class="p">):</span> </span><span id="L-2"><a name="L-2"></a> <span class="n">hijo</span> <span class="o">=</span> <span class="nb">object</span><span class="o">.</span><span class="n">nombre</span> <span class="k">if</span> <span class="nb">object</span><span class="o">.</span><span class="n">tipo</span> <span class="o">==</span> <span class="s">&#39;transform&#39;</span> <span class="k">else</span> <span class="nb">object</span><span class="o">.</span><span class="n">padre</span><span class="p">()</span><span class="o">.</span><span class="n">nombre</span> </span><span id="L-3"><a name="L-3"></a> <span class="n">padre</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nombre</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">tipo</span> <span class="o">==</span> <span class="s">&#39;transform&#39;</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">padre</span><span class="p">()</span><span class="o">.</span><span class="n">nombre</span> </span><span id="L-4"><a name="L-4"></a> <span class="n">mc</span><span class="o">.</span><span class="n">parent</span><span class="p">(</span><span class="n">hijo</span><span class="p">,</span> <span class="n">padre</span><span class="p">)</span> </span><span id="L-5"><a name="L-5"></a> </span></pre></div> </td></tr></table>
maya, pipeline, python
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.