mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-12 15:48:58 +08:00
Add feature to repace mesh.primitive.indices accessor.
This commit is contained in:
parent
289cc448ed
commit
5dcf778b31
@ -5,6 +5,7 @@
|
|||||||
import json
|
import json
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
|
replace_indices = False
|
||||||
attrib_names = ["TEXCOORD_0"]
|
attrib_names = ["TEXCOORD_0"]
|
||||||
|
|
||||||
def check_accessor(src, target):
|
def check_accessor(src, target):
|
||||||
@ -70,9 +71,18 @@ def main():
|
|||||||
source_mesh = gltf["meshes"][source_mesh_id]
|
source_mesh = gltf["meshes"][source_mesh_id]
|
||||||
target_mesh = gltf["meshes"][target_mesh_id]
|
target_mesh = gltf["meshes"][target_mesh_id]
|
||||||
|
|
||||||
|
|
||||||
source_prim = source_mesh["primitives"][source_primid]
|
source_prim = source_mesh["primitives"][source_primid]
|
||||||
target_prim = target_mesh["primitives"][target_primid]
|
target_prim = target_mesh["primitives"][target_primid]
|
||||||
|
|
||||||
|
if replace_indices:
|
||||||
|
target_indices_id = target_prim["indices"]
|
||||||
|
src_indices_id = source_prim["indices"]
|
||||||
|
|
||||||
|
print("Replace vertex indices from {} to {}".format(target_indices_id, src_indices_id))
|
||||||
|
gltf["meshes"][target_mesh_id]["primitives"][target_primid]["indices"] = gltf["meshes"][source_mesh_id]["primitives"][source_primid]["indices"]
|
||||||
|
|
||||||
|
|
||||||
for attrib in target_prim["attributes"]:
|
for attrib in target_prim["attributes"]:
|
||||||
print("attrib ", attrib)
|
print("attrib ", attrib)
|
||||||
if attrib in attrib_names:
|
if attrib in attrib_names:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user