コード例 #1
0
        public virtual bool PEGI()
        {
            "Profile Name: ".edit(80, ref name);

#if UNITY_EDITOR
            string path = PainterCamera.Data.meshesFolderName + "/" + folderName;
            if (icon.Save.Click("Save To:" + path, 25).nl())
            {
                this.SaveToAssets(path, name);
                UnityHelperFunctions.RefreshAssetDatabase();
                (name + " Saved to " + path).showNotification();
            }


            UnityEngine.Object myType = null;
            if (pegi.edit(ref myType).nl())
            {
                var msol = (MeshPackagingProfile)(new MeshPackagingProfile().Decode(StuffLoader.LoadTextAsset(myType)));

                PainterCamera.Data.meshPackagingSolutions.Add(msol);
                PlaytimePainter.inspectedPainter.selectedMeshProfile = PainterCamera.Data.meshPackagingSolutions.Count - 1;
            }
#endif


            bool changed = false;
            for (int i = 0; i < sln.Count; i++)
            {
                changed |= sln[i].PEGI().nl();
            }

            return(changed);
        }
コード例 #2
0
ファイル: Decoder.cs プロジェクト: QuteSaltyFish/Re-AB
        public static void ToAssetByGUID <T>(this string data, ref T val) where T : UnityEngine.Object
        {
            var ass = UnityHelperFunctions.GUIDtoAsset <T>(data);

            if (ass)
            {
                val = ass;
            }
        }
コード例 #3
0
        public override bool BrushConfigPEGI()
        {
            bool changed = false;

            // if (pntr.terrain != null)
            //   "Found the terrain, yey!!".nl();
            //  changed |= "Test: ".edit(ref testData).nl();

            if (changed)
            {
                UnityHelperFunctions.SetToDirty(this);
            }

            return(changed);
        }
コード例 #4
0
        public static void CheckRefocus()
        {
#if UNITY_EDITOR
            if (refocusOnThis != null)
            {
                scipframes--;
                if (scipframes == 0)
                {
                    UnityHelperFunctions.FocusOn(refocusOnThis);
                    refocusOnThis = null;
                    scipframes    = 3;
                }
            }
#endif
        }
コード例 #5
0
ファイル: ISTD_Explorer.cs プロジェクト: QuteSaltyFish/Re-AB
        public bool PEGI()
        {
            bool changed = false;


            if (dataExplorer.inspectedTag == -1)
            {
                this.inspect_Name();
                if (Std != null && dataExplorer.tag.Length > 0 && icon.Save.Click("Save To Assets"))
                {
                    StuffSaver.Save_ToAssets_ByRelativePath(Mgmt.fileFolderHolder, dataExplorer.tag, dataExplorer.data);
                    UnityHelperFunctions.RefreshAssetDatabase();
                }

                pegi.nl();

                if (Std != null)
                {
                    if (dataExplorer.tag.Length == 0)
                    {
                        dataExplorer.tag = Std.ToPEGIstring() + " config";
                    }

                    "Save To:".edit(50, ref Mgmt.fileFolderHolder);

                    var uobj = Std as UnityEngine.Object;

                    if (uobj && icon.Done.Click("Use the same directory as current object."))
                    {
                        Mgmt.fileFolderHolder = uobj.GetAssetFolder();
                    }

                    uobj.clickHighlight();

                    pegi.nl();
                }


                "Comment:".editBig(ref comment).nl();
            }



            dataExplorer.Nested_Inspect();

            return(changed);
        }
コード例 #6
0
ファイル: SceneViewEditable.cs プロジェクト: belzecue/Tools
        public void CloseAllButThis(T trg)
        {
            trg.enabled = true;
            GameObject go = trg.gameObject;

            Component[] cs = go.GetComponents(typeof(Component));

            foreach (Component c in cs)
            {
                if (c.GetType() != typeof(T))
                {
                    UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(c, false);
                }
            }


            UnityHelperFunctions.FocusOn(null);
            PlaytimeToolComponent.refocusOnThis = go;
        }
