Jump to content
  • entries
    6
  • comments
    24
  • views
    2,187

My first blender python script for Skyrim that saves so much time


kosukosu1

631 views

When I convert meshes for Skyrim from another source (oblivion, another game, etc), or when editing clothes for a custom body, I use blender. A lot of the blender functionality is still unknown for me - my focus on bringing pervy clothes and environments help me learn it pretty much :)

 

One of the things i find myself doing a lot is:

  • deleting the materials of a mesh
  • creating a new material
  • creating a new texture
  • setting the texture mode to UV
  • assign an image to the texture
  • saving the uvmap (this step is required or else the uvmaps don't appear in the exported nif and then you can't texture it)

The thing is, it doesn't matter what image or material gets assigned to the mesh because it gets thrown away and replaced with a BSLightingShaderProperty that's specific to Skyrim.

 

Doing the above process becomes a chore when there are a lot of meshes to deal with, say in an environment.

 

So I know there's python scripts in blender, and having done not that much of python, i was able to write up a script that does the above steps for the selected meshes in blender all automatically:

kosu_skyrim_prepare.7z

 

You can put the script in the Bin\Blender\.blender\scripts directory, and you should see a menu item in the Object menu in the 3d window:

blogentry-17069-0-46679800-1410113520_thumb.png

 

To use:

  • select the meshes you want to prepare for skyrim (usually you'd select all meshes)
  • go to Object -> Scripts -> Prepare for Skyrim
  • a UV export menu will pop up - hit ok
  • You'll see a small option to flip normals - do that if you want to flip all the normals of the selected meshes
  • Hit OK and if you look at the python console, you'll see it processing and it'll say Done! when it's Done (in the console)

It was really all about figuring out the blender python api, and i knew python was pretty anal about spacing so it wasn't too bad :)

 

Blender has a python interactive console, which makes it nice to play around and test little snippets of code right then and there - very cool!

 

So now with 1-click, i can do something that would take me 10+ minutes of boring mouse-pointing and clicking in seconds - go programming! :D

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use