diff --git a/build/.version b/build/.version index f3189e3..155f135 100644 --- a/build/.version +++ b/build/.version @@ -1 +1 @@ -1.0.0+build.5 \ No newline at end of file +1.0.0+build.18 \ No newline at end of file diff --git a/build/build.py b/build/build.py index 2b54992..e5d6df2 100644 --- a/build/build.py +++ b/build/build.py @@ -10,6 +10,7 @@ PROJECT_NAME = "Bake ID Mask" CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) SOURCE_PATH = os.path.join(CURRENT_PATH, "../src") +INIT_FILE_PATH = os.path.join(SOURCE_PATH, "__init__.py") TARGET_PATH = os.path.join(CURRENT_PATH, '../dist') if __name__ == "__main__": @@ -22,6 +23,14 @@ if __name__ == "__main__": versioning.save_version(nextVersion) filename = os.path.join(TARGET_PATH, ZIP_FILE_NAME.format(version=nextVersion.__str__())) + original_init_content = '' + with open(INIT_FILE_PATH, 'r') as f: + original_init_content = f.read() + + version_insert = original_init_content.replace('# !VERSION', '"version": ({}, {}, {}),'.format(nextVersion.major, nextVersion.minor, nextVersion.patch)) + with open(INIT_FILE_PATH, 'w') as f: + f.write(version_insert) + with zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED) as zip: for (root, dirs, files) in os.walk(SOURCE_PATH): if '__pycache__' in dirs: @@ -37,4 +46,7 @@ if __name__ == "__main__": zip.write( os.path.join(root, file), os.path.join(PROJECT_NAME, relativePath) - ) \ No newline at end of file + ) + + with open(INIT_FILE_PATH, 'w') as f: + f.write(original_init_content) diff --git a/src/__init__.py b/src/__init__.py index 95de1cb..1319577 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,3 +1,12 @@ +bl_info = { + "name": "Bake ID Mask", + "author": "iedSoftworks", + "description": "", + # !VERSION + "blender": (2, 80, 0), + "category": "Object" +} + import bpy from . panels.panel_options import BakeToIDOptionsPanel @@ -7,14 +16,6 @@ from . panels.panel import BakeToIDMapPanel from . panels.panel_info import BakeToIDInfoPanel from . properties.bake_to_id import BakeToIDProperties -bl_info = { - "name": "Bake ID Mask", - "author": "iedSoftworks", - "description": "", - "blender": (2, 80, 0), - "category": "Object" -} - classes = ( BakeToIDMapOperator, BakeToIDMapPanel, @@ -24,13 +25,14 @@ classes = ( BakeToIDProperties, ) -def register(): +def register(): for cls in classes: bpy.utils.register_class(cls) setattr(bpy.types.Scene, 'bake_to_id_props', bpy.props.PointerProperty(type=BakeToIDProperties)) + def unregister(): for cls in reversed(classes): bpy.utils.unregister_class(cls)