Tip: pydrivers.py

Here's a great tip from the BlenderWiki:

If you create a text in Blender called pydrivers.py, any functions or variables you define there will be available (under the p namespace) from a pydriver that's controlling an IPO channel. Great for keeping those pydrivers concise!

Bake Scripted Drivers

I wish I could ‘bake’ IPO channels that are being driven by a python script, so that I could see them visually and tweak them by hand. Barring that, just being able to preview it visually would be nice.

Arbitrary Attributes in Blender

I wish I could add new, arbitrary attributes to things in Blender, then associate an IPO curve with them. That's something I really miss from Maya.

That, and the ability to plug in crazy shit from one channel to another. Like using the color value from a texture to drive the position of an object — I wish I could do random stuff like that in Blender without having to spend hours scripting an ad-hoc solution myself.

Why would I ever want to do that?

If you have to ask, your imagination needs a jump-start.

Defaults and Constraints

I read an article in Scientific American Mind, “When Words Decide” by Barry Schwartz, about how the phrasing of a question or proposal can dramatically alter the way people answer it.

Among the examples was the astounding difference in organ donor rates between countries with an opt-in policy (where you must sign a form in order become an organ donor upon death) and those with an opt-out policy (where you must sign a form in order not to). As you can probably guess, in countries with an opt-out policy, organ donor rates were much higher: from eyeballing the graphs, it looks like about 95% in opt-out countries, but only about 15% in opt-in countries.

Beyond simple laziness of avoiding the extra hassle of signing a special form, the author suggests that people accept the default because they perceive it as being the recommended choice. Unless they have some special reason to go against the flow, they usually won't.

Continue reading “Defaults and Constraints”

Bought a GP2X

I splurged on a GP2X (the open-source handheld game/entertainment console) the other day, and it arrived today in the mail. I also went ahead and bought a couple accessories at the same time: the TV-out cable, a USB-SD card reader, and the GP2X “cradle” (which will allow for connecting USB controllers, if I figure out how to get the darn thing to sit right).

Continue reading “Bought a GP2X”

Looking at Rails

I picked up “Agile Web Development with Rails” yesterday. Despite using ruby for over 3 years, I have not up until this point put any concentrated effort into learning and using Rails. I've been running (or rolling, as it were) through the tutorial, an online bookstore app.

By and large, the impression I have so far of Rails is that it's very convenient. It seems like Rails has built-in just about anything you'd want to do—at least, in the limited domain of database-driven web applications.

As I learn more and more about Rails, I can't help contrasting it with Rubygame. It has been somewhat humbling, but also motivating.

Continue reading “Looking at Rails”

Picking apart Rubygems and Rake

I'm prepping for the 2.0.1 release of rubygame, which includes a number of bug fixes and improvements under the hood, especially in the way method arguments are processed in C methods. All the code is ready and waiting to be packaged up, but I'm tinkering with the Rakefile to make it play well with Rubygems, especially on win32 platforms.

In the 2.0.0 release, there were some snags supporting win32 users. The precompiled binaries were packaged up in gems so users wouldn't have to compile rubygame for themselves (this is more of an issue on win32 than on linux, which has the GNU C compiler available as a general rule). Unfortunately, the gem didn't work correctly for all users: despite the precompiled binaries being present, the Rakefile didn't think they had been compiled, and would throw a fit when it was unable to compile them for itself.

Continue reading “Picking apart Rubygems and Rake”

Ramble: Curves Roadblock

I've been pounding my head against the wall over these Bézier curves for the past couple days. For a change of pace, I'm going to pound my head against this blog instead, and hope that something useful falls out.

Continue reading “Ramble: Curves Roadblock”

Bézier Curve Test

Screenshot of a Bézier curve

Here's a screenshot from the test application for the work with cubic Bézier curves I've been doing lately. Click the image at right to view the full picture.

Continue reading “Bézier Curve Test”

Cubic Bézier Curves

I spent some time solving equations for evaluating points along a cubic Bézier curve. What I find particularly elegant about Bézier curves is that they can be calculated with recursive/nested linear interpolations. It gets 100 geek points just for the phrases "recursive" and "linear interpolation" — it also wins my appreciation for how comparatively simple it is to solve by hand!

I had come up with an equation a while back for doing this same task, but it wasn't as tight as it could be. For one thing, it required evaluating the coefficients for each curve every time a point was evaluated.

Continue reading “Cubic Bézier Curves”