예제 #1
0
//----------------------------------------------------------------------------------------------------------------------
        void UpdateDCCPluginStatusLabel(Label statusLabel)
        {
            BaseDCCIntegrator dccIntegrator = statusLabel.userData as BaseDCCIntegrator;

            Assert.IsNotNull(dccIntegrator);
            DCCPluginInstallInfo installInfo = dccIntegrator.FindInstallInfo();

            const string NOT_INSTALLED = "MeshSync Plugin not installed";

            if (null == installInfo)
            {
                statusLabel.text = NOT_INSTALLED;
                return;
            }

            DCCToolInfo dccToolInfo = dccIntegrator.GetDCCToolInfo();
            string      installedPluginVersionStr = installInfo.GetPluginVersion(dccToolInfo.AppPath);

            if (string.IsNullOrEmpty(installedPluginVersionStr))
            {
                statusLabel.text = NOT_INSTALLED;
                return;
            }

            //Remove all known classes
            const string PLUGIN_INCOMPATIBLE_CLASS  = "plugin-incompatible";
            const string PLUGIN_INSTALLED_OLD_CLASS = "plugin-installed-old";
            const string PLUGIN_INSTALLED_CLASS     = "plugin-installed";

            statusLabel.RemoveFromClassList(PLUGIN_INCOMPATIBLE_CLASS);
            statusLabel.RemoveFromClassList(PLUGIN_INSTALLED_CLASS);
            statusLabel.RemoveFromClassList(PLUGIN_INSTALLED_OLD_CLASS);

            //The DCC Plugin is installed, and we need to check if it's compatible with this version of MeshSync
            bool parsed = PackageVersion.TryParse(installedPluginVersionStr, out PackageVersion installedPluginVersion);

            if (!parsed ||
                installedPluginVersion.Major != MeshSyncEditorConstants.PACKAGE_VERSION.Major ||
                installedPluginVersion.Minor != MeshSyncEditorConstants.PACKAGE_VERSION.Minor)
            {
                statusLabel.AddToClassList(PLUGIN_INCOMPATIBLE_CLASS);
                statusLabel.text = "Installed MeshSync Plugin is incompatible. Version: " + installedPluginVersionStr;
                return;
            }

            //Check if we have newer compatible DCCPlugin
            if (null != m_latestCompatibleDCCPluginVersion &&
                installedPluginVersion.Patch < m_latestCompatibleDCCPluginVersion.Patch)
            {
                statusLabel.AddToClassList(PLUGIN_INSTALLED_OLD_CLASS);
                statusLabel.text = $"Plugin {installedPluginVersionStr} installed. " +
                                   $"({m_latestCompatibleDCCPluginVersion} is available)";
                return;
            }

            statusLabel.AddToClassList(PLUGIN_INSTALLED_CLASS);
            statusLabel.text = $"Plugin {installedPluginVersionStr} installed";
        }
예제 #2
0
//----------------------------------------------------------------------------------------------------------------------

        void AddDCCToolSettingsContainer(DCCToolInfo dccToolInfo, VisualElement top, VisualTreeAsset dccToolInfoTemplate)
        {
            string            desc      = dccToolInfo.GetDescription();
            TemplateContainer container = dccToolInfoTemplate.CloneTree();
            Label             nameLabel = container.Query <Label>("DCCToolName").First();

            nameLabel.text = desc;

            //Load icon
            Texture2D iconTex = LoadIcon(dccToolInfo.IconPath);

            if (null != iconTex)
            {
                container.Query <Image>("DCCToolImage").First().image = iconTex;
            }
            else
            {
                container.Query <Label>("DCCToolImageLabel").First().text = desc[0].ToString();
            }

            container.Query <Label>("DCCToolPath").First().text = "Path: " + dccToolInfo.AppPath;

            BaseDCCIntegrator    integrator  = DCCIntegratorFactory.Create(dccToolInfo);
            DCCPluginInstallInfo installInfo = integrator.FindInstallInfo();

            Label statusLabel = container.Query <Label>("DCCToolStatus").First();

            if (null == installInfo || string.IsNullOrEmpty(installInfo.PluginVersion))
            {
                statusLabel.text = "MeshSync Plugin not installed";
            }
            else
            {
                statusLabel.AddToClassList("plugin-installed");
                statusLabel.text = "MeshSync Plugin installed. Version: " + installInfo.PluginVersion;
            }

            //Buttons
            {
                Button button = container.Query <Button>("RemoveDCCToolButton").First();
                button.clickable.clickedWithEventInfo += OnRemoveDCCToolButtonClicked;
                button.userData = dccToolInfo;
            }


            {
                Button button = container.Query <Button>("InstallPluginButton").First();
                button.clickable.clickedWithEventInfo += OnInstallPluginButtonClicked;
                button.userData = integrator;
            }

            top.Add(container);
        }
예제 #3
0
//----------------------------------------------------------------------------------------------------------------------
        void UpdateDCCPluginStatus(BaseDCCIntegrator dccIntegrator, Label statusLabel)
        {
            DCCPluginInstallInfo installInfo = dccIntegrator.FindInstallInfo();

            const string NOT_INSTALLED = "MeshSync Plugin not installed";

            if (null == installInfo)
            {
                statusLabel.text = NOT_INSTALLED;
                return;
            }

            DCCToolInfo dccToolInfo   = dccIntegrator.GetDCCToolInfo();
            string      pluginVersion = installInfo.GetPluginVersion(dccToolInfo.AppPath);

            if (string.IsNullOrEmpty(pluginVersion))
            {
                statusLabel.text = NOT_INSTALLED;
                return;
            }

            statusLabel.AddToClassList("plugin-installed");
            statusLabel.text = "MeshSync Plugin installed. Version: " + pluginVersion;
        }