The main purpose for creating a blender add-on was to test out a theory that I had. I wanted test painting specific vertices a specific grayscale value based on a directory of values for isolation in Unreal Engine. The idea was to reduce the amount of material slots down to 1 material slot. I noticed that all of the freely available vehicle models had sometimes 20+ material slots. When you add 40 vehicles in game, you now have theoretically 40*20 = 800 additional draws. Additionally, you now have to keep track of multiple materials and make sure that they are assigned. You could easily end up with a bunch of vehicles with missing materials.
After experimenting with some Python scripting, I realized that I could speed up a lot of processes by turning mundane tasks and operations into a single button press.
Here’s a list of some of the operators/functions:
- Add Vertices To New Group and Paint: Will add vertices to a new group and paint them specific value.
- Paint Vertex Color by Group: Will paint selected vertices a a color based on their vertex group.
- Clear All VP: Basic clear all vertex colors.
- Parse Materials to VG: Will parse materials based on their name and create a vertex group if name resembles/matches a corresponding item the dataset.
- Remove VG Groups: Will remove vertex groups only from the category choosen. (vehicle will only remove vehicle groups).
- Remove All VG: Basic remove all vertex groups.
- Remove All Materials / Add a Base: Will remove all materials and add a base material (Mi_CharacterMaster, MI_VehicleMaster, MI_BuildingMaster). These materials are the names of the corresponding materials in Unreal. When the asset is imported, the material will automatically apply.
- Add Custom Properties: Originally to add custom properties based on the vertex value (Currently re-evaluated usefulness for Unreal python operations).
- Remove All Custom Properties: Basic remove all custom properties.
- Create Armature: Options to create a basic armature for the specific type of asset.
- Dump Bone Data: Function to dump bone data.Inset
- Extrude Poke: Function to perform the inset extrude poke operation.
The image above shows a good overview of the plug in. My focus was to create tools for the main asset types that I typically work with in my projects. Currently there are sections for vehicles, characters, buildings, and a general purpose props. This was my first time creating a blender add-on so I will eventually refactor this into a scalable solution.
Each category has a list of options that are relative to that category. What’s shown in the image above for the building “add vertices to new group and paint” section is a list of typical pieces for a house. When you click on one of the options it will automatically add the vertices that are selected on the model > add them to a vertex group > then ultimately paint them a specific grayscale value. For example here is the data for a building.
# Building List Data
building_data = [
{"label": "Fascade", "groupname": "Fascade", "vertex_color": 0.10},
{"label": "Skirting", "groupname": "Skirting", "vertex_color": 0.11},
{"label": "Chimney", "groupname": "Chimney", "vertex_color": 0.20},
{"label": "ChimneyStack", "groupname": "ChimneyStack", "vertex_color": 0.21},
{"label": "InteriorWall", "groupname": "InteriorWall", "vertex_color": 0.32},
{"label": "InteriorColumn", "groupname": "InteriorColumn", "vertex_color": 0.33},
{"label": "InteriorColumnBase", "groupname": "InteriorColumnBase", "vertex_color": 0.34},
{"label": "CrownMolding", "groupname": "CrownMolding", "vertex_color": 0.35},
{"label": "TrimExterior", "groupname": "TrimExterior", "vertex_color": 0.91},
{"label": "WindowGlass", "groupname": "WindowGlass", "vertex_color": 0.90},
{"label": "WindowTrimExterior", "groupname": "WindowTrimExterior", "vertex_color": 0.91},
{"label": "WindowTrimInterior", "groupname": "WindowTrimInterior", "vertex_color": 0.92},
{"label": "Roof", "groupname": "Roof", "vertex_color": 0.13},
{"label": "Celing", "groupname": "Celing", "vertex_color": 0.31},
{"label": "Floor", "groupname": "Floor", "vertex_color": 0.32},
{"label": "Foundation", "groupname": "Foundation", "vertex_color": 0.14},
{"label": "Door", "groupname": "Door", "vertex_color": 0.50},
{"label": "DoorKnob", "groupname": "DoorKnob", "vertex_color": 0.51},
]