Archive for category software

surface pro and sdl 2.0

I’ve been working on a game in my spare time, which has led me to look for easy ways to create pixel art. So far my running favorite is grafx2, which is one of the few that runs almost perfectly with pen and touch (many pixel editors don’t like the newfangled bits of Windows 8).

However, grafx2 has a few oddities, which has kept pushing me on my search. Eventually I came across the SDL site after a loooong time not looking at it, and discovered that v2.0 has finally been released. It’s a modern update, and I figured I might have a go at writing a very simple pixel art editor in all the spare time I don’t have.

Anyway, since I want to edit the art on my Surface Pro, I downloaded the latest version of MinGW and set about building a testbed using SDL 2.0. First few things went well, but then it crashed when I attempted to create an accelerated SDL_Renderer.

The culprit seems to be the Intel Graphics driver that’s on the Surface Pro by default. After installing the new version from this link, I’m able to create the accelerated renderer and the program does not crash.

If you’re wondering if your own crashes are related, and they occur around program startup or just after the first real window has been opened, look in the crash log for mentions of ig7icd32.dll — that’s part of the Intel driver.

Interestingly, this update has also made Analogue: A Hate Story work on my Surface Pro again! And I’ve heard that this fixes the crash on startup experienced by some players of FTL.

Tags: , , ,

maya hotkeys for Blender 2.61

Rigging Dojo Link! The interest was in the Maya hotkeys for Blender. It’s funny because earlier in the week I had a discussion with a coworker about how hard learning Blender is for users of other software.

I’ve had a newer version put together by the wonderful and talented Rob Garlington sitting in my inbox for the past few months, but between moving across town, starting a new job, and getting engaged, I’ve been very lax in blog updates. For the interested, I’ve posted his updated file here:


It’s a shame that Rob’s setup can’t be added to the main Blender distribution; I think that having “familiar” hotkeys and navigation would go a long way towards swaying users of other packages to give Blender a try and show them that integrating it into any pipeline has its benefits. (I put quotes around “familiar” because the only software I’ve been using longer than Blender is Lightwave, so Blender’s hotkey setup has always made sense to me.)

The following are Rob’s installation notes.


Install (Note this has only been tested on Windows 7)

Full Functionality Install: (to fully take advantage of the keymap changes)

  1. Start Blender and open the ‘startup.blend’ file included in the ‘\config’ folder. Then go to ‘file/save user settings’ (or press ctrl + U) to save this file as the default scene, then close Blender. (This will setup a special directory under your ‘Users’ folder.)
  2. Go to the folder C:\Users\’your name’\AppData\Roaming\Blender Foundation\Blender\2.61 (note that the ‘AppData’ directory may be hidden, but it is there nonetheless and you’ll need to unhide it). Extract the contents of the archive into the 2.61 folder (overwrite files as necessary).
  3. Open Blender again and it should all be setup. To ensure it’s working, if you go to the ‘Input’ tab under ‘file/user preferences’ you should see that ‘Maya Advanced’ is loaded into the filter section.

Partial Functionality Install: (Some mouse selection features are missing with this method)

  1. Simply open the startup.blend included in the ‘\config’ folder. Then go to ‘file/save user settings’ to save the scene as the default.

fun with python modules

New scripters I speak with don’t often know how to easily load code from external folders / modules in Python scripts. Today’s post will give you a few pointers in both Cinema 4D and Maya.

Setting Your Script Paths

Python’s import command should be no stranger to you if this topic interests you– it was probably the second thing most people learn in Python, after writing “Hello, World!” to the console. Import allows you to bring in code from libraries external to the source file in which you’re currently working. For example:

# commonly seen in Cinema 4D
import c4d
from c4d import *

# commonly seen in Maya
import maya
from maya import cmds as mc
import pymel.all as pm

These statements bring whatever module you specify into the current namespace, or bring in functions, classes, and variables. But where are the libraries that the import method references? Where do they live on disk?

The easiest way to find out is to list Python’s sys.path:

import sys

In my case, in Maya, it outputs the following:




Looking in the folders that are listed, you may find any number of Python source files and Python object files (*.pyc). sys.path is great because it’s just a regular Python list, which means it’s editable. You can append any number of paths that you like to it, and when import is called it will look through each and every path for the name specified.

Let’s try this in Cinema 4D. First, make a folder somewhere on your machine. I’m going to use /Users/Carney/Desktop/scripts for this example (I’m on a Mac.) In that folder, create a new file called and add the following text:

# simple utility functions

def ut_log(*args):
    msg =''
    for arg in args:
        msg += ' ' + str(arg)

Now back in Cinema 4D, open the Console and the Script Manager from the Scripts menu. In the Script Manager, paste the following and hit Execute, replacing the path with the folder you chose above:

import sys

import util
util.ut_log('Fun', 'Bunnies', 'are', 'fun.')

If all’s well, you should get a single sentence printed to the console output. If you made a mistake, you may get an error about not being able to import the util file. Check your path and try again.

With this setup, you can write scripts in your application that reference lengthy libraries of external code or other utility functions that you’ve created. At the moment I’m organizing code into single files with multiple functions for shorter utilities. Any function that’s more complex gets it’s own file and a class to contain it. This leads to funny lines like the following:

import module_generic
mod = module_generic.GenericModule()

But the organization and the ability to quickly update code without having to sift through a monolithic file inside the C4D Script Manager is worth the headache.

Automatically Adding Python Search Paths in Maya

