| @@ -24,18 +24,13 @@ def get_bounds(objects): | |||||
| ) | ) | ||||
| GROUP_NAME = "Billboards" | |||||
| GROUP_KIND = "buildings" | |||||
| path_info = pathlib.Path(bpy.data.filepath).parent.joinpath("macrovision-directory.txt") | path_info = pathlib.Path(bpy.data.filepath).parent.joinpath("macrovision-directory.txt") | ||||
| config_path = pathlib.Path(open(path_info).read()) | |||||
| config_path = pathlib.Path(open(path_info).read().strip()) | |||||
| json_path = config_path.joinpath("config.json") | json_path = config_path.joinpath("config.json") | ||||
| config = json.load(open(json_path.resolve(), encoding="utf-8")) | config = json.load(open(json_path.resolve(), encoding="utf-8")) | ||||
| parent_workdir = config["work-directory"] | parent_workdir = config["work-directory"] | ||||
| workdir = pathlib.Path(parent_workdir).joinpath(GROUP_NAME) | |||||
| c = bpy.data.objects["cam"] | c = bpy.data.objects["cam"] | ||||
| c.data.type = "ORTHO" | c.data.type = "ORTHO" | ||||
| @@ -46,15 +41,16 @@ bpy.data.scenes["Scene"].view_settings.view_transform = "Raw" | |||||
| bpy.data.worlds["World"].node_tree.nodes["Background"].inputs[1].default_value = 0 | bpy.data.worlds["World"].node_tree.nodes["Background"].inputs[1].default_value = 0 | ||||
| collections = bpy.data.collections["Macrovision"].children | |||||
| mv = bpy.data.collections["Macrovision"] | |||||
| collections = mv.children | |||||
| all_data = {} | all_data = {} | ||||
| all_data["name"] = GROUP_NAME | |||||
| all_data["kind"] = GROUP_KIND | |||||
| all_data["name"] = mv["MVName"] | |||||
| all_data["kind"] = mv["MVKind"] | |||||
| all_data["forms"] = [] | all_data["forms"] = [] | ||||
| VOLUME = False | |||||
| workdir = pathlib.Path(parent_workdir).joinpath(all_data["name"]) | |||||
| os.makedirs(workdir, exist_ok=True) | os.makedirs(workdir, exist_ok=True) | ||||
| @@ -70,7 +66,6 @@ for coll in collections: | |||||
| coll.hide_render = True | coll.hide_render = True | ||||
| for coll in collections: | for coll in collections: | ||||
| coll.hide_render = False | coll.hide_render = False | ||||
| bpy.ops.object.select_all(action='DESELECT') | bpy.ops.object.select_all(action='DESELECT') | ||||
| @@ -112,7 +107,10 @@ for coll in collections: | |||||
| "name": angles[3], | "name": angles[3], | ||||
| "height": dimensions[angles[2]] | "height": dimensions[angles[2]] | ||||
| }) | }) | ||||
| #s.rotation_euler = c.rotation_euler | |||||
| if coll["Volume"]: | |||||
| data["views"][-1]["volume"] = coll["Volume"] | |||||
| filename = f"{coll.name}-{angles[3]}.png" | filename = f"{coll.name}-{angles[3]}.png" | ||||
| bpy.context.scene.render.filepath = workdir.joinpath(filename).resolve().__str__() | bpy.context.scene.render.filepath = workdir.joinpath(filename).resolve().__str__() | ||||
| bpy.ops.render.render(write_still = True) | bpy.ops.render.render(write_still = True) | ||||
| @@ -121,4 +119,4 @@ for coll in collections: | |||||
| coll.hide_render = True | coll.hide_render = True | ||||
| with open(workdir.joinpath("data.json"), "w") as file: | with open(workdir.joinpath("data.json"), "w") as file: | ||||
| json.dump(all_data, file) | |||||
| json.dump(all_data, file) | |||||