Beispiel #1
0
        private void DrawRenderSettings()
        {
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical("box");

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Size image");
            sizeImagePreview = EditorGUILayout.Slider(sizeImagePreview, 64, 1024);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button(" Create Icon", createButtonStyle, GUILayout.Height(24), GUILayout.Width(120)))
            {
                CheckDefaultFolderPathf();

                PreviewSceneInstance.Light1.enabled = true;
                PreviewSceneInstance.Light2.enabled = true;

                if (clearFlags == ClearFlags.Image)
                {
                    HandlerCameraRender.MakePreview(PreviewSceneInstance.PreviewCamera, folderPathf,
                                                    PreviewSceneInstance.PreviewObjectInstance.name, (int)sizeImagePreview, backgroundTexture);
                }
                else
                {
                    HandlerCameraRender.MakePreview(PreviewSceneInstance.PreviewCamera, folderPathf,
                                                    PreviewSceneInstance.PreviewObjectInstance.name, (int)sizeImagePreview);
                }

                AssetDatabase.Refresh();
            }

            if (GUILayout.Button(iconFolder, GUILayout.Height(24), GUILayout.Width(32)))
            {
                CheckDefaultFolderPathf();

                string newFolderPathf = EditorUtility.SaveFolderPanel("Export folder", folderPathf, "");

                if (newFolderPathf.Length > 0)
                {
                    folderPathf = newFolderPathf + "/";
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.EndVertical();
        }
        public Texture2D MakeImage(string folderPathf, string name, int size, Texture texBG)
        {
            Light1.enabled = true;
            Light2.enabled = true;

            if (folderPathf == "default")
            {
                folderPathf = "Assets/Easy Icon Maker/";
            }

            if (name == "default" && PreviewObjectInstance != null)
            {
                name = PreviewObjectInstance.name;
            }

            Texture2D image = HandlerCameraRender.MakePreview(PreviewCamera, folderPathf, name, size, texBG);

            AssetDatabase.Refresh();

            return(image);
        }