Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        void OnInstallPluginButtonClicked(EventBase evt)
        {
            Button button = evt.target as Button;

            if (null == button)
            {
                Debug.LogWarning("[MeshSync] Failed to Install Plugin");
                return;
            }

            BaseDCCIntegrator integrator = button.userData as BaseDCCIntegrator;

            if (null == integrator)
            {
                Debug.LogWarning("[MeshSync] Failed to Install Plugin");
                return;
            }

            integrator.Integrate(() => {
                Setup(m_root);
            });
        }