The only thing to remember about this setup is that you have to make sure you add that folder you created to sys.path every time your application starts. In Maya this is a simple and well-known trick, but I had to do some digging to find out the same for Cinema 4D.

In both applications there’s a special Python file that gets loaded every time the Python VM restarts. In Maya, the file is called

Automatically Adding Search Paths in Maya

and it must live in one of three places:

  • ~/Library/Preferences/Autodesk/maya/2012-x64/prefs/scripts
  • ~/Library/Preferences/Autodesk/maya/2012-x64/scripts
  • ~/Library/Preferences/Autodesk/maya/scripts

You may notice that these are listed in the above printout of sys.path. When Maya starts it will execute files it finds. If you put the file in a folder that has the version of Maya specified (for example, in maya/2012-x64/scripts), then only that version will load the userSetup. If you place it in the general scripts folder — the last folder listed above — then it will be loaded by all Maya versions that support Python.

You can also use the MEL command internalVar -usd to find a folder that will work.

The userSetup file can execute any code you like when Maya loads, allowing you to have custom menus auto-created or to modify your sys.path variable so that you can access your code at any time. Try this: save a file into , and make sure it contains the following (after modifying the path to point to where you saved your file):

import sys

Now in Maya, open the script editor and copy, paste, and run the following:

import util
util.ut_log('Fun', 'Bunnies', 'are', 'funner.')

If all worked, you’ll see a line printed from your file letting you know that the custom setup succeeded on Maya startup, and you’ll see the proper output from this file.

Automatically Adding Python Search Paths in Cinema 4D

The way to do the above in Cinema 4D seems to be less well-known: you have to find the folder that is appropriate for your particular version of Cinema 4D and copy in a file called

The easiest way to find this folder is to go to the Scripts menu and choose User Scripts > Script Folder. This is the folder where scripts you’ve edited and saved through the Script Manager live. Now, go up one folder to Library, then go up again. This is the main folder for your version of Cinema 4D; it may have an oddly long name, but it contains your prefs and libraries. The file belongs in prefs/python. As an example, my folder is:

  • /Users/Carney/Library/MAXON/Cinema 4D R13/prefs/python/

Final Notes

This is just the start of organizing your code. If you want to know more, I recommend reading the official documentation on Python modules.

Tags: , , ,

maya input mapping for blender

A friend and fellow Blenderhead, Rob Garlington, spent a great deal of time working on an input remapping for Blender 2.5. What’s neat about his solution is that he’s also gone in and remapped the mouse inputs with the keyboard, so users coming over from Maya will really have a much easier time selecting objects or components and getting around the scene in general.

He doesn’t have a website set up yet, so I’ve offered to host his file here. It requires and has been updated for Blender 2.59.

After the download link, I’ve posted notes on usage from his email.

Download: Maya Input Remapping for Blender 2.59 (724kb)


The easiest way to install is to open this startup file in Blender 2.59, then go to ‘file\user preferences’ go to the bottom of the preferences screen and click the ‘save as default’ at the bottom. And that’s it, all the keys have been loaded into blender so that when you open any new scene it will use my key setup. If you ever want to go back to blender default simply click ‘file\load factory settings’.


  • One thing to note despite my many changes to animation there was no option to deselect keys by simply clicking on blank space in the f-curve editor. So just press ‘A’ to deselect everything that way.
  • Most default blender settings that have been changed to accommodate this new setup usually require a ‘shift’ to work now. For instance to extrude a face press ‘shift e’ to work now.
  • Animation Changes:

  • ‘left click drag’ to marquee select keys
  • ‘middle mouse button’ moves the keys
  • ‘right click mouse’ will scrub the dope sheet and f-curve editor.
  • ‘s’ set to insert keyframe
  • ‘ctrl + alt + left mouse’ button for border zoom
  • ‘f’ will view all
  • ‘alt + right mouse drag’ for view zooming
  • ‘alt + middle mouse’ to move all 2d screens
  • ‘k + left mouse’ to scrub timeline in 2d screens
  • ‘, .’ goes to next or previous keyframe
  • ‘alt , or .’ goes to next or previous frame
  • 3D View Changes:

  • ‘left click drag’ select
  • ‘middle mouse button’ moves everything
  • ‘f’ will view selected
  • ‘left click’ outside of the object, deselects in object, edit mesh and pose mode
  • ‘spacebar’ brings up the dynamic spacebar menu
  • ‘right click’ (in edit mesh mode) brings up the mesh selection of faces/verts/edges
  • ‘4,5,6’ are mapped to the corresponding shading modes
  • ‘ctrl d ‘ duplicates objects/faces and everything else in Blender that can be duplicated
  • ‘g’ for repeat action
  • ‘shift + LMB’ will add more objects/verts/faces/edges to your selection
  • ‘ctrl + LMB’ will deselect objects/verts/faces/edges
  • ‘shift right click’ for 3d cursor placement
  • ‘shift space’ for search
  • ‘z’ also does an undo function in addition to the standard ‘ctrl z’
  • ‘ctrl + right click’ will enable lasso mode.
  • ‘alt + s and r’ go into scale and rotation mode
  • ‘ctrl + alt + s,r or g’ have been changed to clear the scale rotation or translation on any given object.
  • ‘y’ will bring up a special material selection toolbox.
  • Timeline:

  • ‘left click drag’ to scrub the main timeline
  • Things that remain the Blender default:

    Get used to using ‘a’ to either select or deselect everything as it is Blender’s default. UV view remains mostly the same as before.

    Tags: ,