How can I find the max u value of my NURBS curve?
The maxValue attribute on the shape node of your NURBS curve will tell you this.import maya.cmds as mc uVal = mc.getAttr('myCurveShape.maxValue') You could then (for the sake of example) select that...
View ArticleWhy do I get weird symbols in my variables, that cause them to break?
Sometimes when filling variables, either in Maya, or when looking at a mayaAscii file, you'll see "non-standard" characters \ symbols like:€ // what is that, the Euro symbol? # // pound symbol 1.#QNAN...
View ArticleTrigonometry references
http://inventwithpython.com/blog/2012/07/18/using-trigonometry-to-animate-bounces-draw-clocks-and-point-cannons-at-a-target/Great visual reference using Python and Pygame to show how to use trig.
View ArticleMaya Links
Quality links you should know about, having to do with Maya, and mel:'Official':Autodesk's site. (So long Alias...)Maya Documentation: Online, for multiple versions.Current release notesAutodesk...
View ArticleAPI : How can I author a user event?
This post by Kristine Middlemiss breaks it down very nicely:http://around-the-corner.typepad.com/adn/2012/07/setting-a-user-event-within-maya.htmlTranscribed from that post for prosperity:# Here's how...
View ArticleAPI: How can I author callbacks for Maya events?
The most common way to do this is via mel scriptJobs. But via the OpenMaya API, you can access many 'Message' classes that provide a lot more functionality to areas that scriptJob's don't provide.It...
View ArticlePerlin Noise
While not specifically Maya related, this post does a great job of covering concepts and pseudo-code (Python-ish) behind it:http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
View ArticlePhysics & simulation examples
Great page covering many physics topics from cloth simulation to inverse kinematics:http://freespace.virgin.net/hugo.elias/models/m_main.htmWhile not directly Maya related, much of the pseudo-code...
View ArticleHow can I 'move a pivot' via the 'insert key' on a Mac?
Insert on a PC appears to be 'function+left arrow' on a Mac. :-S
View ArticleHow can I project points through different coordinate spaces?
The OpenMayaUI API's M3dView class has several methods for doing this. An example of projecting a 3d worldspace point to 2d screen-space can be found here:How can I convert a 3d point to 2d screen...
View ArticleHow can I convert a 3d point to 2d screen space?
Got pointed to the blog post here by Rob Bredow. Take a gander.As I figured, Maya actually does most the heavy lifting for you, if you know what to call. This blog post by Cyrille Fauvel describes...
View ArticleWhy are various Smooth Skin tools broken in 2012?
Update: This appears to be local to my machine. While I've not modified any of Maya's default scripts in this area, other people are not reporting the problem. I guess I'm just... lucky........
View ArticleHow can I execute code when a window is deleted?
Often times I want to call a function when I close/delete a window. Unfortunately there is no 'delete detection' for this via the window command and no way via the window command to assign callbacks....
View ArticleHow can I flip the 'green' channel on my normal-map display?
Normal maps are finicky things: Often it seems that the green channel needs to be flipped to be viewed properly in Maya relative to how it should be in your game engine. I've written tools to do this,...
View ArticleHow can I find edge-connected verts based on a source vert?
In both examples, you pass in a mesh\vertex ID, it returns back the names of all the verts connected to that one based on common edges. The API version is a lot less code... half of it is just getting...
View ArticleHow can I extract the vertex id number from its name?
When you query the selection of vert via ls(), it will give you back data like so: pPlane1.vtx[60].How can you get just the vert id number 60 from that string? Python's re module makes this pretty...
View ArticleHow can I execute a smooth bind?
So simple, but I always seem to forget the syntax... :-Simport maya.cmds as mc mc.skinCluster(someListOfJoints, aMesh, dropoffRate=5.0, maximumInfluences=4, toSelectedBones=True) print skinCluster #...
View ArticleHow can I query the influences of the Paint Skin Weights Tool?
The active influence can be found in:global string $artSkinLastSelectedInfluence; A list of the highlighted influences can be found in:global string $gArtSkinOrderedInfluenceSelectionList[]; These...
View ArticleHow can I toggle 'xray joints' in the active view?
Python:import maya.cmds as mc modelPanel = mc.playblast(activeEditor=True) value = not mc.modelEditor(modelPanel, query=True, jointXray=True) mc.modelEditor(modelPanel, edit=True, jointXray=value)...
View ArticleAPI : How can I register a Maya Developer Node ID Block?
When making custom node types via scripted-plugins (or regular 'ol compiled plugins), they need a MTypeId set to a specific value, so that custom node types won't clash:import maya.OpenMaya as om...
View Article