mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-06 03:37:32 +08:00
Add C++ string of glTF Schema.
This commit is contained in:
parent
cf8b7cc0a4
commit
2673d1d3ef
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
from ref_resolver import RefResolver
|
from ref_resolver import RefResolver
|
||||||
|
import base64
|
||||||
|
|
||||||
f = open("glTF.schema.json")
|
f = open("glTF.schema.json")
|
||||||
j = json.loads(f.read())
|
j = json.loads(f.read())
|
||||||
@ -7,5 +8,7 @@ j = json.loads(f.read())
|
|||||||
# call to API resolve method
|
# call to API resolve method
|
||||||
RefResolver("glTF.schema.json").resolve(j)
|
RefResolver("glTF.schema.json").resolve(j)
|
||||||
|
|
||||||
outfile = open("glTF.schema.resolved.json")
|
j_str = json.dumps(j, indent=2)
|
||||||
outfile.write(json.dumps(j, indent=2))
|
|
||||||
|
# Run json.dumps twice to get escaped string
|
||||||
|
print("const char *kglTFSchemaString = " + json.dumps(j_str) + ";\n")
|
||||||
|
2
tools/schema_ref_resolver/glTF.schema.resolved.inc
Normal file
2
tools/schema_ref_resolver/glTF.schema.resolved.inc
Normal file
File diff suppressed because one or more lines are too long
@ -31,8 +31,6 @@ class RefResolver:
|
|||||||
if key == "$ref":
|
if key == "$ref":
|
||||||
ref_frag = urlparse(value)
|
ref_frag = urlparse(value)
|
||||||
ref_file = ref_frag.netloc + ref_frag.path
|
ref_file = ref_frag.netloc + ref_frag.path
|
||||||
print(ref_file)
|
|
||||||
print(self.url_fragments.scheme)
|
|
||||||
json_dump = {}
|
json_dump = {}
|
||||||
if ref_file in cache:
|
if ref_file in cache:
|
||||||
json_dump = cache[ref_file]
|
json_dump = cache[ref_file]
|
||||||
@ -52,7 +50,6 @@ class RefResolver:
|
|||||||
#elif self.url_fragments.scheme == 'file':
|
#elif self.url_fragments.scheme == 'file':
|
||||||
else:
|
else:
|
||||||
if isfile(ref_file):
|
if isfile(ref_file):
|
||||||
print(ref_file)
|
|
||||||
# if the ref is another file -> go there and get it
|
# if the ref is another file -> go there and get it
|
||||||
json_dump = json.load(open(ref_file))
|
json_dump = json.load(open(ref_file))
|
||||||
ref_id = None
|
ref_id = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user