Just want the blend? Skip to the end.
This is something I made for work recently and have since been playing around with. It’s pretty fun, so I thought I’d share it with you. It started life as a node setup for rendering images or video as a halftone pattern, similar to how images in a newspaper look when viewed close up. It was an interesting challenge as it required mimicking the CMYK colours used in traditional printing. To do this the input image has to be converted to CMYK values, and then further manipulated to create the halftone pattern. (more…)
I’ve been working on some character rigs recently, and trying to learn and use more python to speed up the process and improve my rigs. One of my favourite uses that I’ve come across so far is using a “for” loop to do batch operations on bones, which is super handy when building complex rigs, as you can do batch renaming and changing of options on a whole bunch of bones at once rather than having to do things one-bone-at-a-time by hand. I thought I’d share some of my favourite python snippets that have come in handy so far.
When in edit mode, select the bones you want to change and put the following in a new text block, comment out any operations you dont want to perform, and hit alt-P to run the script:
bones_list = bpy.data.armatures['RIG NAME'].bones
bones_selected = bpy.context.selected_bones
##Some tools for renaming bones and removing trailing numbers once you’ve renamed them. Handy when duplicating parts of your deform rig to create your control rigs. Switch bones_selected for bones_list to perform an operation on every bone in your rig.##
for item in bones_selected:
item.name = item.name.replace(“DEF-”,”CON-”)
item.name = item.name.replace(“.001″,”")
item.name = item.name.replace(“.002″,”")
##Some tools for changing bone properties. use_deform turns off the bones “deform” option, always do this for bones you don’t want to directly deform your mesh (control/helper bones) . show_wire makes bone shapes visible in solid view mode, even if they only have edges.##
for item in bones_selected:
item.use_deform = False
item.show_wire = True
##Here are a couple of useful ones to try in pose mode. rotation_mode lets you set whether your bones use Euler or quarternion rotations, and custom_shape lets you set the bone shape used for all the bones you have selected. ##
bones_selected_pose = bpy.context.selected_pose_bones
for item in bones_selected_pose:
item.rotation_mode = ‘XYZ’
item.custom_shape = bpy.data.objects['NAME OF BONE SHAPE OBJECT']
So I got a nice shiny new monitor delivered yesterday, and relegated the old one to being my secondary display. With that in mind, I wanted an elegant solution for switching my wacom tablet between the two screens. By default, the tablet area gets stretched over the whole two screens, which is no good as the aspect ratio is all wrong, and even the slightest sideways motion of the pen results in the cursor going zooming across the screen. After a bit of research and fiddling, and more than a little guidance from @thejikz and @DavisSorenson on twitter I’ve finally got things set up how I want, and so I thought I’d write up a post on my findings for anyone else who’s stuck on the subject. Also next time I reinstall or update ubuntu I’ll have something to look up.
Restricting the Tablet to A Single Screen
On Ubuntu 11.04, with recent versions of the wacom tools, this is accomplised via a coordinate transform matrix. I know, not exactly the kind of user friendly terminology you were perhaps hoping for, but once you get the hang of it it’s not to difficult to work out what you need. I won’t explain the process here, as the ubuntu forums have a great thread on the topic with lots of explanation. Scroll to post #8 for a neat explanation for what each component of the matrix should be. Once you have that it’s just a matter of using the following commands.
Find out the device names for your tablet:
Then set the coordinate transform matrix for your device using:
xinput set-prop "Wacom Intuos3 9x12 stylus" --type=float "Coordinate Transformation Matrix" 0.533333 0 0 0 1 0 0 0 1
Switching the device name for the one you got from “xinput –list” and replacing the CTM with whatever yours happens to be. For me the above command restricts my tablet to my left hand monitor. To switch to the right I use:
xinput set-prop "Wacom Intuos3 9x12 stylus" --type=float "Coordinate Transformation Matrix" 0.466666 0 0.533333 0 0.875 0.125 0 0 1
Setting up buttons
With those commands worked out, all I had to do was map them to my tablet buttons. This was done by first creating new keyboard shortcuts using ubuntus regular keyboard shortcuts editor. I just created new shortcuts, that issued the commands above, and mapped them to something reasonably obscure so they wouldn’t conflict with other apps. In my case I chose shift + print screen and shift + pause.
Then I mapped my tablet buttons to activate these keyboard shorcuts as follows:
xsetwacom --set "Wacom Intuos3 9x12 pad" Button 1 "key Shift Pause"
xsetwacom --set "Wacom Intuos3 9x12 pad" Button 3 "key Shift Print"
Finally I created a script that issues these commands at start-up and added it to my start-up applications, so that I get my tablet configured how I like every time I start ubutu. And that’s pretty much it. Not exactly plug and play, but it get’s the job done!