Exemple #1
0
    // Use this for initialization
    void Awake()
    {
        keyBar                     = gameObject.AddComponent <KeyframeBar>();
        keyBar.keyedObject         = keyableGameObject;
        keyBar.debugMode           = isDebugModeActive;
        keyBar.motionCaptureTarget = MotionCaptureTarget;
        //TODO moveable keyframeBar
        //keyBar.transform.Translate((float)keyFrameBarX, (float)keyFrameBarY, 0.0f);

        // Switch the state
        GameRegistry activeRegistry = GameObject.Find("EditorApplication").GetComponent <GameRegistry>();

        if (isBatchRenderer)
        {
            activeRegistry.switchState(States.BatchRenderer);
        }
        else
        {
            activeRegistry.switchState(States.AnimationEditor);
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (isInitialized)
        {
            if (canLoadNextSet)
            {
                if (currentSetIndex > renderSets.Count - 1)
                {
                    Debug.Log("************** Done rendering all sets");
                    isActivelyRecording     = false;
                    canLoadNextSet          = false;
                    isReadyToStartRecording = false;
                    return;
                }

                int startIndex = 0;
                int endindex   = 0;
                endindex   = renderSets[currentSetIndex][0].LastIndexOf(".");
                startIndex = renderSets[currentSetIndex][0].LastIndexOf("\\");
                string pathName = renderSets[currentSetIndex][0].Substring(startIndex + 1, (endindex - startIndex - 1));

                endindex   = renderSets[currentSetIndex][1].LastIndexOf(".");
                startIndex = renderSets[currentSetIndex][1].LastIndexOf("\\");
                string tpsName = renderSets[currentSetIndex][1].Substring(startIndex + 1, (endindex - startIndex - 1));

                endindex   = renderSets[currentSetIndex][2].LastIndexOf(".");
                startIndex = renderSets[currentSetIndex][2].LastIndexOf("\\");
                string textureName = renderSets[currentSetIndex][2].Substring(startIndex + 1, (endindex - startIndex - 1));

                pathName    = Regex.Replace(pathName, @"\t|\n|\r", "");
                tpsName     = Regex.Replace(tpsName, @"\t|\n|\r", "");
                textureName = Regex.Replace(textureName, @"\t|\n|\r", "");
                Debug.Log("path: " + pathName + ", tpsName: " + tpsName);
                string name = pathName + tpsName + textureName;
                ProduceScreenShots.newFolderName(name);
                // We'll start by positioning the first fish and waiting a few seconds before recording
                loadMorph(renderSets[currentSetIndex][2]);
                loadTexture(renderSets[currentSetIndex][1]);
                loadStateData(renderSets[currentSetIndex][0]);
                Messenger <int> .Broadcast("SwitchCamera", 1);

                canLoadNextSet          = false;
                isReadyToStartRecording = true;
                isActivelyRecording     = true;
                currentFrame            = 0;
                playbackClock           = 0;
            }
            else if (isReadyToStartRecording)
            {
                playFrame();
            }
            else if (isActivelyRecording == false)
            {
                GameRegistry activeRegistry = gameObject.GetComponent <GameRegistry>();
                activeRegistry.switchState(States.ProjectSelector);
            }
        }

        /*
         * if(fishModel == FishType.Poeciliid)
         *              {
         *                      Messenger<float>.Broadcast("AdjustDorsalFin", dorsalAmount);
         *                      Messenger<float, float>.Broadcast("AdjustLPelvicFin", lpelvicHAmount, lpelvicVAmount);
         *                      Messenger<float, float>.Broadcast("AdjustRPelvicFin", rpelvicHAmount, rpelvicVAmount);
         *                      Messenger<float, float>.Broadcast("AdjustAnalFin", analHAmount, analVAmount);
         *              }*/
    }
Exemple #3
0
    void OnGUI()
    {
        //GuiManager guiManager = GameObject.Find("GuiManagerObject").GetComponent<GuiManager>();
        GUI.skin  = GuiManager.GetSkin();
        GUI.depth = 10;
        // Launch Screen
        GUI.BeginGroup(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 250, 250, 380));
        // All rectangles are now adjusted to the group. (0,0) is the topleft corner of the group.

        // We'll make a box so you can see where the group is on-screen.
        GUI.Box(new Rect(0, 0, 250, 380), "Anyfish Editor");


        if (GUI.Button(new Rect(65, 40, 120, 32), "New Project"))
        {
            isDisplayingNamePrompt = true;
        }


        if (GUI.Button(new Rect(65, 80, 120, 32), "Load Project"))
        {
            if (projectSelectionIndex != -1)
            {
                GameRegistry activeRegistry = gameObject.GetComponent <GameRegistry>();
                activeRegistry.activeProjectDirectory = projects[projectSelectionIndex].projectFolderPath;
                activeRegistry.switchState(States.ProjectEditor);
            }
            else
            {
                WarningSystem.addWarning("Select a Project", "Please selection a project before loading.", Code.Warning);
            }
        }

        if (isDisplayingNamePrompt)
        {
            GUI.enabled = false;
        }
        scrollViewVector = GUI.BeginScrollView(new Rect(15, 140, 220, 120), scrollViewVector, new Rect(0, 0, 200, 1000));

        projectSelectionIndex = GUILayout.SelectionGrid(projectSelectionIndex, getProjectNames(), 1, "toggle");


        // End the ScrollView
        GUI.EndScrollView();
        GUI.enabled = true;
        if (isDisplayingNamePrompt)
        {
            GUI.Box(new Rect(30, 80, 190, 180), "Enter Project Name:");

            GUI.SetNextControlName("ProjectNameField");
            projectName = GUI.TextField(new Rect(50, 120, 150, 32), projectName, 40);
            GUI.FocusControl("ProjectNameField");

            if (GUI.Button(new Rect(50, 190, 150, 32), "Ok"))
            {
                isDisplayingNamePrompt = false;

                // Create Project Directory and Add to the display list
                Directory.CreateDirectory(Application.dataPath + "\\projects\\" + projectName);
                ProjectData newProject = new ProjectData();

                //Creates a relative path for the project which is used in the xml file later. (Mohammad)
                string relative = "";
                if (Directory.Exists(Application.dataPath))
                {
                    string p        = Application.dataPath;
                    string parpath1 = Directory.GetParent(Application.dataPath).FullName;
                    string parpath2 = Directory.GetParent(parpath1).FullName;
                    string parpath3 = Directory.GetParent(parpath2).FullName;
                    relative = "../../" + Application.dataPath.Remove(0, parpath3.Length) + "\\projects\\" + projectName;
                }


                //newProject.projectFolderPath = Application.dataPath + "\\projects\\" + projectName;
                newProject.projectFolderPath = relative;
                newProject.projectName       = projectName;
                newProject.tankDimensions.x  = 1000;
                newProject.tankDimensions.z  = 700;
                newProject.tankDimensions.y  = 1000;
                createDirectoryIfItDoesntExist("tps", newProject.projectFolderPath);
                createDirectoryIfItDoesntExist("fins", newProject.projectFolderPath);
                createDirectoryIfItDoesntExist("textures", newProject.projectFolderPath);
                createDirectoryIfItDoesntExist("paths", newProject.projectFolderPath);
                Debug.Log("Project path: " + newProject.projectFolderPath);
                saveNewProjectData(newProject);
                projects.Add(newProject);
                WarningSystem.addWarning("New Project Folder", "New path:" + newProject.projectFolderPath, Code.Info);
            }
        }
        if (GUI.Button(new Rect(65, 290, 120, 32), "About"))
        {
            WarningSystem.addWarning("Version Info", "Version: 1.1 \t\tReleased: Jan 1, 2014 \nUpdates: Keyframe multi-selection, version info etc. ", Code.Info);
        }
        // End the group we started above. This is very important to remember!
        GUI.EndGroup();
    }