コード例 #7
0
ファイル: WaterController.cs プロジェクト: belzecue/Tools
        public override bool PEGI()
        {
            bool changed = base.PEGI();

            if (!showDebug)
            {
                changed |= "Foam".edit(70, ref foamMask).nl();
                changed |= "Thickness:".edit(70, ref thickness, 5, 300).nl();
                changed |= "Noise:".edit(50, ref noise, 0, 100).nl();
                changed |= "Upscale:".edit(50, ref upscale, 1, 64).nl();
                changed |= "Wet Area Height:".edit(50, ref wetAreaHeight, 0.1f, 10).nl();
                if (changed)
                {
                    SetFoamDynamics();
                    UnityHelperFunctions.RepaintViews();  // UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
                    this.SetToDirty();
                }
            }
            return(changed);
        }
コード例 #8
0
        public bool PEGI()
        {
            bool changed = false;

            int tmp = index;

            if ("Index".edit(ref tmp).nl())
            {
                changed = true;
                ChangeIndexTo(tmp);
            }

            changed |= "Emission Color".edit(ref ecol).nl();
            changed |= "Brightness".edit(ref brightness).nl();

            if (changed)
            {
                UnityHelperFunctions.RepaintViews();
            }

            return(changed);
        }
コード例 #9
0
ファイル: ISTD_Explorer.cs プロジェクト: QuteSaltyFish/Re-AB
        public bool Inspect <T>(ref T field) where T : UnityEngine.Object
        {
            bool changed = name.edit(100, ref field);

#if UNITY_EDITOR
            if (guid != null && icon.Search.Click("Find Object " + componentType + " by guid").nl())
            {
                var obj = UnityHelperFunctions.GUIDtoAsset <T>(guid);

                if (obj)
                {
                    field = obj;

                    if (componentType != null && componentType.Length > 0)
                    {
                        var go = obj as GameObject;
                        if (go)
                        {
                            var getScripts = go.GetComponent(componentType) as T;
                            if (getScripts)
                            {
                                field = getScripts;
                            }
                        }
                    }

                    changed = true;
                }
                else
                {
                    (typeof(T).ToString() + " Not found ").showNotification();
                }
            }
#endif


            return(changed);
        }
コード例 #10
0
ファイル: EDITOR_Inspectors.cs プロジェクト: belzecue/Tools
 public static void DisablePegi()
 {
     UnityHelperFunctions.SetDefine("PEGI", false);
     UnityHelperFunctions.SetDefine("NO_PEGI", true);
 }
コード例 #11
0
ファイル: SceneViewEditable.cs プロジェクト: belzecue/Tools
        public virtual void GridUpdate(SceneView sceneview)
        {
            if (!IsCurrentTool())
            {
                return;
            }


            Event e = Event.current;

            if (e.isMouse)
            {
                if (e.button != 0)
                {
                    return;
                }

                L_mouseDwn = (e.type == EventType.MouseDown) && (e.button == 0);
                L_mouseUp  = (e.type == EventType.MouseUp) && (e.button == 0);

                mousePosition = Event.current.mousePosition;

                if (Camera.current != null && (mousePosition.x < 0 || mousePosition.y < 0 ||
                                               mousePosition.x > Camera.current.pixelWidth ||
                                               mousePosition.y > Camera.current.pixelHeight))
                {
                    return;
                }

                rayGUI = HandleUtility.GUIPointToWorldRay(mousePosition);
                EditorInputManager.raySceneView = rayGUI;
            }

            FeedEvents(e);

            if (e.isMouse || (e.type == EventType.ScrollWheel))
            {
                EditorInputManager.feedMouseEvent(e);
            }

            if (e.isMouse)
            {
                RaycastHit hit;
                bool       ishit = Physics.Raycast(rayGUI, out hit);

                T pp = ishit ? hit.transform.GetComponent <T>() : null;

                bool refocus = OnEditorRayHit(hit, rayGUI);

                if ((L_mouseDwn) && (e.button == 0) && (refocus) && ishit)
                {
                    if ((pp != null) && (pp == painter) && (AllowEditing(painter)))
                    {
                        HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
                    }

                    UnityHelperFunctions.FocusOn(hit.transform.gameObject);
                }

                if ((!navigating) && AllowEditing(painter))
                {
                    e.Use();
                }
            }
        }
