Exemple #1
0
        private static void CreateUrdfObject()
        {
            string urdfFile = EditorUtility.OpenFilePanel(
                "Import local URDF",
                Path.Combine(Path.GetDirectoryName(Application.dataPath), "Assets"),
                "urdf");

            if (urdfFile != "")
            {
                UrdfRobot.Create(urdfFile);
            }
        }
        private static void CreateUrdfObject()
        {
            //Get path to asset, check if it's a urdf file
            string assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);

            if (Path.GetExtension(assetPath)?.ToLower() == ".urdf")
            {
                UrdfRobot.Create(UrdfAssetPathHandler.GetFullAssetPath(assetPath));
            }
            else
            {
                EditorUtility.DisplayDialog("URDF Import",
                                            "The file you selected was not a URDF file. A robot can only be imported from a valid URDF file.", "Ok");
            }
        }