private void OnInspectorUpdate()
    {
        // some methods can only be called from main thread:
        // We check the status to call the methods at the right step in the process:

        Repaint();

        // import Model
        if (status["databaseRefreshed"].WaitOne(0) && !status["importModelDialogShown"].WaitOne(0))
        {
            status["importModelDialogShown"].Set();
            if (EditorUtility.DisplayDialog(
                    "Urdf Assets imported.",
                    "Do you want to generate a " + urdfImporter.robotName + " GameObject now?",
                    "Yes", "No"))
            {
                RobotCreator.Create(Path.Combine(urdfImporter.LocalDirectory, "robot_description.urdf"));
            }
        }

        // refresh Asset Database
        if (status["resourceFilesReceived"].WaitOne(0) && !status["databaseRefreshed"].WaitOne(0))
        {
            status["databaseRefreshStarted"].Set();
            AssetDatabase.Refresh();
            status["databaseRefreshed"].Set();
        }
    }
예제 #2
0
        public void TestRobotCreator()
        {
            rc = new RobotCreator();

            Robot r = rc.Create("");

            bool res = r is CyborgRobot || r is ScienceRobot || r is WorkerRobot;

            Assert.IsTrue(res);
        }
    private static void CreateUrdfObject()
    {
        string urdfFile = EditorUtility.OpenFilePanel("Generate Urdf Model",
                                                      Path.Combine(
                                                          Path.GetDirectoryName(Application.dataPath),
                                                          Path.Combine("Assets", "Urdf")
                                                          ),
                                                      "urdf;*.urdf");

        if (urdfFile != "")
        {
            RobotCreator.Create(urdfFile);
        }
    }