Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
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();
        }