diff --git a/src/product_gen/__pycache__/generate_product.cpython-35.pyc b/src/product_gen/__pycache__/generate_product.cpython-35.pyc index 5ba0aa7..7b27557 100644 Binary files a/src/product_gen/__pycache__/generate_product.cpython-35.pyc and b/src/product_gen/__pycache__/generate_product.cpython-35.pyc differ diff --git a/src/product_gen/generate_product.py b/src/product_gen/generate_product.py index d902c3c..0dcf632 100644 --- a/src/product_gen/generate_product.py +++ b/src/product_gen/generate_product.py @@ -1,4 +1,5 @@ import os +import random import bpy import product_gen.generate_lamp import rendering.setup_scene @@ -7,7 +8,7 @@ import rendering.setup_renderer def generate(shape, height, radius, - color, + color, output_prefix, is_final=False): @@ -49,4 +50,6 @@ def generate(shape, bpy.context.scene.render.filepath = prefix + ".png" bpy.ops.render.render(write_still=True) - bpy.ops.wm.save_as_mainfile(filepath=prefix + ".blend") \ No newline at end of file + bpy.ops.wm.save_as_mainfile(filepath=prefix + ".blend") + + return height, radius, color \ No newline at end of file diff --git a/src/rendering/__pycache__/setup_renderer.cpython-35.pyc b/src/rendering/__pycache__/setup_renderer.cpython-35.pyc index 7c65f54..ddd08ef 100644 Binary files a/src/rendering/__pycache__/setup_renderer.cpython-35.pyc and b/src/rendering/__pycache__/setup_renderer.cpython-35.pyc differ diff --git a/src/rendering/setup_renderer.py b/src/rendering/setup_renderer.py index 9ecc425..cc3e323 100644 --- a/src/rendering/setup_renderer.py +++ b/src/rendering/setup_renderer.py @@ -19,4 +19,4 @@ def setup_renderer(engine="CYCLES"): bpy.context.scene.render.resolution_y = 600.0 bpy.context.scene.render.tile_x = 32 bpy.context.scene.render.tile_y = 32 - bpy.context.scene.render.resolution_percentage = 100.0 \ No newline at end of file + bpy.context.scene.render.resolution_percentage = 50.0 \ No newline at end of file diff --git a/src/utility/apply_texture.py b/src/utility/apply_texture.py index 81fad0c..154526e 100644 --- a/src/utility/apply_texture.py +++ b/src/utility/apply_texture.py @@ -13,6 +13,7 @@ if __name__ == "__main__": shape_params = json.loads(argv[0]) shape = shape_params['shape'] output = shape_params['output'] + print(output) if not os.path.exists(os.getcwd() + "/" + output): os.makedirs(os.getcwd() + "/" + output) diff --git a/src/utility/generate_shape.py b/src/utility/generate_shape.py index eb8f5a0..69b3d4a 100644 --- a/src/utility/generate_shape.py +++ b/src/utility/generate_shape.py @@ -1,3 +1,7 @@ +""" +First pass shape generation. +""" + import os import sys import random @@ -10,17 +14,30 @@ if __name__ == "__main__": argv = sys.argv argv = argv[argv.index("--") + 1:] shape_params = json.loads(argv[0]) + shape = shape_params['shape'] output = shape_params['output'] if not os.path.exists(os.getcwd() + "/" + output): os.makedirs(os.getcwd() + "/" + output) + # Global bounding box + bbox_xmax = 2.2 + bbox_ymax = 2.5 + + # Minimum feature sizes + feature_xmin = 0.4 + feature_ymin = 1.0 + height = 1.0 + random.random()*1.5 radius = 0.2 + random.random()*1.0 color = [0.1, 0.1, 0.1] - product_gen.generate_product.generate(shape, height, radius, color, output) + height, radius, color = product_gen.generate_product.generate(shape, + height, + radius, + color, + output) shape_parameters = {"shape": shape, "height": height, diff --git a/src/utility/test456/test456.blend b/src/utility/test456/test456.blend index 725a8e6..31b738e 100644 Binary files a/src/utility/test456/test456.blend and b/src/utility/test456/test456.blend differ diff --git a/src/utility/test456/test456.blend1 b/src/utility/test456/test456.blend1 index 429ed1f..958a144 100644 Binary files a/src/utility/test456/test456.blend1 and b/src/utility/test456/test456.blend1 differ diff --git a/src/utility/test456/test456.json b/src/utility/test456/test456.json index 482972a..482cfd6 100644 --- a/src/utility/test456/test456.json +++ b/src/utility/test456/test456.json @@ -1 +1 @@ -{"height": 2.23382656395708, "color": [0.1, 0.1, 0.1], "radius": 1.1783351658626844, "shape": "cone"} \ No newline at end of file +{"color": [0.1, 0.1, 0.1], "shape": "cone", "radius": 1.0698675312816335, "height": 2.122232726076932} \ No newline at end of file diff --git a/src/utility/test456/test456.png b/src/utility/test456/test456.png index f3ede27..ac89ff9 100644 Binary files a/src/utility/test456/test456.png and b/src/utility/test456/test456.png differ diff --git a/test/test_generate_lamp.py b/test/test_generate_lamp.py index 6e98f9e..06861f9 100644 --- a/test/test_generate_lamp.py +++ b/test/test_generate_lamp.py @@ -7,7 +7,7 @@ from argparse import ArgumentParser if __name__ == "__main__": - shape = "bio" + shape = "pendant" output = "test" if not os.path.exists(os.getcwd() + "/" + output):