#include #include "terrain_object.h" List TerrainObject::get_objects(const PackedScene *sc, const NodePath &path) { int i, j; List obj_list; if (sc) { Node *tmp = sc->instance(); Node *obj = tmp->get_node_or_null(path); if (!obj) printf("no objects :(\n"); if (obj) { printf("objects: %d\n", obj->get_child_count()); for (i = 0; i < obj->get_child_count(); i++) { Node *scobj = obj->get_child(i); if (!scobj) continue; TerrainObject tobj; printf("lods: %d\n", scobj->get_child_count()); for (j = 0; j < scobj->get_child_count(); j++) { Node *p = scobj->get_child(j); MeshInstance *mi = Object::cast_to(p); if (mi) { Ref data = mi->get_mesh(); if (data.ptr()) { tobj.add_mesh(data); } } } if (tobj.lods.size() > 0) obj_list.push_back(tobj); } } } return obj_list; }