about summary refs log tree commit diff
path: root/makeblend/stars.py
diff options
context:
space:
mode:
authorhanemile <hanemile@protonmail.com>2018-12-24 22:54:04 +0100
committerhanemile <hanemile@protonmail.com>2018-12-24 22:54:04 +0100
commit8ca97c4e416d3bf32ab9caf54d738d699fc47eb1 (patch)
treec78530b551c8f355583fbbba1068e1041363857a /makeblend/stars.py
parent501adaa4dc7f5542dfc93b7c61cbd57c3fbc0c8f (diff)
cron commit
Diffstat (limited to 'makeblend/stars.py')
-rwxr-xr-xmakeblend/stars.py58
1 files changed, 58 insertions, 0 deletions
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)
+"""