Merge pull request #1 from Neintonine/develop

Develop
This commit is contained in:
Michel Fedde 2024-01-29 21:58:20 +01:00 committed by GitHub
commit 1ad08af706
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 93 additions and 2 deletions

1
.version Normal file
View file

@ -0,0 +1 @@
1.0.0

27
README.md Normal file
View 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".
![Panel Location](docu/images/panel.png)
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
View file

@ -0,0 +1 @@
1.0.0+build.1

23
build/build.py Normal file
View 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)

View 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
View 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
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

View file

@ -8,7 +8,7 @@ from . panels.panel_info import BakeToIDInfoPanel
from . properties.bake_to_id import BakeToIDProperties
bl_info = {
"name": "Bake to ID Map",
"name": "Bake ID Mask",
"author": "iedSoftworks",
"description": "",
"blender": (2, 80, 0),

View file

@ -6,7 +6,7 @@ import bpy
class BakeToIDMapOperator(bpy.types.Operator):
bl_idname = "object.bake_to_id_map"
bl_label = "Bake to ID Map"
bl_label = "Bake ID Mask"
def execute(self, context):