private static string LocateRootAssetFolder <T>(string urdfFileName) where T : UnityEngine.Object { string newAssetPath = RuntimeUrdf.EditorUtility_OpenFolderPanel( "Locate package root folder", Path.Combine(Path.GetDirectoryName(Application.dataPath), "Assets"), ""); if (UrdfAssetPathHandler.IsValidAssetPath(newAssetPath)) { UrdfAssetPathHandler.SetPackageRoot(newAssetPath, true); } else { Debug.LogWarning("Selected package root " + newAssetPath + " is not within the Assets folder."); } return(UrdfAssetPathHandler.GetRelativeAssetPathFromUrdfPath(urdfFileName)); }
// Creates the robot game object. private static void ImportPipelineCreateObject(ImportPipelineData im) { im.robotGameObject = new GameObject(im.robot.name); importsettings = im.settings; im.settings.totalLinks = im.robot.links.Count; CreateTag(); SetTag(im.robotGameObject); im.robotGameObject.AddComponent <UrdfRobot>(); im.robotGameObject.AddComponent <Unity.Robotics.UrdfImporter.Control.Controller>(); if (RuntimeUrdf.IsRuntimeMode()) {// In runtime mode, we have to disable controller while robot is being constructed. im.robotGameObject.GetComponent <Unity.Robotics.UrdfImporter.Control.Controller>().enabled = false; } im.robotGameObject.GetComponent <UrdfRobot>().SetAxis(im.settings.choosenAxis); UrdfAssetPathHandler.SetPackageRoot(Path.GetDirectoryName(im.robot.filename)); UrdfMaterial.InitializeRobotMaterials(im.robot); UrdfPlugins.Create(im.robotGameObject.transform, im.robot.plugins); }