/// <summary> /// interface for importing the STL /// creates a GameObject and sets its parameters /// </summary> /// <param name="path">the path of the STL-file</param> /// <param name="coordinates">the desired coordinates for the GameObject</param> /// <param name="isStatic">static or moveable GameObject</param> /// <param name="quaternion">the rotation for the GameObject</param> public void ImportSTL(string path, bool isStatic, Vector3 coordinates, Quaternion quaternion) { if (System.IO.File.Exists(path)) { // creates a gameObject out of an STL-file StlObject = StlAssetPostProcessor.CreateStlParent(path); // check if it is actually created if (StlObject != null) { // set it static or movable depending on the input StlObject.isStatic = isStatic; // do not yet set it active StlObject.SetActive(false); } // the coordinates for the object vec = coordinates; // the rotation of the object this.quaternion = quaternion; } }
public void StlPostprocess_NewStl_DontCreatePrefab() { // make a new copy of the stl file Assert.IsTrue(AssetDatabase.CopyAsset(k_StlCubeSourcePath, m_StlCubeCopyPath)); Assert.IsTrue(RuntimeUrdf.AssetExists(m_StlCubeCopyPath)); // make sure the .asset file is not automatically created var meshAssetPath = StlAssetPostProcessor.GetMeshAssetPath(m_StlCubeCopyPath, 0); Assert.IsFalse(RuntimeUrdf.AssetExists(meshAssetPath)); // make sure the .prefab file is not automatically created var prefabPath = StlAssetPostProcessor.GetPrefabAssetPath(m_StlCubeCopyPath); Assert.IsFalse(RuntimeUrdf.AssetExists(prefabPath)); // make sure the .asset and .prefab file are created when requested StlAssetPostProcessor.PostprocessStlFile(m_StlCubeCopyPath); Assert.IsTrue(RuntimeUrdf.AssetExists(meshAssetPath)); Assert.IsTrue(RuntimeUrdf.AssetExists(prefabPath)); }