void SurfaceTool::index() { if (index_array.size()) return; //already indexed HashMap<Vertex, int, VertexHasher> indices; List<Vertex> new_vertices; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next()) { int *idxptr = indices.getptr(E->get()); int idx; if (!idxptr) { idx = indices.size(); new_vertices.push_back(E->get()); indices[E->get()] = idx; } else { idx = *idxptr; } index_array.push_back(idx); } vertex_array.clear(); vertex_array = new_vertices; format |= Mesh::ARRAY_FORMAT_INDEX; }
void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const { HashMap<String, PLData> usage; Node *es = EditorNode::get_singleton()->get_edited_scene(); if (!es) return; int nc = 0; List<PLData *> datas; for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) { if (!es->has_node(E->get())) continue; Node *n = es->get_node(E->get()); if (!n) continue; List<PropertyInfo> plist; n->get_property_list(&plist, true); for (List<PropertyInfo>::Element *F = plist.front(); F; F = F->next()) { if (F->get().name == "script") continue; //added later manually, since this is intercepted before being set (check Variant Object::get() ) if (!usage.has(F->get().name)) { PLData pld; pld.uses = 0; pld.info = F->get(); usage[F->get().name] = pld; datas.push_back(usage.getptr(F->get().name)); } usage[F->get().name].uses++; } nc++; } for (List<PLData *>::Element *E = datas.front(); E; E = E->next()) { if (nc == E->get()->uses) { p_list->push_back(E->get()->info); } } p_list->push_back(PropertyInfo(Variant::OBJECT, "scripts", PROPERTY_HINT_RESOURCE_TYPE, "Script")); }