Пример #1
0
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            normalsField           = new GUIToggleField(new LocEdString("Import Normals"));
            tangentsField          = new GUIToggleField(new LocEdString("Import Tangents"));
            skinField              = new GUIToggleField(new LocEdString("Import Skin"));
            blendShapesField       = new GUIToggleField(new LocEdString("Import Blend Shapes"));
            animationField         = new GUIToggleField(new LocEdString("Import Animation"));
            scaleField             = new GUIFloatField(new LocEdString("Scale"));
            cpuCachedField         = new GUIToggleField(new LocEdString("CPU cached"));
            cpuReadableField       = new GUIToggleField(new LocEdString("CPU readable"));
            collisionMeshTypeField = new GUIEnumField(typeof(CollisionMeshType), new LocEdString("Collision mesh"));
            keyFrameReductionField = new GUIToggleField(new LocEdString("Keyframe Reduction"));
            rootMotionField        = new GUIToggleField(new LocEdString("Import root motion"));
            reimportButton         = new GUIButton(new LocEdString("Reimport"));

            normalsField.OnChanged     += x => importOptions.ImportNormals = x;
            tangentsField.OnChanged    += x => importOptions.ImportTangents = x;
            skinField.OnChanged        += x => importOptions.ImportSkin = x;
            blendShapesField.OnChanged += x => importOptions.ImportBlendShapes = x;
            animationField.OnChanged   += x => importOptions.ImportAnimation = x;
            scaleField.OnChanged       += x => importOptions.Scale = x;
            cpuCachedField.OnChanged   += x => importOptions.CPUCached = x;
            cpuReadableField.OnChanged += x => importOptions.CPUReadable = x;
            collisionMeshTypeField.OnSelectionChanged += x => importOptions.CollisionMeshType = (CollisionMeshType)x;
            keyFrameReductionField.OnChanged          += x => importOptions.KeyframeReduction = x;
            rootMotionField.OnChanged += x => importOptions.ImportRootMotion = x;

            reimportButton.OnClick += TriggerReimport;

            Layout.AddElement(normalsField);
            Layout.AddElement(tangentsField);
            Layout.AddElement(skinField);
            Layout.AddElement(blendShapesField);
            Layout.AddElement(animationField);
            Layout.AddElement(scaleField);
            Layout.AddElement(cpuCachedField);
            Layout.AddElement(cpuReadableField);
            Layout.AddElement(collisionMeshTypeField);
            Layout.AddElement(keyFrameReductionField);
            Layout.AddElement(rootMotionField);

            splitInfos = importOptions.AnimationClipSplits;

            animSplitInfoField = GUIArrayField <AnimationSplitInfo, AnimSplitArrayRow> .Create(
                new LocEdString("Animation splits"), splitInfos, Layout);

            animSplitInfoField.OnChanged += x => { splitInfos = x; };
            animSplitInfoField.IsExpanded = Persistent.GetBool("animSplitInfos_Expanded");
            animSplitInfoField.OnExpand  += x => Persistent.SetBool("animSplitInfos_Expanded", x);

            Layout.AddSpace(10);

            GUILayout reimportButtonLayout = Layout.AddLayoutX();

            reimportButtonLayout.AddFlexibleSpace();
            reimportButtonLayout.AddElement(reimportButton);
        }
Пример #2
0
        /// <summary>
        /// Creates a array GUI field containing GUI elements for displaying an array.
        /// </summary>
        /// <param name="title">Label to display on the array GUI title.</param>
        /// <param name="array">Object containing the array data. Can be null.</param>
        /// <param name="layout">Layout to which to append the array GUI elements to.</param>
        /// <param name="depth">Determines at which depth to render the background. Useful when you have multiple
        ///                     nested containers whose backgrounds are overlaping. Also determines background style,
        ///                     depths divisible by two will use an alternate style.</param>
        /// <returns>New instance of an array GUI field.</returns>
        public static GUIArrayField <ElementType, RowType> Create(LocString title, ElementType[] array, GUILayout layout,
                                                                  int depth = 0)
        {
            GUIArrayField <ElementType, RowType> guiArray = new GUIArrayField <ElementType, RowType>(title, array, layout,
                                                                                                     depth);

            guiArray.BuildGUI();
            return(guiArray);
        }
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            Renderable renderable = InspectedObject as Renderable;

            if (renderable == null)
            {
                return;
            }

            meshField   = new GUIResourceField(typeof(Mesh), new LocEdString("Mesh"));
            layersField = new GUIListBoxField(Layers.Names, true, new LocEdString("Layers"));

            Layout.AddElement(meshField);
            Layout.AddElement(layersField);

            layersValue    = 0;
            materials      = renderable.Materials;
            materialsField = GUIArrayField <Material, MaterialArrayRow> .Create(new LocEdString("Materials"), materials, Layout);

            materialsField.OnChanged += x => { materials = x; };
            materialsField.IsExpanded = Persistent.GetBool("materialsField_Expanded");
            materialsField.OnExpand  += x => Persistent.SetBool("materialsField_Expanded", x);

            meshField.OnChanged += x =>
            {
                Mesh mesh = Resources.Load <Mesh>(x);
                renderable.Mesh = mesh;

                MarkAsModified();
                ConfirmModify();
            };

            layersField.OnSelectionChanged += x =>
            {
                ulong  layers = 0;
                bool[] states = layersField.States;
                for (int i = 0; i < states.Length; i++)
                {
                    layers |= states[i] ? Layers.Values[i] : 0;
                }

                layersValue       = layers;
                renderable.Layers = layers;

                MarkAsModified();
                ConfirmModify();
            };

            materialsLayout = Layout.AddLayoutY();
            BuildMaterialsGUI();
        }
Пример #4
0
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            fontSizes = GUIArrayField <int, FontSizeArrayRow> .Create(
                new LocEdString("Font sizes"), importOptions.FontSizes, Layout);

            fontSizes.OnChanged += x => importOptions.FontSizes = x;
            fontSizes.IsExpanded = Persistent.GetBool("fontSizes_Expanded");
            fontSizes.OnExpand  += x => Persistent.SetBool("fontSizes_Expanded", x);

            charRanges = GUIArrayField <CharRange, CharRangeArrayRow> .Create(
                new LocEdString("Character ranges"), importOptions.CharRanges, Layout);

            charRanges.OnChanged += x => importOptions.CharRanges = x;
            charRanges.IsExpanded = Persistent.GetBool("charRanges_Expanded");
            charRanges.OnExpand  += x => Persistent.SetBool("charRanges_Expanded", x);

            renderModeField = new GUIEnumField(typeof(FontRenderMode), new LocEdString("Render mode"));
            renderModeField.OnSelectionChanged += x => importOptions.RenderMode = (FontRenderMode)x;

            boldField            = new GUIToggleField(new LocEdString("Bold"));
            boldField.OnChanged += x => importOptions.Bold = x;

            italicField            = new GUIToggleField(new LocEdString("Italic"));
            italicField.OnChanged += x => importOptions.Italic = x;

            dpiField            = new GUIIntField(new LocEdString("DPI"));
            dpiField.OnChanged += x => importOptions.DPI = x;

            reimportButton          = new GUIButton(new LocEdString("Reimport"));
            reimportButton.OnClick += TriggerReimport;

            Layout.AddElement(renderModeField);
            Layout.AddElement(boldField);
            Layout.AddElement(italicField);
            Layout.AddElement(dpiField);
            Layout.AddSpace(10);

            GUILayout reimportButtonLayout = Layout.AddLayoutX();

            reimportButtonLayout.AddFlexibleSpace();
            reimportButtonLayout.AddElement(reimportButton);
        }