commit
1ad08af706
15 changed files with 93 additions and 2 deletions
1
.version
Normal file
1
.version
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
1.0.0
|
||||||
27
README.md
Normal file
27
README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Blender - Bake ID Mask Plugin
|
||||||
|
|
||||||
|
A plugin to quickly bake ID masks for meshes from/to different sources and targets.
|
||||||
|
|
||||||
|
### Currently supported:
|
||||||
|
Sources:
|
||||||
|
- Material Index
|
||||||
|
|
||||||
|
Targets:
|
||||||
|
- Vertex Color
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
1. Download the newest file from the releases tab.
|
||||||
|
2. Go to your blender preferences
|
||||||
|
3. In Add-Ons, click on the "Install..." button and navigate to the downloaded file.
|
||||||
|
4. After selecting it, just enable it and done.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
You find the tool in the panel on the right of the "3D Viewport" under "Tool".
|
||||||
|

|
||||||
|
|
||||||
|
How to use properly it, highly depends on the selected source.
|
||||||
|
|
||||||
|
### Usage - Material Index Source
|
||||||
|
Here the IDs are given based on the object and its material indices.
|
||||||
|
|
||||||
|
Lets say, you have 10 objects and each has 2 materials attached to it. Then the amount of IDs given is 20, since each object contains the two material indecies.
|
||||||
1
build/.version
Normal file
1
build/.version
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
1.0.0+build.1
|
||||||
23
build/build.py
Normal file
23
build/build.py
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
import versioning
|
||||||
|
|
||||||
|
ZIP_FILE_NAME = "blender_bake-id-mask_{version}"
|
||||||
|
|
||||||
|
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
SOURCE_PATH = os.path.join(CURRENT_PATH, "../src")
|
||||||
|
TARGET_PATH = os.path.join(CURRENT_PATH, '../dist')
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
if not os.path.isdir(TARGET_PATH):
|
||||||
|
os.mkdir(TARGET_PATH)
|
||||||
|
|
||||||
|
currentVersion = versioning.get_version()
|
||||||
|
nextVersion = currentVersion.bump_build()
|
||||||
|
versioning.save_version(nextVersion)
|
||||||
|
|
||||||
|
filename = os.path.join(TARGET_PATH, ZIP_FILE_NAME.format(version=nextVersion.__str__()))
|
||||||
|
shutil.make_archive(filename, 'zip', SOURCE_PATH)
|
||||||
12
build/bump_major_version.py
Normal file
12
build/bump_major_version.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
import versioning
|
||||||
|
|
||||||
|
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
CURRENT_VER_FILE = os.path.join(CURRENT_PATH, ".version")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
currentVersion = versioning.get_version()
|
||||||
|
nextVersion = currentVersion.bump_major()
|
||||||
|
versioning.save_version(nextVersion)
|
||||||
8
build/bump_minor.py
Normal file
8
build/bump_minor.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import versioning
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
currentVersion = versioning.get_version()
|
||||||
|
nextVersion = currentVersion.bump_minor()
|
||||||
|
versioning.save_version(nextVersion)
|
||||||
|
|
||||||
19
build/versioning.py
Normal file
19
build/versioning.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
import semver
|
||||||
|
|
||||||
|
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
CURRENT_VER_FILE = os.path.join(CURRENT_PATH, ".version")
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
if not os.path.isfile(CURRENT_VER_FILE):
|
||||||
|
return semver.Version.parse('1.0.0')
|
||||||
|
with open(CURRENT_VER_FILE) as f:
|
||||||
|
content = f.read()
|
||||||
|
return semver.Version.parse(content)
|
||||||
|
|
||||||
|
|
||||||
|
def save_version(version: semver.Version):
|
||||||
|
with open(CURRENT_VER_FILE, 'w') as f:
|
||||||
|
f.write(version.__str__())
|
||||||
BIN
docu/images/panel.png
Normal file
BIN
docu/images/panel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 553 KiB |
|
|
@ -8,7 +8,7 @@ from . panels.panel_info import BakeToIDInfoPanel
|
||||||
from . properties.bake_to_id import BakeToIDProperties
|
from . properties.bake_to_id import BakeToIDProperties
|
||||||
|
|
||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "Bake to ID Map",
|
"name": "Bake ID Mask",
|
||||||
"author": "iedSoftworks",
|
"author": "iedSoftworks",
|
||||||
"description": "",
|
"description": "",
|
||||||
"blender": (2, 80, 0),
|
"blender": (2, 80, 0),
|
||||||
|
|
@ -6,7 +6,7 @@ import bpy
|
||||||
|
|
||||||
class BakeToIDMapOperator(bpy.types.Operator):
|
class BakeToIDMapOperator(bpy.types.Operator):
|
||||||
bl_idname = "object.bake_to_id_map"
|
bl_idname = "object.bake_to_id_map"
|
||||||
bl_label = "Bake to ID Map"
|
bl_label = "Bake ID Mask"
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue