예제 #1
0
        private void MeshStatisticsGUI()
        {
            if (IsMultiSelect || Mesh.PrecomputedCollisionMeshes.Length == 0)
            {
                return;
            }

            EditorGUILayout.Space();

            InspectorGUI.BrandSeparator();

            var numCollisionMeshes = Mesh.PrecomputedCollisionMeshes.Length;
            var totNumVertices     = Mesh.PrecomputedCollisionMeshes.Select(collisionMesh => collisionMesh.Vertices.Length).Sum();
            var totNumTriangles    = Mesh.PrecomputedCollisionMeshes.Select(collisionMesh => collisionMesh.Indices.Length).Sum() / 3;
            var meshPlural         = numCollisionMeshes > 1 ? "es" : string.Empty;
            var summaryString      = $"Summary ({numCollisionMeshes} mesh{meshPlural}, {totNumTriangles} triangles, {totNumVertices} vertices)";

            if (InspectorGUI.Foldout(GetMeshStatisticsEditorData(Mesh),
                                     GUI.MakeLabel(summaryString)))
            {
                InspectorGUI.Separator();

                EditorGUILayout.LabelField(GUI.MakeLabel("Number of meshes"),
                                           GUI.MakeLabel(Mesh.PrecomputedCollisionMeshes.Length.ToString(), Color.green),
                                           InspectorEditor.Skin.TextField);
                using (InspectorGUI.IndentScope.Single) {
                    InspectorGUI.Separator();
                    for (int i = 0; i < Mesh.PrecomputedCollisionMeshes.Length; ++i)
                    {
                        var numVertices  = Mesh.PrecomputedCollisionMeshes[i].Vertices.Length;
                        var numTriangles = Mesh.PrecomputedCollisionMeshes[i].Indices.Length / 3;
                        EditorGUILayout.LabelField(GUI.MakeLabel($"[{i}] Number of triangles (vertices)"),
                                                   GUI.MakeLabel($"{numTriangles.ToString().Color( InspectorGUISkin.BrandColorBlue )} ({numVertices.ToString()})"),
                                                   InspectorEditor.Skin.TextField);
                    }
                    InspectorGUI.Separator();
                }
                var totNumTrianglesString  = totNumTriangles.ToString().Color(InspectorGUISkin.BrandColorBlue);
                var hasReducedNumTriangles = Mesh.Options != null &&
                                             (Mesh.Options.Mode != AGXUnity.Collide.CollisionMeshOptions.MeshMode.Trimesh ||
                                              Mesh.Options.ReductionEnabled);
                if (hasReducedNumTriangles)
                {
                    totNumTrianglesString += $" (originally: {Mesh.SourceObjects.Select( source => source.triangles.Length / 3 ).Sum().ToString().Color( Color.red )})";
                }
                EditorGUILayout.LabelField(GUI.MakeLabel("Total number of triangles"),
                                           GUI.MakeLabel(totNumTrianglesString),
                                           InspectorEditor.Skin.TextField);
            }
        }
예제 #2
0
        public static void AGXDynamicsForUnityLogoGUI()
        {
            GUILayout.BeginHorizontal(GUILayout.Width(570));
            GUILayout.Box(IconManager.GetAGXUnityLogo(),
                          GUI.Skin.customStyles[3],
                          GUILayout.Width(400),
                          GUILayout.Height(100));
            GUILayout.EndHorizontal();

            EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB",
                                       InspectorEditor.Skin.LabelMiddleCenter);

            InspectorGUI.BrandSeparator(1, 6);
        }
