Friday, January 30, 2015

Material IO: Update 5

Big breakthrough, groups are now completely working, up to the maximum allowed levels. Node links and everything is being transferred, leaving only some testing for bugs before I release it. A couple things that I need to check for our what happens to images, do I want to allow them to be copied to a folder and then imported with the material? Something to think about.

Thursday, January 29, 2015

Material IO: Update 4

Some more advancements today for the Material IO addon. Basic groups are now supported, links and all. I am currently working out several bugs and then will continue farther in to get to the max that I am going to code for, which will be 5 nested groups, or a group in a group in a group in a group in a group. Anything beyond that I believe is unpractical and never really used, but it can be made bigger rather easily.

Tuesday, January 27, 2015

Material IO: Update 3

Some pretty major additions have been added in the last day, node links are now supported. So as long as there are no groups in the node_tree than everything works fine and you get the same material as you exported. The one exception being anything that has to be loaded or setup.

By this I mean, if you have an image loaded into the one .blend it won't be linked up in the other one. I might add support for packing files into a local folder, so images can be transferred with the .bmat file, but that is still to come. Also, things like UV maps and vertex groups will have to have the same name in the new location, otherwise they won't link up.

Groups are still not supported, although I have begun working on them, hopefully within the next few days I will be able to post an alpha version up here with at least most of the features working.

Monday, January 26, 2015

Evaluating Strings

As I have been working on my Material IO addon I realized that I would have to convert strings to back to their original, built-in types. I thought I was going to manually have to code this, but I came across this built-in function ast.literal_eval(string) which does it all for you.

You can give it a string like "[1, (4, 5, 6), 2, (0.5, 0.4, 0.5)]" and it will convert all of it to an actual list that can be indexed.


import ast
a = "[1, 2, (3, 4, 5)]"
b = ast.literal_eval(a)


<class 'str'>
<class 'list'>

Saturday, January 24, 2015

Material IO: Update 2

The addon has progressed a good bit today, importing of all nodes is now supported although groups are not yet. All data is being transferred between nodes, including .inputs, .outputs, and node specific ones like .operation, or .blend_type

Material IO: Update 1

Material IO has been coming along well. Basic importing is now supported and all Cycles nodes can be exported and imported although their attributes and links have not been set up yet.

I encountered several problems along the way:

  1. Some issues with the XML, I am new to XML so I didn't realize that you can't have spaces in attribute names and can't have certain symbols like < or > outside of a string. For some reason the <> where coming from the node.location part because they were vectors. So I had to convert all of them to tuples. The names just have to be changed from Material Name to Material_Name
  2. I was collecting node.type for each node and was then having to change that type into a string that could be used to create the node which gave several challenges because it could be done in several ways. I figured out though, that you can just get the node.bl_idname. Which allows you to use that string directly to create the new node on importation. 

Friday, January 23, 2015

Material IO

I have noticed in Blender how it is so hard to send materials from place to place. You can always send the whole .blend and then use append, but there are not really any import/export addons to help with this. So that is why I am writing Material IO, it will allow you to import and export node configurations from both Blender Internal and Cycles once completed.

How it works:

  1. It collects the data from all the nodes and stores that data in a combination of lists and dictionaries
  2. It also will work with groups within groups (up to 5 levels)
  3. It then writes out to a .bmat file (Blender material) in XML, which allows for easier importing

Issues so far:

  1. Two nodes information can't be exported, these are the RGB Curves and XYZ Vector Curves. This is because they have a lot of data that is read-only meaning it can't be set once the data is read from the file.
Release time frame:
Hopefully this will be out within the next month. There are a lot of nodes to catalog and get straight. So far only most of the Cycles nodes are ready, and the importing part hasn't even been started on, but I will update here as I go.

Friday, January 9, 2015

User Selecting Objects

So you may be wondering how to give a list of objects for a user to select from in your script. One of the ways of doing this is, if you have added a property to bpy.types.Object you can use layout.prop_search(data, property, search_data, search_property). The four arguments are the data in which the property is, the property to be searched for (also takes the name of the selected choice), the data to search in, and the property in the search_data to look for.

For example:

  1. bpy.types.Object.obj = StringProperty(name = "", default = "")
  2. ###inside of panel/operator###
  3. self.layout.prop_search(context.object, "obj", context.scene, "objects")

So this looks at the active object's property "obj" and then looks in context.scene.objects for that property. Once the user selects an object you can find its name by looking at "obj".

Wednesday, January 7, 2015

Curve Conversion 0.5 Is Out!

Curve Conversion 0.5 is out with minor changes that allow all connected mesh objects to be updated from the curve object just by click "Propagate Changes". You can download from the "Released Scripts & Themes" page.

Tuesday, January 6, 2015

Check Out The Photos/Examples Page!

Check out the Photos/Examples page, there are photos of models created by my scripts and several of my own project renders.

Example Of Curve Conversion!

The top one is the mesh object and the bottom one is the curve. This means that you can modeling something with a curve and then convert it over, but still maintaining the original and being able to quickly make changes to the curve and see those updates on the mesh.

Curve Conversion Updated!

Version 0.4 of Curve Conversion is up! This update is just bug fixes. Moving the mesh object would not work in some situations. This has all been fixed up.

Monday, January 5, 2015

Have You Checked Out Curve Conversion?

Curve Converter
Current Version: 0.3

How To Use:
  • Install addon
  • Add curve, set "Fill" to "Full", then adjust bevel depth and resolution till satisfied
  • Option 1: Add mesh object, go to panel (View 3D > Tools > Tools > Curve Conversion) and select curve object and then click "Convert/Update Mesh"
  • Option 2: Go to panel (View 3D > Tools > Tools > Curve Conversion) and click "Add Mesh Object"
  • Then just click update once you update the curve
  • "Respect Scale" copies the scale from the curve to the mesh object
  • If you have multiple curves selected then "Add Mesh Object" takes all those curves and makes them one object while "Add Multiple Objects" creates a separate object for each of them.

Welcome to Blending Jacob!

On this website I will be posting my ramblings in coding in Python as well as any other languages that I pick up as I go. I will post all my released scripts here as well as bits of code that I think will be useful. So have fun browsing!