diff --git a/NeutrinoJSONTest.ipynb b/NeutrinoJSONTest.ipynb index 922edc5..b119107 100644 --- a/NeutrinoJSONTest.ipynb +++ b/NeutrinoJSONTest.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 89, + "execution_count": 28, "source": [ "import json\r\n", "\r\n", @@ -63,14 +63,14 @@ "def spawn_object(data, name, asset):\r\n", " object_data = {\r\n", " \"name\": (\"name\", name),\r\n", - " \"asset\": (\"asset\", asset),\r\n", + " \"asset\": \"\",\r\n", " \"trans\": (\"trans\", [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])\r\n", " }\r\n", "\r\n", " # get an asset key by the provided name\r\n", " for key, value in data[\"graph\"][\"assets\"].items():\r\n", - " if value[1][\"name\"] == asset:\r\n", - " object_data[\"asset\"] = (\"asset\", f\"*{key}\")\r\n", + " if value[1][\"name\"][1] == asset:\r\n", + " object_data[\"asset\"] = f\"*{key}\"\r\n", "\r\n", " # add the object to the scene\r\n", " data[\"graph\"][\"scene\"][add_key(data)] = (\"object\", object_data)" @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 29, "source": [ "# cache the scene\r\n", "def cache_scene(data):\r\n", @@ -99,12 +99,8 @@ " # hash all values\r\n", " for key, value in objects.items():\r\n", " for key, value in value[1].items():\r\n", - " # ignore pointers\r\n", - " if type(value) == str:\r\n", - " is_pointer = value[0] == \"*\"\r\n", - " else:\r\n", - " is_pointer = False\r\n", - " if not is_pointer:\r\n", + " # ignore pointers (the only non-tuple object)\r\n", + " if type(value) == tuple:\r\n", " # convert into string and hash that\r\n", " value_hash = hash(str(value))\r\n", "\r\n", @@ -131,12 +127,8 @@ " # replace all instances of cached values in the graph with corresponding cache pointers\r\n", " for object_key, object_value in objects.items():\r\n", " for value_key, value_value in object_value[1].items():\r\n", - " # ignore pointers\r\n", - " if type(value_value) == str:\r\n", - " is_pointer = value_value[0] == \"*\"\r\n", - " else:\r\n", - " is_pointer = False\r\n", - " if not is_pointer:\r\n", + " # ignore pointers (the only non-tuple object)\r\n", + " if type(value_value) == tuple:\r\n", " # convert into string and hash that\r\n", " value_hash = hash(str(value_value))\r\n", "\r\n", @@ -149,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 30, "source": [ "# just returns a random string\r\n", "import random\r\n", diff --git a/NeutrinoTestScene.json b/NeutrinoTestScene.json index 8c076e7..d884c1a 100644 --- a/NeutrinoTestScene.json +++ b/NeutrinoTestScene.json @@ -20,10 +20,10 @@ { "name": [ "name", - "8KF4IW7J" + "MN7SY1DZ" ], - "asset": "#0x9", - "trans": "#0xa" + "asset": "*0x1", + "trans": "#0x9" } ], "0x5": [ @@ -31,13 +31,10 @@ { "name": [ "name", - "6IIDHIMN" + "JIZTJG2T" ], - "asset": [ - "asset", - "L3T5A6RD" - ], - "trans": "#0xa" + "asset": "*0x3", + "trans": "#0x9" } ], "0x6": [ @@ -45,10 +42,10 @@ { "name": [ "name", - "S7FS45HQ" + "78LMETC7" ], - "asset": "#0x9", - "trans": "#0xa" + "asset": "*0x2", + "trans": "#0x9" } ], "0x7": [ @@ -56,10 +53,10 @@ { "name": [ "name", - "LVAWTY6W" + "4PEMWVMY" ], - "asset": "#0xb", - "trans": "#0xa" + "asset": "*0x3", + "trans": "#0x9" } ], "0x8": [ @@ -67,10 +64,10 @@ { "name": [ "name", - "OADE7KQG" + "N553FJRY" ], - "asset": "#0xb", - "trans": "#0xa" + "asset": "*0x1", + "trans": "#0x9" } ] }, @@ -80,9 +77,9 @@ { "name": [ "name", - "QT5Z6AA9" + "ONQSQMWX" ], - "file": "#0xc" + "file": "#0xa" } ], "0x2": [ @@ -90,9 +87,9 @@ { "name": [ "name", - "L3T5A6RD" + "GTIRGEOQ" ], - "file": "#0xc" + "file": "#0xa" } ], "0x3": [ @@ -100,19 +97,15 @@ { "name": [ "name", - "7OAGNOGS" + "DA6GXN8J" ], - "file": "#0xc" + "file": "#0xa" } ] } }, "cache": { "#0x9": [ - "asset", - "7OAGNOGS" - ], - "#0xa": [ "trans", [ [ @@ -132,11 +125,7 @@ ] ] ], - "#0xb": [ - "asset", - "QT5Z6AA9" - ], - "#0xc": [ + "#0xa": [ "path", "Assets/TestAsset.obj" ]