Launcher Tool Update

I’ve been working more on my project launcher tool and learning about parsing json and ini files. I’ve also started using classes in my scripts (about time!).

JSON and INI

In order to store information offline and allow max to access settings, I’ve had to read and write JSON and INI files in my script.

JSON is great to work with – works like a python dictionary in a text file.

INI can be frustrating, as the configparser module used to read it automatically sets all strings to lower case. Luckily I found a fix!

self.config = configparser.ConfigParser()
self.config.optionxform = str

Saving and Opening Files

I have a lot of opening and saving files in this tool, and one of the major issues was directing the user towards some more obscure files such as 3dsmax.exe and 3dsmax.ini. These are only set once, but can be a pain to find. os.getenv was very useful here, as it let me find both appdata and program files without any knowlege of the user’s paths.

os.getenv(‘LOCALAPPDATA’)

os.getenv(‘PROGRAMFILES’)

Qt and PySide

I’ve been using Qt Designer and PySide for my ui needs. This has been really useful, as its allowed me to create lovley looking interfaces without having to work out where everything should go in code. Its also forced me to use classes, as each ui is a super class, derived from itself and the QMainWindow class from PySide. Having each ui wrapped up in a class is really neat, plus having class scope variables is incredibly helpful when communicating between various dialog boxes.

RETERY54.PNG

 

Current Projects

Just a quick update on what I’m working on just now. I don’t have a whole lot to show, but got to keep up with the blogging!

I’m working on two projects, a scripting one and an art one.

Scripting Project – Art Tools Launcher

The aim of this project is to create a standalone python launcher for various art programs. Its very ambitious, but draws on a lot of concepts I’ve been wanting to look at for a while.

Right now, it has a very ugly UI where you can select a project configuration, and a 3DS Max launcher that writes to your max ini file to setup the project location.

tool2

tool1

I also found out what happens when you break max’s heidi drivers…the configparser module is not in my good books after converting the whole .ini file to lower case!

4

Art Project – 2001: A Space Odyssey Environment 

I’ve had a lot of scrapped art projects recently, mostly due to the fact that I’ve been focusing more on learning substance pipelines than just creating. I think I needed some time to just get the art flowing again, so decided to make some fanart. 2001 is one of my favorite movies, so it was a go to.

I’m working on this scene.

vlcsnap-11937

I’ve done a breakdown of the assets in the scene, but that’s about it so far!

breakdown

 

 

Installing a Python Module Through Pip (Windows)

Its been so long since I’ve put a post up on here! Between a busy period at work and a month of creative block I’ve had nothing to show.

I was exposed to more python recently, so decided to have a go at some more script work. There were a number of external modules I wanted to install on my home pc, but I was quite confused with their file types and installation. So, for anyone else that feels that way (and is a windows user)- here’s how I did it!

Python Module File Types

You’ll find python modules available to download in at least 3 file types:

  • .exe – the easiest installation method, just run the executable
  • .egg – a binary package that can be installed though python’s easy install command in a windows command line
  • .wheel –  a binary package that can be installed though python’s pip command in a windows command line

I’ll be using a .wheel package, but I imagine installing an .egg file will be a very similar process.

Install Pip

To check if you have pip, navigate to your python folder and check if there is a pip folder in site-packages. Your pip path will likely be something like this:

C:\Python27\Lib\site-packages\pip

If you don’t have pip, install it according to this guide. They can explain better than I could!

However, if you don’t have pip it may be worth upgrading to a python version after 2.6 as it comes prepackaged.

Install Your Module

For this tutorial, I’ll be installing pySide, a GUI module, but this works for any .wheel file. Pip is going to automatically download the file for us, and then install it.

We’re going to install the file via the command line. Navigate to your equivalent of:

C:\Python27\Scripts

You should see pip.exe in the folder. In the address bar, write cmd and press enter. This launches the command line from this path, so we don’t have to tell the command line where pip.exe is located.

1

3

In the command line, type:

pip install myModule

Replace myModule with the name of the module you wish to install. You do not need the .wheel filename.

Capture

That’s your module installed! You can check that it worked by going into a Python shell or IDE and typing:

import myModule

If there’s no errors, you’re good to go!