コード例 #1
0
ファイル: AuraEditor.cs プロジェクト: netneko21/MyDocVr
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GuiHelpers.DrawHeader(logoTexture);

            _tabIndex = GUILayout.Toolbar(_tabIndex, _tabsContent);

            EditorGUILayout.Separator();

            switch (_tabIndex)
            {
            case 0:
            {
                DisplayBaseInjectionArea();
            }
            break;

            case 1:
            {
                DisplaySettingsTab();
            }
            break;
            }

            GuiHelpers.DisplayHelpToShowHelpBox();

            EditorGUILayout.Separator();

            serializedObject.ApplyModifiedProperties();
        }
コード例 #2
0
ファイル: Texture3DEditor.cs プロジェクト: YoonieP/GMTK_2018
        //// TODO : INVESTIGATE TO ACCESS THOSE VARIABLES AS THE DEFAULT INSPECTOR IS UGLY
        //private SerializedProperty wrapModeProperty;
        //private SerializedProperty filterModeProperty;
        //private SerializedProperty anisotropyLevelProperty;
        #endregion

        #region Overriden base class functions (https://docs.unity3d.com/ScriptReference/Editor.html)
        /// <summary>
        /// Draws the content of the Inspector
        /// </summary>
        public override void OnInspectorGUI()
        {
            GuiHelpers.DrawHeader(logoTexture);

            //serializedObject.Update();

            //// HAD TO DISABLE THE DEFAULT INSPECTOR AS IT MADE PREVIEW LAG
            //DrawDefaultInspector();

            //serializedObject.ApplyModifiedProperties();
        }
コード例 #3
0
ファイル: AuraLightEditor.cs プロジェクト: netneko21/MyDocVr
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GuiHelpers.DrawHeader(logoTexture);

            _tabIndex = GUILayout.Toolbar(_tabIndex, _tabsContent);

            EditorGUILayout.Separator();

            switch (_tabIndex)
            {
            case 0:
            {
                DisplayCommonSettingsArea();
            }
            break;

            case 1:
            {
                switch (((AuraLight)serializedObject.targetObject).Type)
                {
                case LightType.Directional:
                {
                    DisplayDirectionalLightAdditionalSettingsArea();
                }
                break;

                case LightType.Spot:
                {
                    DisplaySpotLightAdditionalSettingsArea();
                }
                break;

                case LightType.Point:
                {
                    DisplayPointLightAdditionalSettingsArea();
                }
                break;
                }
            }

            break;
            }

            GuiHelpers.DisplayHelpToShowHelpBox();

            EditorGUILayout.Separator();

            serializedObject.ApplyModifiedProperties();
        }
コード例 #4
0
        private void OnGUI()
        {
            GuiHelpers.DrawHeader(logoTexture);

            EditorGUILayout.Separator();

            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Create Texture3D Asset", texture3DIcon), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("Create a composite Texture3D from a Texture2D.");

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("Source texture used to build the Texture3D.");
            EditorGUILayout.LabelField("Source Texture");
            _sourceTexture = (Texture2D)EditorGUILayout.ObjectField(_sourceTexture, typeof(Texture2D), false);

            EditorGUILayout.Separator();

            if (_sourceTexture != null)
            {
                _sourceTexturePath = AssetDatabase.GetAssetPath(_sourceTexture);
                TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(_sourceTexturePath);

                if (textureImporter.isReadable)
                {
                    EditorGUILayout.Separator();

                    GuiHelpers.DrawContextualHelpBox("Target size of the 3D texture.");
                    _referenceSize = EditorGUILayout.DelayedIntField("Reference Size", _referenceSize);
                    _referenceSize = Mathf.Max(_referenceSize, 16);
                    _referenceSize = Mathf.ClosestPowerOfTwo(_referenceSize);

                    EditorGUILayout.Separator();

                    EditorGUILayout.HelpBox("\nHorizontal tiles count : " + HorizontalTilesCount + "\nVertical tiles count : " + VerticalTilesCount + "\n\nTotal amount of tiles : " + TotalTilesCount + "\n", MessageType.Info);

                    EditorGUILayout.Separator();

                    if (AreParametersValid)
                    {
                        GuiHelpers.DrawContextualHelpBox("The order of which the tiles should be assembled to create the 3D texture (should we assemble line by line or column by column?).");
                        EditorGUILayout.LabelField("Reading Order");
                        _readingOrder = (Texture3DReadingOrderEnum)EditorGUILayout.EnumPopup(_readingOrder);

                        EditorGUILayout.Separator();

                        GuiHelpers.DrawContextualHelpBox("Generates a new Texture3D from the source texture.");
                        if (GUILayout.Button(new GUIContent("Generate")))
                        {
                            GenerateVolumetricTexture(_sourceTexture);
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("ERROR : the total amount of tiles should be equal to the reference tile size. In this case : " + _referenceSize, MessageType.Error);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("ERROR : the source texture asset should be marked as \"READABLE\".", MessageType.Error);
                    if (GUILayout.Button(new GUIContent("Mark as \"READABLE\"")))
                    {
                        textureImporter.isReadable = true;
                        textureImporter.SaveAndReimport();
                    }
                }

                EditorGUILayout.Separator();
            }

            EditorGUILayout.EndVertical();

            GuiHelpers.DisplayHelpToShowHelpBox();
        }