예제 #3
0
        private void OnGUI()
        {
            ValidateLicenseDirectory();

            using (GUI.AlignBlock.Center)
                GUILayout.Box(IconManager.GetAGXUnityLogo(),
                              GUI.Skin.customStyles[3],
                              GUILayout.Width(System.Math.Min(400.0f, position.width - 20.0f)),
                              GUILayout.Height(100));

            EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB",
                                       InspectorEditor.Skin.LabelMiddleCenter);

            InspectorGUI.BrandSeparator(1, 6);

            m_scroll = EditorGUILayout.BeginScrollView(m_scroll);

            if (IsUpdatingLicenseInformation)
            {
                ShowNotification(GUI.MakeLabel("Reading..."));
            }
            else if (AGXUnity.LicenseManager.IsBusy)
            {
                ShowNotification(GUI.MakeLabel(AGXUnity.LicenseManager.IsActivating ?
                                               "Activating..." :
                                               "Refreshing..."));
            }

            using (new GUI.EnabledBlock(!IsUpdatingLicenseInformation && !AGXUnity.LicenseManager.IsBusy)) {
                for (int i = 0; i < m_licenseData.Count; ++i)
                {
                    var data = m_licenseData[i];
                    LicenseDataGUI(data);
                    if (i + 1 < m_licenseData.Count)
                    {
                        InspectorGUI.Separator(2, 6, InspectorGUISkin.BrandColorBlue);
                    }
                }

                if (m_licenseData.Count > 0)
                {
                    InspectorGUI.Separator(2, 6, InspectorGUISkin.BrandColorBlue);
                }

                ActivateLicenseGUI();
            }

            InspectorGUI.BrandSeparator(1, 6);

            GUILayout.Label(GUI.MakeLabel("Online Documentation", true), InspectorEditor.Skin.Label);

            if (InspectorGUI.Link(GUI.MakeLabel("License Manager",
                                                false,
                                                s_licenseManagerUrl)))
            {
                Application.OpenURL(s_licenseManagerUrl);
            }
            if (InspectorGUI.Link(GUI.MakeLabel("Licensing AGX Dynamics for Unity",
                                                false,
                                                s_licensingUrl)))
            {
                Application.OpenURL(s_licensingUrl);
            }
            if (InspectorGUI.Link(GUI.MakeLabel("Free Trial",
                                                false,
                                                s_freeTrialUrl)))
            {
                Application.OpenURL(s_freeTrialUrl);
            }

            EditorGUILayout.EndScrollView();

            if (AGXUnity.LicenseManager.IsBusy || IsUpdatingLicenseInformation)
            {
                Repaint();
            }
        }