コード例 #12
0
        public override bool PEGI()
        {
            bool changed = base.PEGI();

            PainterCamera rtp   = PainterCamera.Inst;
            BrushConfig   brush = brushConfig;

            if (!PainterStuff.IsNowPlaytimeAndDisabled)
            {
                "Plugins".write_List(rtp.Plugins, ref rtp.browsedPlugin);


                if ("Find New Plugins".Click())
                {
                    rtp.RefreshPlugins();
                }

                if ("Clear Data".Click().nl())
                {
                    rtp.DeletePlugins();
                    rtp.RefreshPlugins();
                }
            }
            pegi.newLine();

            bool gotDefine = UnityHelperFunctions.GetDefine(enablePainterForBuild);

            if ("Enable Painter for Playtime & Build".toggle(ref gotDefine).nl())
            {
                UnityHelperFunctions.SetDefine(enablePainterForBuild, gotDefine);
            }

            if (gotDefine && "Enable PlayTime UI".toggle(ref enablePainterUIonPlay).nl())
            {
                MeshManager.Inst.DisconnectMesh();
            }

            if (!PainterStuff.IsNowPlaytimeAndDisabled)
            {
                if (Painter && Painter.meshEditing == false)
                {
                    if ("More options".toggle(80, ref moreOptions).nl())
                    {
                        showConfig = false;
                    }

                    "CPU blit repaint delay".nl("Delay for video memory update when painting to Texture2D", 140);

                    changed |= pegi.edit(ref brush.repaintDelay, 0.01f, 0.5f).nl();

                    changed |= "Don't update mipmaps:".toggle("May increase performance, but your changes may not disaplay if you are far from texture.", 150,
                                                              ref brush.DontRedoMipmaps).nl();

                    var id = Painter.ImgData;

                    if (id != null)
                    {
                        changed |= id.PEGI();
                    }

                    "Disable Non-Mesh Colliders in Play Mode:".toggle(ref disableNonMeshColliderInPlayMode).nl();
                }

                if ("Lists".foldout(ref inspectLists).nl())
                {
                    changed |= DatasPEGI();
                }

                "Teaching Notifications".toggle("will show whatever you ae pressing on the screen.", 140, ref ShowTeachingNotifications).nl();

                "Save Textures To:".edit(110, ref texturesFolderName).nl();

                "_Atlas Textures Sub folder".edit(150, ref atlasFolderName).nl();

                "Save Materials To:".edit(110, ref materialsFolderName).nl();

                "Save Meshes To:".edit(110, ref meshesFolderName).nl();
            }
#if UNITY_EDITOR
            if (icon.Discord.Click("Join Discord", 64))
            {
                PlaytimePainter.Open_Discord();
            }

            if (icon.Docs.Click("Open Asset Documentation", 64))
            {
                PlaytimePainter.OpenWWW_Documentation();
            }

            if (icon.Email.Click("Report a bug / send suggestion / ask question.", 64))
            {
                PlaytimePainter.Open_Email();
            }
#endif

            return(changed);
        }
コード例 #13
0
ファイル: PainterCamera.cs プロジェクト: belzecue/Tools
        // *******************  Component MGMT
        private void OnEnable()
        {
            PainterStuff.applicationIsQuitting = false;

            Inst = this;

            if (!Data)
            {
                dataHolder = Resources.Load("Painter_Data") as PainterDataAndConfig;
            }

            if (meshManager == null)
            {
                meshManager = new MeshManager();
            }

            meshManager.OnEnable();

            if (Data)
            {
                rtcam.cullingMask = 1 << Data.myLayer;
            }

            if (PlaytimeToolComponent.enabledTool == null)
            {
                if (!Application.isEditor)
                {
#if BUILD_WITH_PAINTER
                    PlaytimeToolComponent.enabledTool = typeof(PlaytimePainter);
#else
                    PlaytimeToolComponent.GetPrefs();
#endif
                }
                else
                {
                    PlaytimeToolComponent.GetPrefs();
                }
            }
#if UNITY_EDITOR
            EditorSceneManager.sceneSaving -= BeforeSceneSaved;
            EditorSceneManager.sceneSaving += BeforeSceneSaved;
            // Debug.Log("Adding scene saving delegate");
            EditorSceneManager.sceneOpening -= OnSceneOpening;
            EditorSceneManager.sceneOpening += OnSceneOpening;

            if (defaultMaterial == null)
            {
                defaultMaterial = AssetDatabase.GetBuiltinExtraResource <Material>("Default-Material.mat");
            }

            if (defaultMaterial == null)
            {
                Debug.Log("Default Material not found.");
            }

            isLinearColorSpace = UnityEditor.PlayerSettings.colorSpace == ColorSpace.Linear;

            EditorApplication.update -= CombinedUpdate;
            if (!this.ApplicationIsAboutToEnterPlayMode())
            {
                EditorApplication.update += CombinedUpdate;
            }


            if (brushPrefab == null)
            {
                GameObject go = Resources.Load("prefabs/RenderCameraBrush") as GameObject;
                brushPrefab = go.GetComponent <RenderBrush>();
                if (brushPrefab == null)
                {
                    Debug.Log("Couldn't find brush prefab.");
                }
            }

            if (Data)
            {
                UnityHelperFunctions.RenamingLayer(Data.myLayer, "Painter Layer");
            }
#endif

            if (brushRendy == null)
            {
                brushRendy = GetComponentInChildren <RenderBrush>();
                if (brushRendy == null)
                {
                    brushRendy = Instantiate(brushPrefab.gameObject).GetComponent <RenderBrush>();
                    brushRendy.transform.parent = this.transform;
                }
            }
            if (Data)
            {
                brushRendy.gameObject.layer = Data.myLayer;
            }

#if BUILD_WITH_PAINTER || UNITY_EDITOR
            transform.position = Vector3.up * 3000;
            if (rtcam == null)
            {
                rtcam = GetComponent <Camera>();
                if (rtcam == null)
                {
                    rtcam = gameObject.AddComponent <Camera>();
                }
            }

            rtcam.orthographic     = true;
            rtcam.orthographicSize = orthoSize;
            rtcam.clearFlags       = CameraClearFlags.Nothing;
            rtcam.enabled          = Application.isPlaying;

#if UNITY_EDITOR
            EditorApplication.update -= CombinedUpdate;
            if (EditorApplication.isPlayingOrWillChangePlaymode == false)
            {
                EditorApplication.update += CombinedUpdate;
            }
#endif

            UpdateBuffersState();
#endif

            autodisabledBufferTarget = null;

            RefreshPlugins();
        }
コード例 #14
0
ファイル: UndoRedo.cs プロジェクト: belzecue/Tools
 public void DestroyRtex()
 {
     UnityHelperFunctions.DestroyWhatever(rt);
 }
コード例 #15
0
 public void SetStuff()
 {
     Shader.SetGlobalVector("_lightControl", new Vector4(colorBleeding, 0, 0, eyeBrightness));
     UnityHelperFunctions.SetKeyword("MODIFY_BRIGHTNESS", modifyBrightness);
     UnityHelperFunctions.SetKeyword("COLOR_BLEED", colorBleed);
 }
