From 8ca97c4e416d3bf32ab9caf54d738d699fc47eb1 Mon Sep 17 00:00:00 2001 From: hanemile Date: Mon, 24 Dec 2018 22:54:04 +0100 Subject: cron commit --- makeblend/stars.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 makeblend/stars.py (limited to 'makeblend/stars.py') diff --git a/makeblend/stars.py b/makeblend/stars.py new file mode 100755 index 0000000..4f6eba0 --- /dev/null +++ b/makeblend/stars.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +import sys +import json +#import bpy + +def addStar(data): + + if None in data["Quadrants"]: + x = data["Boundary"]["Center"]["X"] + y = data["boundary"]["Center"]["Y"] + w = data["boundary"]["Width"] + + bpy.ops.mesh.primitive_plane_add(size=w, view_align=False, enter_editmode=False, location=(x, y, 0)) + + for subtree in data["Quadrants"]: + if subtree != None: + addPlane(subtree) + +def getVerts(data): + + x = data["star"]["C"]["X"] + y = data["star"]["C"]["Y"] + + if x != 0 and y != 0: + localVerts = [] + star = [x, y] + localVerts.append(star) + + for subtree in data["Quadrants"]: + if subtree != None: + localVerts.append(getVerts(subtree)) + + if localVerts != None: + return localVerts + +with open("real.json") as f: + data = json.load(f) + + #addPlane(data[0]["Quadrants"][0]) + + verts = [] + verts.append(getVerts(data[0])) + print(verts) + +""" + # Create a mesh and an object + mesh = bpy.data.meshes.new("0") + object = bpy.data.objects.new("0",mesh) + + # Set the mesh location + object.location = bpy.context.scene.cursor_location + bpy.context.scene.objects.linl(object) + + # Create the mesh from the given data points + mesh.from_pydata(verts,[],[]) + mesh.update(calc_edges=True) +""" -- cgit 1.4.1