예제 #4
0
        private void OnGUI()
        {
            AGXDynamicsForUnityLogoGUI();

            EditorGUILayout.LabelField(GUI.MakeLabel("Thank you for using AGX Dynamics for Unity!", true),
                                       InspectorEditor.Skin.LabelMiddleCenter);

            GUILayout.Space(6);

            var fieldColor = EditorGUIUtility.isProSkin ?
                             Color.white :
                             Color.black;
            var fieldErrorColor = Color.Lerp(Color.red,
                                             Color.black,
                                             0.25f);

            var versionInfo = PackageUpdateHandler.FindCurrentVersion();

            InspectorGUI.SelectableTextField(GUI.MakeLabel("Version"),
                                             (versionInfo.IsValid ?
                                              versionInfo.VersionString :
                                              "git checkout").Color(fieldColor),
                                             InspectorEditor.Skin.Label);

            string agxDynamicsVersion = s_agxInfo.Version;

            if (string.IsNullOrEmpty(agxDynamicsVersion))
            {
                agxDynamicsVersion = GUI.AddColorTag("Unknown",
                                                     fieldErrorColor);
            }
            else
            {
                agxDynamicsVersion = GUI.AddColorTag(agxDynamicsVersion,
                                                     fieldColor);
            }

            InspectorGUI.SelectableTextField(GUI.MakeLabel("AGX Dynamics version"),
                                             agxDynamicsVersion,
                                             InspectorEditor.Skin.Label);

            InspectorGUI.LicenseEndDateField(s_agxInfo);

            InspectorGUI.BrandSeparator(1, 8);

            GUILayout.Label(GUI.MakeLabel("Online Documentation", true), InspectorEditor.Skin.Label);

            using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200))) {
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics for Unity")))
                {
                    Application.OpenURL(TopMenu.AGXDynamicsForUnityManualURL);
                }
                GUILayout.Label(" - ", InspectorEditor.Skin.Label);
                if (InspectorGUI.Link(GUI.MakeLabel("Examples")))
                {
                    Application.OpenURL(TopMenu.AGXDynamicsForUnityExamplesURL);
                }
            }

            using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200))) {
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics user manual")))
                {
                    Application.OpenURL(TopMenu.AGXUserManualURL);
                }
                GUILayout.Label(" - ", InspectorEditor.Skin.Label);
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics API Reference")))
                {
                    Application.OpenURL(TopMenu.AGXAPIReferenceURL);
                }
            }

            InspectorGUI.BrandSeparator(1, 8);

            GUILayout.Label("Support", EditorStyles.boldLabel);
            EditorGUILayout.SelectableLabel("Please refer to the information received when purchasing your license for support contact information.",
                                            InspectorEditor.Skin.LabelWordWrap);
        }
        private void OnGUI()
        {
            using (GUI.AlignBlock.Center)
                GUILayout.Box(IconManager.GetAGXUnityLogo(),
                              GUI.Skin.customStyles[3],
                              GUILayout.Width(400),
                              GUILayout.Height(100));

            EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB",
                                       InspectorEditor.Skin.LabelMiddleCenter);

            InspectorGUI.BrandSeparator(1, 6);

            var agxLfxColor       = Color.Lerp(Color.green, Color.black, 0.35f);
            var encryptedFilename = $"agx{AGXUnity.LicenseManager.GetRuntimeActivationExtension()}".Color(agxLfxColor);
            var serviceFilename   = $"agx{AGXUnity.LicenseManager.GetLicenseExtension( AGXUnity.LicenseInfo.LicenseType.Service )}".Color(agxLfxColor);

            InspectorGUI.ToolDescription("Generate an AGX Dynamics for Unity runtime activation file containing " +
                                         "encrypted License Id and Activation Code bound to the application. The " +
                                         "generated runtime activation file (" + encryptedFilename + ") will be replaced " +
                                         "with a hardware locked " + serviceFilename + " if the activation is successful.\n\n" +
                                         "<b>Internet access is required during the activation on the target hardware.</b>");

            InspectorGUI.Separator(1, 6);

            InspectorGUI.SelectFolder(GUI.MakeLabel("Build directory"),
                                      BuildDirectory,
                                      "Build directory",
                                      newBuildDirectory =>
            {
                if (!Directory.Exists(newBuildDirectory))
                {
                    Debug.LogWarning($"Ignoring given build path {newBuildDirectory} doesn't exist.");
                    return;
                }
                BuildDirectory = newBuildDirectory;
                // Reset reference file if it doesn't exist in the new build directory hierarchy.
                if (!File.Exists(ReferenceFileInBuildFull))
                {
                    m_referenceFileInBuild = string.Empty;
                }
            });
            InspectorGUI.SelectFile(GUI.MakeLabel("Reference file"),
                                    ReferenceFileInBuild,
                                    "Select reference file in build",
                                    BuildDirectory,
                                    newFilename =>
            {
                ReferenceFileInBuild = newFilename;
            });

            m_idPassword.Id = EditorGUILayout.TextField(GUI.MakeLabel("Runtime License Id"),
                                                        m_idPassword.Id,
                                                        InspectorEditor.Skin.TextField);
            if (m_idPassword.Id.Any(c => !char.IsDigit(c)))
            {
                m_idPassword.Id = new string( m_idPassword.Id.Where(c => char.IsDigit(c)).ToArray());
            }
            m_idPassword.Password = EditorGUILayout.PasswordField(GUI.MakeLabel("Runtime Activation Code"),
                                                                  m_idPassword.Password);

            var generateToolTip = string.Empty;

            using (new GUI.EnabledBlock(ValidateGenerate(ref generateToolTip))) {
                GUILayout.Space(3);
                if (GUILayout.Button(GUI.MakeLabel("Generate", false, generateToolTip)))
                {
                    var generatedFilename = string.Empty;
                    if (AGXUnity.LicenseManager.GenerateEncryptedRuntime(System.Convert.ToInt32(m_idPassword.Id),
                                                                         m_idPassword.Password,
                                                                         BuildDirectory,
                                                                         ReferenceFileInBuild,
                                                                         filename => generatedFilename = filename))
                    {
                        EditorUtility.DisplayDialog("Encrypted Runtime License",
                                                    $"Encrypted runtime successfully written to: {generatedFilename}",
                                                    "Ok");
                        Close();
                    }
                }
            }
        }
