My *splutter* lovely *ahem* face sits on the left side now, I’m not a narcissist I promise. I updated a lot since I put it live, I’m pretty happy with the way it’s going, if this was proper software development I’d say I’ve reached beta. I know that I need to add more content, this is my first text post in a little while, I’ve been having fun just fiddling with how the site works. If you’re interested in how WordPress is working for me, I love it! Plenty of plugin support and on the off chance I don’t find something I’m after, the code is documented well so it’s easy to build on existing functionality. I’m understanding why WordPress is one of the biggest CMS’.
The biggest update: I restructured the way that my art is displayed, it’s as a post type instead of a random page of images. I was originally updating them manually but now I’ve got galleries in place, thanks nivoBox (lightbox) & jetpack! I did some work in PHP, HTML & CSS to format the way posts appear in the Artwork page which looks pretty damn snazzy now if I do say so myself.
I do have one complaint that my images seem to be heavily compressed. I did some research and it may be a WordPress function doing it, I was pretty sure it only happened when I connected jetpack but not 100% about that. I’ll try my best to fix that soon as well.
In other news, I got setup in Maya for some Pymel scripting! I was originally just doing straight python, but from an OOP standpoint Maya’s python is alien and non-intuitive to me. Pymel has some overhead but I think clear readable code is important too, if I wanted the best performance I’d be writing a C++ plugin, it seems to be quick enough for most operations any way (feels faster than Maxscript? I’m probably imagining it).
To get myself up to scratch I wrote a small Maya script that centers & bottoms out the pivot pretty simple!
import pymel.core.nodetypes as nt
import pymel.core as pm
#importing pymel and pymel nodetypes for the Transform cmds.
# Get some info, bounding box lowest, center the pivot and get center pivot info.
pvt = nt.Transform(node).getBoundingBoxInvisible(worldSpace=True)
xyz = nt.Transform(node).getRotatePivot(worldSpace=True)
# input bounding box lowest y value into the xyz value for later.
xyz = pvt
# Main 'Loop' Begins
# For loop iterates over selected nodes.
for node in pm.selected():
if pm.nodeType(node) == 'transform':
For the code itself it’s pretty simple, the main loop iterates through all the objects the user has selected and identifies if it meets the type ‘transform’, if so it’ll trigger the cntrBtm() function. There’s a big reason for the loop itself, of course the user may not have selected a transform so the script will throw a Python error, in the same vein I first noticed this when I created an object. In Maya when you select and existing object you will by default grab the transform, when creating an object the transform isn’t the selected object which threw me for a loop for a moment (excuse the pun). In the function, we have a pvt variable being declared as the result of getBoundingBoxInvisible(ws=True) which returns a list of the bounding box’s limits. For example, if we draw a 1 meter3 cube, centered on world 0, then getBoundingBoxInvisible(ws=True) would return -0.5m, -0.5m, -0.5m, 0.5m, 0.5m 0.5m. The results are ordered as xmin, ymin, zmin, xmax, ymax, zmax, Maya’s height is measured along the Y axis so ymin will give us the lowest point of the mesh.
The variable xyz does something similar, it returns a list of co-ordinates for the current rotatePivot (rotate pivot is shared with the translate). Python is a 0+ index language which means that we count lists starting at zero. 0 = milk, 1 = sugar, 2 = eggs… So all we have to do now is change the xyz variable so that it’s second item ‘xyz’ is equal to the ymin value which also happens to be at ‘pvt’. Done! Just throw that into a setPivots command.
As far as scripts go this one was pretty tame but was really fun to get started with PyMel so I’ll be working on more in the future.
Side note: I just realised my favicon (image in the tab) looks like a jellyfish instead of the letters 3D, jelly fish are cool so it’s a happy accident.
The last executed function I used in my script was wrong. It reset the transform when it shouldn’t have, I must admit that coming over from Max I’m still getting used to Maya, though I should have caught this sooner as it works pretty much the same way. I could probably just query the pivot position too instead of reaching for transforms, but it was a good dive into that area at least. It works across all selected objects same as before.