Exemple #4
0
    void OnGUI()
    {
        GUI.skin  = GuiManager.GetSkin();
        GUI.depth = 3;

        /*
         * if(isGuiVisible){
         *      // Make the first button.
         *      if (GUI.Button(new Rect (20,100,80,20), "Animation"))
         *      {
         *              SendMessage("OpenFileWindow");
         *      }
         *      GUI.Label(new Rect (110,100,800,20), pathToFileLabel);
         *
         *      selGridInt = GUILayout.SelectionGrid(selGridInt, selStrings, 3);
         *
         *      selShowMocapInt = GUILayout.SelectionGrid(selShowMocapInt, selShowLineRendererStrings, 2);
         * }*/

        if (isGuiVisible)
        {
            GUI.Box(new Rect(15, 15, 250, 625), "Path Properties");
            GUI.BeginGroup(new Rect(30, 50, 235, 560));
            GUI.Label(new Rect(0, 0, 98, 30), "Frame Count");
            frameField = GUI.TextArea(new Rect(100, 0, 50, 25), frameField);
            if (GUI.Button(new Rect(160, 0, 50, 30), "Set"))
            {
                Messenger <int> .Broadcast("KeyframeResize", int.Parse(frameField));
            }

            GUI.Label(new Rect(50, 30, 150, 30), "Motion Blend Type");
            selGridInt = GUI.SelectionGrid(new Rect(0, 55, 220, 30), selGridInt, selStrings, 3);

            GUI.enabled     = false;         //TODO on mocap loaded
            selShowMocapInt = GUI.SelectionGrid(new Rect(0, 90, 220, 30), selShowMocapInt, selShowLineRendererStrings, 2);
            //Debug.Log("selGridInt set: " + selGridInt);
            GUI.enabled = true;
            GUI.Label(new Rect(35, 120, 180, 30), "Load Guide Sequences");

            GUI.Label(new Rect(0, 145, 60, 30), "Front");
            //FrontToggle= GUI.Toggle (new Rect(40, 145, 30, 20),FrontToggle,"");
            //if (FrontToggle == false)
            //HideFront();
            if (GUI.Button(new Rect(50, 145, 60, 30), "Load"))
            {
                Messenger.Broadcast("LoadFront");
            }

            GUI.Label(new Rect(120, 145, 50, 30), "Top");
            //TopToggle= GUI.Toggle (new Rect(150, 145, 30, 20),TopToggle,"");
            //if (TopToggle == false)
            //HideTop();
            if (GUI.Button(new Rect(160, 145, 60, 30), "Load"))
            {
                Messenger.Broadcast("LoadTop");
            }

            if (GUI.Button(new Rect(0, 175, 100, 30), "Terrain On/Off"))
            {
                HideTerrain();
            }

            if (GUI.Button(new Rect(120, 175, 100, 30), "Guides On/Off"))
            {
                TopOnOff();
                FrontOnOff();
            }

            //{
            //	ShowAll();
            //}

            //if(GUI.Button(new Rect(180, 145, 40, 30), "Load"))
            //	{
            //		Messenger.Broadcast("LoadTop");
            //	}
            //
            GUI.Label(new Rect(50, 200, 180, 30), "Fish Fins Control");
            // Pelvics are kept at just greater than zero to prevent division by zero in later calc

            GUI.Label(new Rect(25, 220, 180, 30), "Pelvic");
            GUI.Label(new Rect(5, 240, 180, 30), "L-H");
            GUI.Label(new Rect(5, 255, 180, 30), "L-V");
            lpelvicHAmount = GUI.HorizontalSlider(new Rect(40, 245, 60, 15), lpelvicHAmount, -35.0f, 35.0f);
            lpelvicVAmount = GUI.HorizontalSlider(new Rect(40, 260, 60, 15), lpelvicVAmount, -35.0f, 35.0f);

            GUI.Label(new Rect(5, 280, 180, 30), "R-H");
            GUI.Label(new Rect(5, 295, 180, 30), "R-V");
            rpelvicHAmount = GUI.HorizontalSlider(new Rect(40, 285, 60, 15), rpelvicHAmount, -35.0f, 35.0f);
            rpelvicVAmount = GUI.HorizontalSlider(new Rect(40, 300, 60, 15), rpelvicVAmount, -35.0f, 35.0f);

            // Mahmoud 17.2.2014 ...........................................................

            GUI.Label(new Rect(140, 220, 180, 30), "Pectoral");
            GUI.Label(new Rect(120, 240, 180, 30), "L-H");
            GUI.Label(new Rect(120, 255, 180, 30), "L-V");
            lpectoralHAmount = GUI.HorizontalSlider(new Rect(155, 245, 60, 15), lpectoralHAmount, -35.0f, 35.0f);
            lpectoralVAmount = GUI.HorizontalSlider(new Rect(155, 260, 60, 15), lpectoralVAmount, -0.1f, 50.0f);

            GUI.Label(new Rect(120, 280, 180, 30), "R-H");
            GUI.Label(new Rect(120, 295, 180, 30), "R-V");
            rpectoralHAmount = GUI.HorizontalSlider(new Rect(155, 285, 60, 15), rpectoralHAmount, -35.0f, 35.0f);
            rpectoralVAmount = GUI.HorizontalSlider(new Rect(155, 300, 60, 15), rpectoralVAmount, -0.1f, 50.0f);

            //End ..........................................................................

            GUI.Label(new Rect(25, 315, 180, 30), "Anal");
            GUI.Label(new Rect(5, 335, 180, 30), "H");
            GUI.Label(new Rect(5, 350, 180, 30), "V");
            analHAmount = GUI.HorizontalSlider(new Rect(40, 340, 60, 10), analHAmount, -35.0f, 35.0f);
            analVAmount = GUI.HorizontalSlider(new Rect(40, 355, 60, 10), analVAmount, -35.0f, 35.0f);

            GUI.Label(new Rect(140, 315, 180, 30), "Dorsal");

            if (fishModel != FishType.Poeciliid)
            {
                GUI.enabled = false;
            }
            dorsalAmount = GUI.HorizontalSlider(new Rect(155, 340, 60, 10), dorsalAmount, -15.0f, 35.0f);

            GUI.enabled = true;



            GUI.Label(new Rect(45, 370, 180, 30), "Primary Camera");
            if (GUI.Button(new Rect(0, 395, 70, 30), "Front(1)"))
            {
                Messenger <int> .Broadcast("SwitchCamera", 0);
            }
            if (GUI.Button(new Rect(70, 395, 70, 30), "Free(2)"))
            {
                Messenger <int> .Broadcast("SwitchCamera", 1);
            }
            GUI.enabled = false;
            if (GUI.Button(new Rect(140, 395, 70, 30), "Top(3)"))
            {
                //Messenger.Broadcast("LoadTop");
            }
            GUI.enabled = true;
            GUI.Label(new Rect(35, 425, 180, 30), "Playback Settings");
            GUI.Label(new Rect(0, 455, 80, 30), "Framerate");
            playbackRate = int.Parse(GUI.TextField(new Rect(80, 455, 35, 30), playbackRate.ToString()));
            if (GUI.Button(new Rect(140, 455, 70, 30), "Play"))
            {
                //ProduceScreenShots.newFolderName(PlayerPrefs.GetString("PathName"));
                playbackKeys = GameObject.Find("KeyframeGameRegistry").GetComponent <KeyframeBar>().buildPlaybackData();
                currentFrame = 0;
                isPlaying    = true;
            }

            if (GUI.Button(new Rect(30, 490, 150, 30), "Save and Exit"))
            {
                PathData      data    = new PathData();
                CameraManager cameras = GameObject.Find("Cameras").GetComponent <CameraManager>();
                data.setCameraPosition(cameras.getActiveCameraPosition());
                data.setCameraRotation(cameras.getActiveCameraRotation());
                data.pathName  = "test";
                data.keyframes = GameObject.Find("KeyframeGameRegistry").GetComponent <KeyframeBar>().keyInfo;
                saveNewPathData(data);
                GameRegistry activeRegistry = GameObject.Find("EditorApplication").GetComponent <GameRegistry>();
                activeRegistry.switchState(States.ProjectSelector);
            }

            if (GUI.Button(new Rect(30, 530, 150, 30), "Exit Without Saving"))
            {
                Application.Quit();
            }
            GUI.EndGroup();
        }
    }