Hi
The basic info that is needed to code this is:
db = mgGetCurrentDb() subfaces = [] def collectSubfaces (db, parent, rec, data): global subfaces if mgGetCode(rec) == fltPolygon: subf = mgGetNestedChild(rec) if subf != None: subfaces.append(subf) return MG_TRUE mgWalk(db, collectSubfaces, None, None, 0) for subface in subfaces: parentface = mgGetNestedParent(subface) targetparent = mgGetParent(parentface) mgDetach(subface) mgAttach(targetparent, subface)
Chris,
Thank you very much! I will check it out!
Shawn
Chris,
Here's where I landed, it seems to do the job. Thanks again!
db = mgGetCurrentDb() parent_faces = [] def collectParentFaces(db, parent, rec, data): global parent_faces if mgGetCode(rec) == fltPolygon and mgGetNestedChild(rec) is not None: parent_faces.append(rec) return MG_TRUE mgWalk(db, collectParentFaces, None, None, 0) for parent_face in parent_faces: subface = mgGetNestedChild(parent_face) while subface is not None: parent = mgGetParent(parent_face) mgDetach(subface) mgAttach(parent, subface) subface = mgGetNestedChild(parent_face) for parent_face in parent_faces: mgDelete(parent_face)
Great!
Ah I see. you wanted to delete the parent faces. I misunderstood and thought you just wanted to move subfaced children up. Glad it worked out.
Shawn
Greetings,
I want to explore removing the parent faces for sub-faced faces. This is a structure that does not seem to export well from flt to gltf, as the parent remains but the children get removed in the exported file. I am checking the export in blender 3.x.
In creator it would be no problem to remove level on the parent faces, but what would happen if I can do this in the API, do the children re-parent automatically or would they also get removed? What approach can I use if I want to do this in the API instead of Creator? I have python experience but not so much OF API.
If you know of a sample script that touches on this feel free to point it out, I am poring over the egstruct scripts.
Thanks!!
Shawn