// Initializes import pipeline and reads the urdf file.
        private static ImportPipelineData ImportPipelineInit(string filename, ImportSettings settings, bool loadStatus, bool forceRuntimeMode)
        {
            ImportPipelineData im = new ImportPipelineData();

            im.settings         = settings;
            im.loadStatus       = loadStatus;
            im.wasRuntimeMode   = RuntimeUrdf.IsRuntimeMode();
            im.forceRuntimeMode = forceRuntimeMode;

            if (forceRuntimeMode)
            {
                RuntimeUrdf.SetRuntimeMode(true);
            }

            im.robot = new Robot(filename);

            if (!UrdfAssetPathHandler.IsValidAssetPath(im.robot.filename))
            {
                Debug.LogError("URDF file and ressources must be placed in Assets Folder:\n" + Application.dataPath);
                if (forceRuntimeMode)
                { // set runtime mode back to what it was
                    RuntimeUrdf.SetRuntimeMode(im.wasRuntimeMode);
                }
                return(null);
            }
            return(im);
        }
Ejemplo n.º 2
0
        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));
        }