Tuesday, July 28, 2015

Photoshop - Tips and Tricks - Lasso Tool

If you ever tried to trace the contour of something with the Lasso Tool you might found that it was appropriate tool for organic things. However sometimes we need straight lines for the selection and that is where Polygonal Lasso Tool comes in place.
The thing is you can mix both in the same time.

If you press and hold the Alt (Option key on Mac ) and then release the (left) mouse button, you'll temporarily switch to the Polygonal Lasso tool so you can draw a straight line. If you hold the mouse button again can continue to use the Lasso Tool. When you release the Alt (Option) key and the mouse button, Photoshop completes your selection with a straight line.

How wonderful it is.

Thursday, June 11, 2015

Maya - Node Types - Filter Types

How to list all the lambert shaders in maya?
Well, if we use the MEL or pyhton command ls -type "lambert" we get more than just lambert shaders (if there are others in the scene). The reason is that the lambert shader has a type name which is the type for eg. blinn and phong are inherited from. The class hierarchy or inheritance diagram looks like this.


We can get this from the maya API documentation but we can query via MEL or python commands.

The following line gives us the inheritance diagram of  "blinn1" shader as a list:

 cmds.nodeType("blinn1", inherited = 1)  
 # Result: [u'shadingDependNode', u'lambert', u'reflect', u'blinn'] #   

As we can see the items are similar but not the same. That is why because MEL and python scripts not work with C++ API names. If we look up blinn  node from the nodes list of the technical documentation area we can see the parents field:


If we click on reflect we get the node to get the description of that node we can see the relfect node's partent is the lambert.

So we can really search node types or "supertypes". We can imagine these nodes as part of a set. Maya  ls command and other commands with type flag can use these types. So for eg. we can list all the shape nodes in the scene by entering the following line:

 cmds.ls(type = "shape")  

Or we can filter all the geometry type shapes, like curves, nurbs surfaces, meshes:

 cmds.ls(type = "geometryShape")  

So answering the first question: we can filter lambert shaders if we list lambert type with ls than check the exact type with nodeType command.

 lambertTypeMaterialList = cmds.ls(type = "lambert")  
 lambertMaterialList = []  
 for item in lambertTypeMaterialList:  
     if cmds.nodeType(item) == "lambert":  
         lambertMaterialList.append(item)  
 # Result: [u'lambert1', u'lambert2'] #   


With python set we can achieve useful functions easily. I wrote a function to check two or more objects' common type. I hope it works well.


 def GetCommonClass(SelectedNodeList):  
     '''  
     == DESCRIPTION ==  
     Get the common type of the passed object list which is the first item in the inheritance diagram.  
     For eg. if we test a directionalLight and a nurbsCurve type nodes together the inheritance diagram are like this:  
     [u'containerBase', u'entity', u'dagNode', u'shape', u'geometryShape', u'deformableShape', u'controlPoint', u'curveShape', u'nurbsCurve']  
     [u'containerBase', u'entity', u'dagNode', u'shape', u'light', u'renderLight', u'nonAmbientLightShapeNode', u'nonExtendedLightShapeNode', u'directionalLight']  
     And we can see the first common type is the 'shape'.  
     == INPUT ARGUMENTS ==  
     + list - SelectedNodeList - Maya node list  
     +  
     == RETURN ==  
     string - the first common type   
     == DEPENDENCIES ==  
     - maya.cmds  
     -  
     '''  
     if SelectedNodeList:  
         nodeTypeList = []  
         nodeTypeSet = set()  
         for item in SelectedNodeList:  
             nodeTypeList = cmds.nodeType(item, inherited = 1)  
             print nodeTypeList  
             if len(nodeTypeSet) != 0:  
                 nodeTypeSet.intersection_update(set(nodeTypeList))  
                 if len(nodeTypeSet) == 0:  
                     print "There is no common type within selection."  
                     return None  
             else:  
                 nodeTypeSet.update(set(nodeTypeList))  
         commonTypeIndexList = []  
         for commonType in nodeTypeSet:  
             commonTypeIndexList.append(nodeTypeList.index(commonType))  
         firstCommonType = nodeTypeList[sorted(commonTypeIndexList)[-1]]  
         return firstCommonType  
     else:  
         return None  

Wednesday, April 22, 2015

Implementing RV in Maya as a Sequence Viewer

You migth wonder how the hack maya can call RV to play the image sequence right after the playblast. It is quite simple. You have to set it in the Preferences window (Window menu / Settings/Preferences / Preferences).



Below the Image Sequence in the left text field enter the file path of the rvpush.exe. The Optional Flags should be this:

-tag playblast merge %f


Source

Tuesday, April 21, 2015

Ideas for Maya - Search and highlight items in Attribute Editor

As all maya user know that there is a forum where we can share ideas about maya. We can pressure the developers to pull themselves together. So please vote for this idea. It is really important for you and me and the community and for the country, of course.

Search and highlight items in Attribute Editor

This is the base forum:
Ideas for maya
And there is another:
Small annoying things to fix in maya

I just wonder there is no "big annoying things to fix in maya" forum. I would have a couple of hints :)

Wednesday, April 15, 2015

Maya Bug - UV Set renaming

Okay, it might not be a bug we can call it feature :)
When an object has a history and you would like to rename the current UV Set it will produce error.

Case one:
There will be a new UV Set with the name you just gave.

Case two:
The current UV Layout will disappear

Case three:
Maya crash

Case four:
I had a situation when the unwanted new UV Set had a new UV layout as well.

And you should know you can't undo these operations. You definitely can't undo when maya crashes.

Fortunately if you delete the history before renaming it will work.

Thursday, February 26, 2015

Nuke - Read Node - Image Sequence Length

Useful thing to display on read node the length of the image sequence. I guess the easiest way to do that is to use a TCL expression:

 [ expr [value last] - [value first] ]  

You can do it fancy way:

 length: [ expr [value last] - [value first] ]f  



On read node it will look like this.



How wonderful it is.

Monday, February 23, 2015

Maya Bug - displayColor in maya 2015

Let's call it bug. Before maya 2015 SP5 we used maya 2012 in the studio. I don't know which version is the first where this "feature" was added to maya.
If I run this line it produces RuntimeError:


 cmds.displayColor("headsUpDisplayLabels", 16, dormant = 1)  

The funny thing is it changes the color but produces error. So I can handle it with exception.


 try:  
   cmds.displayColor("headsUpDisplayLabels", 16, dormant = 1)  
 except RuntimeError:  
   pass  

I know what you are thinking: Holy crap!

So is there something I don't know? Or what?