コード例 #16
0
        public override bool ConfigTab_PEGI()
        {
            bool changed = false;

            changed |= "Bleed Colors".toggle(80, ref colorBleed).nl();

            if (colorBleed)
            {
                changed |= pegi.edit(ref colorBleeding, 0.0001f, 0.3f).nl();
            }

            changed |= "Brightness".toggle(80, ref modifyBrightness).nl();

            if (modifyBrightness)
            {
                changed |= pegi.edit(ref eyeBrightness, 0.0001f, 8f).nl();
            }

            pegi.toggle(ref showHint, icon.Close, icon.Hint, "Show hint", 35).nl();

            if (showHint)
            {
                "Is not a postrocess effect. It modifies Global Shader Parameter. Will only be visible on Custom shaders which containt the needed defines.".writeHint();
            }

            bool fog = RenderSettings.fog;

            if ("Fog".toggle(ref fog).nl())
            {
                RenderSettings.fog = fog;
            }

            if (fog)
            {
                var col = RenderSettings.fogColor;
                if ("Color".edit(ref col).nl())
                {
                    RenderSettings.fogColor = col;
                }
                var mode = RenderSettings.fogMode;
                if (mode != FogMode.ExponentialSquared)
                {
                    "Exponential Squared is recommended".writeHint();
                }
                if ("Mode".editEnum(ref mode).nl().nl())
                {
                    RenderSettings.fogMode = mode;
                }
                float density = RenderSettings.fogDensity;
                if ("Density".edit(60, ref density, 0f, 0.05f).nl())
                {
                    RenderSettings.fogDensity = density;
                }
            }



            if (changed)
            {
                UnityHelperFunctions.RepaintViews();
                SetStuff();
                this.SetToDirty();
            }
            return(changed);
        }
コード例 #17
0
            public bool PEGI(TextureSetForForCombinedMaps sets)
            {
                PlaytimePainter p = InspectedPainter;

                pegi.nl();

                currentPEGI = this;

                bool changed = "Name".edit(80, ref name);

                var path = PainterCamera.Data.texturesFolderName + "/" + folderName;

                if (icon.Save.Click("Will save to " + path, 25).nl())
                {
                    this.SaveToAssets(path, name);
                    UnityHelperFunctions.RefreshAssetDatabase();
                    (name + " was saved to " + path).showNotification();
                }
                pegi.newLine();

                changed |= "Color texture ".toggle(80, ref isColor).nl();

                bool usingBumpStrength  = false;
                bool usingColorSelector = false;
                bool usingGlossMap      = false;

                for (int c = 0; c < 4; c++)
                {
                    var ch = channel[c];
                    changed |= ((ColorChanel)c).getIcon().toggle(ref ch.enabled);

                    if (ch.enabled)
                    {
                        if ((ch.flip ? "inverted" : "+ 0").Click("Copy as is or invert (1-X)"))
                        {
                            ch.flip = !ch.flip;
                        }

                        changed |= ch.Nested_Inspect().nl();

                        usingBumpStrength  |= ch.Role.UsingBumpStrengthSlider(ch.sourceChannel);
                        usingColorSelector |= ch.Role.UsingColorSelector;
                        usingGlossMap      |= ch.Role.GetType() == typeof(TextureRole_Gloss);
                    }
                    pegi.nl();
                }



                if (usingBumpStrength)
                {
                    changed |= "Bump Strength".edit(ref bumpStrength).nl();
                }
                if (usingColorSelector)
                {
                    changed |= "Color".edit(ref fillColor).nl();
                }
                if (usingGlossMap)
                {
                    if (sets == null || sets.HeightMap != null)
                    {
                        if ("Gloss Mip -= Height Noise".toggle(ref glossNoiseFromHeight).nl())
                        {
                            changed            = true;
                            glossNoiseFromBump = false;
                        }
                    }

                    if ((sets == null || sets.NormalMap != null) && "Gloss Mip -= Normal Noise".toggle(ref glossNoiseFromBump).nl())
                    {
                        changed = true;
                        glossNoiseFromHeight = false;
                    }

                    if (glossNoiseFromHeight || glossNoiseFromBump)
                    {
                        "Fraction".edit(ref bumpNoiseInGlossFraction, 0f, 40f).nl();
                    }
                }


                if (sets != null)
                {
                    if ("Combine".Click().nl())
                    {
                        Combine(sets, p);
                    }

                    if (p != null)
                    {
                        "You will still need to press SAVE in Painter to update original texture.".writeHint();
                    }
                }

                return(changed);
            }