heightField : The node that previews displacement
Since I always seem to forget, the heightField node is what's used to preview material displacements, by connecting the out displacement of the material/texture to the in displacement attr on the...
View ArticleWhy do Maya's preferences get reset when it's reopened?
Had a nasty case of certain Mya preference (specifically Maya's autosave) states being reset when Maya was reopened.Come to find out, a function my userSetup.py was calling to, was executing this line...
View ArticleHow can I deselect highlighted channels in the Channel Box?
Had an animator request a way to deselect any highlighted channels in the channel box: I could find no way via the channelBox command to do this. The docs list it having a -select flag, but when you...
View ArticleHow can I query the entire input tree into a node?
I needed a way to find all the inputs feeding into a node, and all their inputs. The whole 'input tree'. This snippet recurisvely searches through all the nodes that input into a given node, and all of...
View ArticleHow can I query the enumNames for an enumAttr?
You don't want to query the current enumAttr value, you want to query all their names:string $enumAttrs = `addAttr -q -enumName "myNode.myEnumAttr"`; This returns a single string of attr names...
View ArticleHow can I add a new enumName to an enumAttr?
First, you need to get the existing names:string $enumAttrs = `addAttr -q -enumName "myNode.myEnumAttr"`; "enumA:enumB:enumC"Then you can append your new attr to those names, and add:string...
View ArticlePyMel : enum attr access
There's enough complexities with enum attrs they deserve their own section.Code used in the next sessions:node = pm.PyNode("null1") attrName = "myEnum" enumVals = ["one", "two", "three", "four"] Add an...
View ArticlePyMel : Why doesn't my scriptTable creation code work?
So, it looks like the scriptTable is broken in Maya 2016 PyMel. Here's a hack around it: Make a regular maya.cmds wrapper for it, when created.def scriptTable(*args, **kwargs): """ PyMel errors when...
View ArticleHow can I query if a mesh has a hole or not?
Maybe there's an easier way, but this is one solution :)The only reason I don't like it is because you have to actually select stuff for the polySelectConstraint to work.This code simply checks to see...
View ArticleGiven two already existing nodes, how can I "replace" one node with another?
Check out the replaceNode.mel script. Located here: .../MayaX.X/scripts/others/replaceNode.mel There's also the nodeCast command.
View ArticleChanging the file type causes Maya to loose the scene name.
As of Maya 2016, there's an annoying bug: If you open a scene, and change its file type (from ma to mb or vice versa), it will lose the scene name. If you open a scene, save the scene, then change the...
View ArticleAPI: How can I get a screen-shot of the active view?
Wow, so easy:# Python code import maya.OpenMaya as om import maya.OpenMayaUI as omui fileType = 'jpg' imageFile = 'c:/temp/mayaScreen.%s'%fileType mimage = om.MImage() view =...
View ArticleHow can I trigger a callback whenever a keyframe is set?
I needed a way to know whenever a keyframe was set in Maya: There didn't seem to be a way to do this via a scriptJob, but the API to the rescue.The below callback will print the names of the animCurve...
View ArticleHow can I copy or paste text into the Script Editor?
This will copy\paste data in the top half (the 'reporter') of the Script Editor:cmdScrollFieldReporter -e -copySelection "cmdScrollFieldReporter1"; cmdScrollFieldReporter -e -pasteSelection...
View ArticleHow can I dock or undock a window via code?
Based on the example in Query which standard Maya dockControl is visible : you can learn the default control names for the Channel Box, Attribute Editor, etc. Based on that, how can you dock \ undock...
View ArticleQuery which standard Maya dockControl is visible
Maya stores the Channel Box / Attribute Editor/ Tool Settings (etc) dock labels and control names in a global mel string array called $gUIComponentDockControlArray. From that, you can query which one...
View ArticleBlend shape deformer pitfall
Ran across this post describing how to code in-between blendshapes,... and the absolute chaos that is needed to pull it off:http://forums.cgsociety.org/showthread.php?t=1079399
View ArticleHow can I query the blend shape targets for a given blend shape?
string $list[]= `listAttr -m "<name of blendshapes>.w"`; thanks to a post from David ColemanHere's that in some PyMel:import pymel.core as pm bsNode = pm.PyNode("myBlendshapeNode") bsTargetNames...
View ArticleWrap notes
Wrap deformers never seem to work right when I first try. Here's some notes for my future self: You select the thing to be wrapped first, and the thing doing the wrapping second. This is backwards to...
View ArticleThe Evaluation Graph
Maya 2016 introduced the Evaluation Graph. Bugs:The MPxNode.schedulingType method isn't supported in 2016 OpenMaya Python APIIssueYou can't do this, it's not supported: def schedulingType(self): return...
View Article