private void AddressList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Comment.Text == "")
            {
                Comment.Text = GetNameDefaultName((uint)AddressList.SelectedIndex);
            }

            if (AddressList.SelectedIndex <= 0)
            {
                AnimationPanel.Hide();
                AnimationImportButton.Hide();
                AnimationExportButton.Hide();
                NOTIFY_KeepEmpty.Show();
                return;
            }
            NOTIFY_KeepEmpty.Hide();
            AnimationImportButton.Show();

            uint addr = U.toOffset((uint)P0.Value);

            if (U.isSafetyOffset(addr))
            {
                AnimationPanel.Show();
                AnimationExportButton.Show();
                ShowFrameUpDown.Value = 0;
                ShowFrameUpDown_ValueChanged(null, null);
            }
            else
            {
                AnimationPanel.Hide();
                AnimationExportButton.Hide();
            }
        }
Exemple #2
0
        private void AddressList_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.SKILLICON.Image = DrawIcon((uint)AddressList.SelectedIndex, this.IconBaseAddress);

            uint anime = this.AnimeBaseAddress + (4 * (uint)AddressList.SelectedIndex);
            uint a     = Program.ROM.p32(anime);

            ANIMATION.Value = a;
            if (U.isSafetyOffset(a))
            {
                AnimationPanel.Show();
                AnimationExportButton.Show();
                ShowFrameUpDown.Value = 0;
                ShowFrameUpDown_ValueChanged(null, null);
            }
            else
            {
                AnimationPanel.Hide();
                AnimationExportButton.Hide();
            }
        }
    IEnumerator _OpenMesh(Transform _attach = null)
    {
        string lastPath = Application.dataPath;

        if (PlayerPrefs.HasKey("lastmeshpath"))
        {
            lastPath = PlayerPrefs.GetString("lastmeshpath");
        }

        string[] result = StandaloneFileBrowser.OpenFilePanel("Open EU4 object", lastPath, new[] { new ExtensionFilter("EU4 object ", "mesh") }, false);

        if (result.Length > 0)
        {
            if (_attach == null)
            {
                SetAttach(null);

                for (int i = 0; i < hierarchyPanel.childCount; i++)
                {
                    Destroy(hierarchyPanel.GetChild(i).gameObject);
                }
                for (int i = 0; i < canvasLocators.childCount; i++)
                {
                    Destroy(canvasLocators.GetChild(i).gameObject);
                }

                meshPath.text = animPath.text = fbxPath.text = "";
                saveAnimButton.interactable = saveMeshButton.interactable = saveFbxButton.interactable = false;
            }

            bigStatus.gameObject.SetActive(true);
            yield return(null);

            PlayerPrefs.SetString("lastmeshpath", Path.GetDirectoryName(result[0]));
            PlayerPrefs.Save();

            loader.LoadMesh(result[0], _attach);
        }
        else
        {
            bigStatus.gameObject.SetActive(false);
            yield break;
        }

        if (loader.selectedObject == null)
        {
            meshPath.text = "";
        }
        else
        {
            Status(loader.selectedObject.name + " loaded!");

            if (loader.selectedObject.GetComponentInChildren <SkinnedMeshRenderer>() != null)
            {
                animPath.text = "animation can be loaded";
            }
            else
            {
                animPath.text = "object has no skeleton for animation";
            }

            meshPath.text = Path.GetFileName(result[0]);
            saveMeshButton.interactable = true;

            fbxPath.text = "can be saved as .obj";
            saveFbxButton.interactable = true;

            if (_attach == null)
            {
                ToggleLocators(); ToggleLocatorNames();

                animationPanel.Hide();

                StartCoroutine(AddShapesButtons());
            }
        }

        bigStatus.gameObject.SetActive(false);
    }