Sunday, March 28, 2010

Fonts

I'm not really a font nerd, but I know there's a bunch out there who are. Might be better sites somewhere, but here's a really easy to use and quite verbose one:
http://www.fontspace.com/
Trying to get the wedding invitations all done, so looking around for a nice font for it. Ended up using Arabella I think. Fancy, but not too fancy. Now I need to find a nice Japanese font. All the ones on that site look too menacing! read more...

Thursday, March 25, 2010

Python tutorial wiki

I found this nice tutorial wiki page for intro to python stuff.
Looks about right for the inquiring artist. Still have to read through it a bit more, but seems better than most of the 'for programmer' documents relating to python.

http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_2.0

So now, consider basic stuff skipped, and I can just rant about what I'm doing directly without building up to it. read more...

Wiki with info about using mental ray materials in Maya

I'm using a lot more pre-rendered features in maya, so I'm going to have to study up.
Here's a link my friend Javier sent me.
http://wiki.bk.tudelft.nl/toi-pedia/MIA_Material_-_Basics
read more...

Sunday, March 14, 2010

Shopping trip


Shopping trip
Originally uploaded by mrlinds



read more...

Python Image Library

Want to work on Images of any sort in python? The python image library is where it's at. You have to go and install it though.
I found out a couple less than straightforward things in doing this.
First, Python 3 and up don't have a version made for it yet. Yeah, one of those newer not being better things.

Second, if you plan on using it on the mac, like OsX I mean, you have to compile it yourself, which is quite intimidating for someone like me. Especially if yo have to dig around everywhere to find that OsX likes to run python in 64bit mode by default, even when you're on a 32 bit machine. So super fun. I had the same problem running an applescript from python.
Thirdly, and here's something I haven't figured out, is that it seems like on the mac, or in some configurations I have to either 'import PIL.Image' or 'import Image'.
to handle switching this easily, right now I'm doing 'import PIL.Image as Image' which is easiest to fix.

anyways, the documentation is quite easy to figure out, and then getting the size or data from the image is quite straightforward. Using composite with images that already have transparency saved me a billion hours now that I don't have to sit and watch Photoshop do it.

I thought I was having trouble with it today, but I was stupidly running my script with recursive directory image searching, so ended up saving over the output I was putting in a subfolder with a cropped copy of what I'd already put there. It got ugly and took forever to figure out.
So in respect to the last post talking about recursion:
recursion is a powerful ally, but also a dangerous enemy. Beware!
read more...

Tuesday, March 9, 2010

Delete the hell out of a folder

This is my breakdown of a python function I'm using to delete a folder.
What I want of course is a no muss, no fuss deletion of a folder, all it's contents including all it's sub-folders and the same so on and on.
That's called 'recursion'. When I first heard about it, it took a bit to get my head around. Basically it's a function which calls itself.
WIERD! I know.

so in plain form we want:
function run on filepath =>
See what's in that filepath =>
if it has a folder, run this same function on that folders filepath (go back to step one until you don't have any sub-folders, in which case that call of the function ends, and you slingshot out of that and back up until you're out of the matrix completely) =>
if you find a file, delete it. =>
once the folder has everything deleted out of it, delete that folder, then end the function!

In my working script, I have some extra catches and conditions to avoid errors. I'll over comment this
comments are whatever is after a '#' in a line. Python is all about indenting, as I'm jumping ahead quite a bit and haven't covered any of that basic stuff yet. But you could play with that yourself or find that info elsewhere or later if you want.

import os #add a module we will need to use. Find what ones you need in the help file.
def delete_folder(path): #Define the function, what the variable it's recieving will be called in brackets, then colon.
   if( os.path.exists(path) ): #indent then run an 'if' condition (similar syntax to the function def. colons!) Make sure the path exists.
       files = os.listdir(path) #find everything in the folder
       for fil in files: #this is a loop. This will iterate over a list making 'fil' the variable I chose in this case, one item in the list at a time.
           pth = os.path.join(path, fil) #Handy function for joining paths and filenames.
           if( os.path.isfile(pth) ): #check if it's a file, if it is, then delete it.
               os.remove( pth )
           elif ( os.path.isdir(pth) ): #elif runs if the preceding condition is False only. If not a file, a folder?
               delete_folder(pth) # here we're having this function run itself. Crazy, no? but it works!
       files = os.listdir(path) #this isn't strictly needed, but lets double check.
       if(len(files)>0): #check for one or more entries?
           pass #pass doesn't do anything, but since python needs something here, this is what is used. indentation and all that.
       else: #if the first case isn't true, then do what's here
           os.rmdir( path ) # delete the directory fed into the function at the start! nice,eh?

So, in a nutshell, that's what I'm using right now. now I can call this later in code and clean up a directory etc. But be careful, as with great power comes great responsibility, and don't blame me if you delete all the files on your computer with this! That would be a neat safety to have in this I guess. homework? Likely need to know a bunch about finding system directories etc. Try looking in the help file os. os.getenv("HOME") maybe? something like that....

read more...

Sunday, March 7, 2010

Reboot

OK, so I started this blog to post drawings up and and write stories about them. I may still do that, but I need to post about other things too, or I will drop off and ignore it again. My interests vary a lot, so I'll try and tag things so they are cohesive. But in the end, this may only end up making sense to me. My bullet-point initial mission statement after the break.
* Link to one cool free browser game every week (maybe twice if possible)
* Post one scanned drawing every week, or if need be, an old drawing from flicker but with text.
* Some note in regards to my jogging status.
* A review/ breakdown of a simple chunk of python code, intermittently, but hopefully quite often as long as I'm doing such tasks at work.
read more...

Get python

So the first thing you'll need to follow this is Python.
http://www.python.org/download/
Why? because it's powerful, popular and easy to use.

What am i doing here? Well, trying to get more active on the web in my varied interests. One thing that comes up now and then is technical art, and involved in that is taking control of your computer. usually this can involve moving files around, or doing some relatively simple tasks that a programmer wouldn't lower themselves to doing. Enter you and python.
All the posts will be tagged with tech art.

--------- #Setup
I use eclipse with pydev installed, but it lets you see the results in a view window and lets you run scripts directly there, so I like it.
You cold use Notepad++ for speed and editing highlighting, then run that in Maya or something, but that's a bit of a pain.

http://notepad-plus.sourceforge.net/uk/site.htm
http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.5.2-201002111343/eclipse-SDK-3.5.2-win32.zip

Once you install eclipse, run it, and setup a folder for where to work (workspace)
You need to add pydev for running python by going to 'help/Install New Software,
then click add, name it python or pydev or something then paste in the url:
http://pydev.org/updates which should then install that all nicely.
When you start a new 'project' then you need to select pydev, you'll need to point it to where you installed python, then you can just make a new blank 'module' which you don't really need one of the special templates for. Main could work too, but gets a bit more intimidating.
--------- #End Setup

There. Now if you're setup, you can run

print("hey there world!")

and that should work as your first little script.
Stinks don't it? but for some reason programmers like 'hello world' as a first most simple test to make sure the darn thing works.
That's all for now.
I didn't think to write this up, but if you find problems, let me know. I didn't think to start to write this until well after I've set this up.
read more...