new
This commit is contained in:
8
gltf.cm
8
gltf.cm
@@ -64,7 +64,7 @@ function parse_data_uri(uri) {
|
||||
var parts = array(meta, ";")
|
||||
if (parts[0]) mime = parts[0]
|
||||
for (var i = 1; i < length(parts); i++) {
|
||||
if (parts[i]) == "base64") is_base64 = true
|
||||
if (parts[i] == "base64") is_base64 = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,8 +297,8 @@ function used_image_indices(asset) {
|
||||
arrfor(array(used_tex), function(k) {
|
||||
var ti = number(k)
|
||||
var t = textures[ti]
|
||||
if (!t) continue
|
||||
if (t.image == null) continue
|
||||
if (!t) return
|
||||
if (t.image == null) return
|
||||
used_imgs[t.image] = true
|
||||
})
|
||||
|
||||
@@ -427,7 +427,7 @@ gltf.pull_images = function(asset, opts) {
|
||||
function guess_mime(img) {
|
||||
if (img.mime) return img.mime
|
||||
if (img.uri) {
|
||||
var u = img.uri)
|
||||
var u = img.uri
|
||||
if (ends_with(u, ".png")) return "image/png"
|
||||
if (ends_with(u, ".jpg") || ends_with(u, ".jpeg")) return "image/jpeg"
|
||||
}
|
||||
|
||||
@@ -48,37 +48,6 @@ def print_array = function(arr, indent) {
|
||||
}
|
||||
}
|
||||
|
||||
def print_object = function(obj, indent) {
|
||||
if (!indent) indent = ""
|
||||
var keys = array(obj)
|
||||
for (var i = 0; i < length(keys); i++) {
|
||||
var key = keys[i]
|
||||
var val = obj[key]
|
||||
if (val == null) {
|
||||
log.console(`${indent}${key}: null`)
|
||||
} else if (val.constructor && val.constructor.name == 'Blob') {
|
||||
log.console(`${indent}${key}: <Blob ${length(val)} bytes>`)
|
||||
} else if (is_array(val)) {
|
||||
if (length(val) == 0) {
|
||||
log.console(`${indent}${key}: []`)
|
||||
} else if (length(val) <= 4 && !is_object(val[0])) {
|
||||
log.console(`${indent}${key}: [${text(val, ', ')}]`)
|
||||
} else if (!is_object(val[0])) {
|
||||
log.console(`${indent}${key}: [${text(array(val, 0, 4), ', ')}...] (${length(val)} items)`)
|
||||
} else {
|
||||
log.console(`${indent}${key}: (${length(val)} items)`)
|
||||
print_array(val, indent + " ")
|
||||
}
|
||||
} else {
|
||||
log.console(`${indent}${key}:`)
|
||||
print_object(val, indent + " ")
|
||||
}
|
||||
} else {
|
||||
log.console(`${indent}${key}: ${val}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.console(`\n=== Model Structure: ${filepath} ===\n`)
|
||||
|
||||
log.console(`Buffers: ${length(model.buffers)}`)
|
||||
|
||||
Reference in New Issue
Block a user