public void _ExportToOBJMTL() { //OBJ & MTL MeshExporter.ObjExporter.OBJ_MTL_TXT data = MeshExporter.ObjExporter.MeshToString(ringMenu, ringMenu.name); tohtml._String_TO_File(data.objfilename, data.obj); tohtml._String_TO_File(data.mtlfilename, data.mtl); }
void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //Debug.DrawRay(ray.origin, ray.direction * hit.distance, Color.red); if (Physics.Raycast(ray, out RaycastHit hit)) { //Debug.Log(hit.transform.name); _txt_btn.text = hit.transform.name; if (!dico.ContainsKey(hit.transform.name)) { Debug.Log(hit.transform.name); } RingButton_Manager rb = dico[hit.transform.name]; if (rb != rb_previsous) { if (rb_previsous != null) { rb_previsous._SetNormalColor(); } if (rb != null) { rb._SetHighlightColor(); } rb_previsous = rb; } if (Input.GetMouseButtonDown(0)) { if (rb != null) { rb._SetSelectedColor(); GameObject selectedRingMenu = hit.transform.parent.parent.gameObject; //OBJ & MTL MeshExporter.ObjExporter.OBJ_MTL_TXT om = MeshExporter.ObjExporter.MeshToString(selectedRingMenu, selectedRingMenu.name); //display in 2 textboxes //_if_obj.text = om.obj; //_if_mtl.text = om.mtl; _txt_obj.text = om.objfilename; _txt_mtl.text = om.mtlfilename; GC.Collect(); //FBX string path = selectedRingMenu.name + ".fbx"; _if_fbx.text = ""; string fbxfile = UnityFBXExporter.FBXExporter.MeshToString(selectedRingMenu, path, false, false); GUIUtility.systemCopyBuffer = fbxfile; //TextEditor te = new TextEditor(); //te.text = fbxfile; //te.SelectAll(); //te.Copy(); _txt_fbx.text = path; GC.Collect(); #if UNITY_WEBGL && !UNITY_EDITOR try { //save to disk // download file ?? MeshExporter.ObjExporter.OBJ_MTL_TXT.ToFile(om); _txt_debug.text = ""; } catch (Exception ex) { _txt_debug.text = ex.Message + "\n\n" + ex.StackTrace; } #else //save to disk OBJ MeshExporter.ObjExporter.OBJ_MTL_TXT.ToFile(om); //save to disk FBX UnityFBXExporter.FBXExporter.ExportGameObjToFBX(selectedRingMenu, path, false, false); //UnityFBXExporter.FBXExporter.ExportGameObjToFBX(selectedRingMenu, path, true, true); //MeshExporter.ObjExporter.MeshToFile(selectedRingMenu, pathToSaveOBJs + selectedRingMenu.name); #endif } } else { _txt_btn.text = ""; if (rb_previsous != null) { rb_previsous._SetNormalColor(); } rb_previsous = null; } } }