An addon meant to work with Mineways and MCPrep that adds tools for creating and managing custom player heads in blender.
© David Bootle 2020
- If you've added a texture to your player head, but nothing happened, make sure you are switched to material view.
- If you've added a player head, and it immediately turns invisible, don't worry. They are invisible until you assign a skin to them.
This documentation will cover the basic function of each tool. A step by step guide on how to use the addon is located in this repository's wiki. Internal functions and custom properties may be covered at some point, but my priority at the moment is making sure that people can use the addon.
The addon tools are accessible from the right hand menu in the 3D View. Press N to toggle the menu. The tab is called MC Head Tools.
The player heads are two cubes, one slightly larger than the other. One cube is for the inner part of the head, and one is for the fringe. Both cubes are contained within a collection for easy organization. Do not rename anything generated by this addon. The addon looks for the numbers at the end of the currently selected object to determine which head you are selecting. That way, you can perform operations on a player head while only having the outer layer selected. This saves computing resources, as the addon can directly look up the objects/materials/textures it needs, rather than searching through all the objects in a scene. Especially in large renders, this can tank Blender's performance.
The first part of assigning a skin is different depending on which option you choose to assign it, but the basic premise is the same. With the Skin From Blockdata and Skin From Username options, the addon works to find the skin url, or where the skin is stored on Mojang's server. Once it's found it, it downloads the file into Blender's temp directory, then packs it into the blend file. The temp directory is cleared whenever Blender exits, so the files do not sit around on your computer.
That's pretty much it for the basic functionality of the addon. The rest of the tools are just quality of life things that make it much easier to place heads in a world. Read about the tools individually below if you want to know what they do.
mph.add_head_model
The New Player Head button places two cubes that represent your player head at the location of the cursor. They are placed inside a newly created collection titled "Player Head" with a number on the end. The cubes are named "Inner Skin" and "Outer Skin", both with the same number added to the end. Whatever you do, do not rename the cubes. This will break the addon. The addon uses the names of the cubes as well as the number to determine what materials should be assigned and what operations should be performed. The collection can be renamed, but this has not been tested, and may break something as well. The function also sets up the cubes' UV maps to work perfectly when a minecraft skin file is plugged in as the texture.
None of these buttons will be clickable unless you are selecting a player head generated by the New Player Head button.
mph.skin_from_blockdata
The Skin From Blockdata button is slightly complicated. It's by far the easiest method to use when importing heads into your scene, but it takes some explanation. In Minecraft, pressing F3+I while looking at a block will copy a /setblock command to your clipboard that can be used to paste that exact block. For player heads, this command holds information that can be used to get the texture, even if it's a custom head and doesn't belong to a user. Use this button by going into Minecraft, looking at any player head in your world, and pressing F3+I. Go back to blender, select the player head, and click Skin From Blockdata.
mph.skin_from_username
The Skin From Username button is quite simple. Just click it, and type in the username of the person who's head you want. If it raises an error that says Invalid username, then it couldn't find the username you entered on Mojang's database. Check and make sure that their username hasn't changed. Usernames are not case sensitive.
mph.skin_from_file
Press this button, and select a valid Minecraft skin file. The size should be 64x64 pixels, or a multiple of that. The normal Minecraft skin size is 64x64, but uploading a larger picture will just result in higher resolution faces, as long as the proportions are still the same. If you don't know what a minecraft skin file is, you probably shouldn't use this option. You can technically select any image, but unless it's a proper minecraft skin file, it won't display correctly, and may possibly raise errors.
mph.prime_cursor, mph.delete_faces
These are simply convenience functions. Prime Cursor is the same as the Move Cursor to Selected option in Blender, and Delete Faces is exactly that. These tools are only available in edit mode, and are meant to help with the removal of default heads from your scene, and the proper placement of the new head.
mph.rotate_0, mph.rotate_90, mph.rotate_180, mph.rotate_270, mph.rotate_plus_30, mph.rotate_minus_30, mph.rotate_plus_45, mph.rotate_minus_45
These functions are designed to help you place your head in the world properly. The 0°, 90°, 180°, and 270° buttons rotate the player head to the selected orientation. Minecraft also has player head rotation placements at 30°, 45°, and 60° in between each major rotation. The plus and minus 30 and 40° buttons are to help you get the right rotation. Rotating the heads manually is annoying, but doable. If you are going to do it manually, make sure both cubes are selected.
These buttons align the head within the block space. When importing a Mineways world, the blocks are by default exactly 1 unit in size within blender, and are positioned properly. This is the assumption the addon works under. If you move your world import, the blocks will no longer line up correctly. In the future I would like to add an input for the imported world object so that the addon can calculate the offsets if you do transform the world, but I haven't gotten around to that.
At the moment, the buttons are clickable enums stored under context.scene.mc_player_heads.floor_alignment. This enum is only for displaying on the panel. Each object generated by the addon has a floor_alignment property. By default, it's set to None. When clicked, they run mph.set_floor_alignment.
These buttons select the alignment on the horizantal plane. The options are None, Center, North, East, South, and West. Mouse over each button to see what side of the block it will put the head on in relation to blender. Each head has it's own variable to store what position it's in. Currently, this is not used for anything, but that will most likely change in a future update. That is why the None object exists. It let's the head's internal variable know that it's not supposed to be aligned.
mph.set_to_wall, mph.set_to_floor
The Set to Floor and Set to Wall buttons set the player head to the correct height within the block. Set to Floor places the head the height within the block it would be at if you had placed it on the floor in Minecraft, that is, resting against the floor. Set to Wall places the head the height within the block it would be at if you had placed on the wall in Minecraft, that is, halfway up the block.