bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; if (name.begins_with("item/")) { int idx = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); if (!item_map.has(idx)) create_item(idx); if (what == "name") set_item_name(idx, p_value); else if (what == "mesh") set_item_mesh(idx, p_value); else if (what == "shape") set_item_shape(idx, p_value); else if (what == "preview") set_item_preview(idx, p_value); else if (what == "navmesh") set_item_navmesh(idx, p_value); else return false; return true; } return false; }
bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; if (name.begins_with("item/")) { int idx = name.get_slicec('/', 1).to_int(); String what = name.get_slicec('/', 2); if (!item_map.has(idx)) create_item(idx); if (what == "name") set_item_name(idx, p_value); else if (what == "mesh") set_item_mesh(idx, p_value); else if (what == "shape") { Vector<ShapeData> shapes; ShapeData sd; sd.shape = p_value; shapes.push_back(sd); set_item_shapes(idx, shapes); } else if (what == "shapes") { _set_item_shapes(idx, p_value); } else if (what == "preview") set_item_preview(idx, p_value); else if (what == "navmesh") set_item_navmesh(idx, p_value); else return false; return true; } return false; }