예제 #6
0
        private void OnGUI()
        {
            GUILayout.BeginHorizontal(GUILayout.Width(570));
            GUILayout.Box(IconManager.GetAGXUnityLogo(),
                          GUI.Skin.customStyles[3],
                          GUILayout.Width(400),
                          GUILayout.Height(100));
            GUILayout.EndHorizontal();

            EditorGUILayout.LabelField("© " + System.DateTime.Now.Year + " Algoryx Simulation AB",
                                       InspectorEditor.Skin.LabelMiddleCenter);

            InspectorGUI.BrandSeparator(1, 6);

            EditorGUILayout.LabelField(GUI.MakeLabel("Thank you for using AGX Dynamics for Unity!", true),
                                       InspectorEditor.Skin.LabelMiddleCenter);

            GUILayout.Space(6);

            var fieldColor = EditorGUIUtility.isProSkin ?
                             Color.white :
                             Color.black;
            var fieldErrorColor = Color.Lerp(Color.red,
                                             Color.black,
                                             0.25f);
            var fieldOkColor = Color.Lerp(Color.green,
                                          Color.black,
                                          0.35f);
            var fieldWarningColor = Color.Lerp(Color.yellow,
                                               Color.black,
                                               0.45f);

            var versionInfo = PackageUpdateHandler.FindCurrentVersion();

            EditorGUILayout.LabelField(GUI.MakeLabel("Version"),
                                       GUI.MakeLabel(versionInfo.IsValid ? versionInfo.VersionString : "git checkout", fieldColor),
                                       InspectorEditor.Skin.Label);

            string agxDynamicsVersion = s_agxInfo.Version;

            if (string.IsNullOrEmpty(agxDynamicsVersion))
            {
                agxDynamicsVersion = GUI.AddColorTag("Unknown",
                                                     fieldErrorColor);
            }
            else
            {
                agxDynamicsVersion = GUI.AddColorTag(agxDynamicsVersion,
                                                     fieldColor);
            }
            EditorGUILayout.LabelField(GUI.MakeLabel("AGX Dynamics version"),
                                       GUI.MakeLabel(agxDynamicsVersion),
                                       InspectorEditor.Skin.Label);

            EditorGUILayout.LabelField(GUI.MakeLabel(s_agxInfo.LicenseExpired ?
                                                     "License expired" :
                                                     "License expires"),
                                       s_agxInfo.ValidEndDate ?
                                       GUI.MakeLabel(s_agxInfo.EndDate.ToString("yyyy-MM-dd") +
                                                     GUI.AddColorTag($" ({s_agxInfo.DiffString} {(s_agxInfo.LicenseExpired ? "ago" : "remaining")})",
                                                                     s_agxInfo.LicenseExpired ?
                                                                     fieldErrorColor :
                                                                     s_agxInfo.IsLicenseAboutToBeExpired(10) ?
                                                                     fieldWarningColor :
                                                                     fieldOkColor),
                                                     fieldColor) :
                                       GUI.MakeLabel("License not found", fieldErrorColor),
                                       InspectorEditor.Skin.Label);

            InspectorGUI.BrandSeparator(1, 8);

            GUILayout.Label(GUI.MakeLabel("Online Documentation", true), InspectorEditor.Skin.Label);

            using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200))) {
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics for Unity")))
                {
                    Application.OpenURL(TopMenu.AGXDynamicsForUnityManualURL);
                }
                GUILayout.Label(" - ", InspectorEditor.Skin.Label);
                if (InspectorGUI.Link(GUI.MakeLabel("Examples")))
                {
                    Application.OpenURL(TopMenu.AGXDynamicsForUnityExamplesURL);
                }
            }

            using (new EditorGUILayout.HorizontalScope(GUILayout.Width(200))) {
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics user manual")))
                {
                    Application.OpenURL(TopMenu.AGXUserManualURL);
                }
                GUILayout.Label(" - ", InspectorEditor.Skin.Label);
                if (InspectorGUI.Link(GUI.MakeLabel("AGX Dynamics API Reference")))
                {
                    Application.OpenURL(TopMenu.AGXAPIReferenceURL);
                }
            }

            InspectorGUI.BrandSeparator(1, 8);

            GUILayout.Label("Support", EditorStyles.boldLabel);
            EditorGUILayout.SelectableLabel("Please refer to the information received when purchasing your license for support contact information.",
                                            InspectorEditor.Skin.LabelWordWrap);
        }