protected virtual void DrawModelViewer()
        {
            PageColumn modelViewer = root.Q <PageColumn>("model-viewer");

            DestroyImmediate(modelViewerEditor);
            modelViewer.Clear();
            if (chosenKey != null && modelViewer != null)
            {
                if (collection.ContainsKey(chosenKey) && collection[chosenKey].components.ContainsKey(typeof(Model)))
                {
                    Model modelComponent = (Model)collection[chosenKey].components[typeof(Model)];
                    if (modelComponent.manualKey.Equals(""))
                    {
                        modelViewer.style.display = DisplayStyle.None;
                        return;
                    }
                    previewModel = ProvenceManager.ModelBank.LoadModel(modelComponent.manualKey);
                    if (previewModel == null)
                    {
                        return;
                    }
                    modelViewer.style.display = DisplayStyle.Flex;
                    IMGUIContainer modelViewerWrapper = new IMGUIContainer();
                    modelViewerWrapper.AddToClassList("model-preview-wrapper");
                    modelViewer.Add(modelViewerWrapper);
                    modelViewerWrapper.onGUIHandler = () => {
                        DrawObjectPreview(modelViewerWrapper, ref modelViewerEditor, previewModel);
                    };
                }
                else
                {
                    modelViewer.style.display = DisplayStyle.None;
                }
            }
        }
Esempio n. 2
0
        protected override void DrawModelViewer()
        {
            PageColumn modelViewer = root.Q <PageColumn>("model-viewer");

            modelViewer.Clear();
            if (chosenKey == null)
            {
                modelViewer.style.display = DisplayStyle.None;
                return;
            }
            if (modelViewer != null)
            {
                previewModel = ((ModelBank)collection).LoadModel(chosenKey);
                if (previewModel != null)
                {
                    modelViewer.style.display = DisplayStyle.Flex;
                    IMGUIContainer modelViewerWrapper = new IMGUIContainer();
                    modelViewerWrapper.AddToClassList("model-preview-wrapper");
                    modelViewer.Add(modelViewerWrapper);
                    modelViewerWrapper.onGUIHandler = () => {
                        DrawObjectPreview(modelViewerWrapper, ref modelViewerEditor, previewModel);
                    };
                }
                else
                {
                    modelViewer.style.display = DisplayStyle.None;
                }
            }
        }