diff --git a/.version b/.version new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c493838 --- /dev/null +++ b/README.md @@ -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. diff --git a/build/.version b/build/.version new file mode 100644 index 0000000..11e28da --- /dev/null +++ b/build/.version @@ -0,0 +1 @@ +1.0.0+build.1 \ No newline at end of file diff --git a/build/build.py b/build/build.py new file mode 100644 index 0000000..b45d42e --- /dev/null +++ b/build/build.py @@ -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) diff --git a/build/bump_major_version.py b/build/bump_major_version.py new file mode 100644 index 0000000..52bd8fa --- /dev/null +++ b/build/bump_major_version.py @@ -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) diff --git a/build/bump_minor.py b/build/bump_minor.py new file mode 100644 index 0000000..95053ae --- /dev/null +++ b/build/bump_minor.py @@ -0,0 +1,8 @@ +import versioning + +if __name__ == "__main__": + + currentVersion = versioning.get_version() + nextVersion = currentVersion.bump_minor() + versioning.save_version(nextVersion) + diff --git a/build/versioning.py b/build/versioning.py new file mode 100644 index 0000000..1a79540 --- /dev/null +++ b/build/versioning.py @@ -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__()) diff --git a/docu/images/panel.png b/docu/images/panel.png new file mode 100644 index 0000000..c63bf0a Binary files /dev/null and b/docu/images/panel.png differ diff --git a/__init__.py b/src/__init__.py similarity index 97% rename from __init__.py rename to src/__init__.py index a4e4c14..95de1cb 100644 --- a/__init__.py +++ b/src/__init__.py @@ -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), diff --git a/operators/bake_to_id_map.py b/src/operators/bake_to_id_map.py similarity index 99% rename from operators/bake_to_id_map.py rename to src/operators/bake_to_id_map.py index 0781aed..378a897 100644 --- a/operators/bake_to_id_map.py +++ b/src/operators/bake_to_id_map.py @@ -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): diff --git a/panels/panel.py b/src/panels/panel.py similarity index 100% rename from panels/panel.py rename to src/panels/panel.py diff --git a/panels/panel_advanced.py b/src/panels/panel_advanced.py similarity index 100% rename from panels/panel_advanced.py rename to src/panels/panel_advanced.py diff --git a/panels/panel_info.py b/src/panels/panel_info.py similarity index 100% rename from panels/panel_info.py rename to src/panels/panel_info.py diff --git a/panels/panel_options.py b/src/panels/panel_options.py similarity index 100% rename from panels/panel_options.py rename to src/panels/panel_options.py diff --git a/properties/bake_to_id.py b/src/properties/bake_to_id.py similarity index 100% rename from properties/bake_to_id.py rename to src/properties/bake_to_id.py