public virtual bool Inspect() { var p = PlaytimePainter.inspected; if (!p) { "No Painter Detected".nl(); return(false); } var id = p.TexMeta; var changed = false; var cpuBlit = id.target == TexTarget.Texture2D; if (id.texture2D) { if ((cpuBlit ? icon.CPU : icon.GPU).Click(cpuBlit ? "Switch to Render Texture" : "Switch to Texture2D", ref changed, 45)) { cpuBlit = !cpuBlit; if (!cpuBlit && !PainterCamera.GotBuffers) { RenderTextureBuffersManager.RefreshPaintingBuffers(); } p.UpdateOrSetTexTarget(cpuBlit ? TexTarget.Texture2D : TexTarget.RenderTexture); SetSupportedFor(cpuBlit, !id.renderTexture); } } if (cpuBlit) { var smooth = _brushType(cpuBlit) != BrushTypes.Pixel.Inst.index; if (pegi.toggle(ref smooth, icon.Round, icon.Square, "Smooth/Pixels Brush", 45).changes(ref changed)) { SetBrushType(cpuBlit, smooth ? BrushTypes.Normal.Inst : BrushTypes.Pixel.Inst.AsBase); } } pegi.nl(); if (showBrushDynamics) { if ("Brush Dynamic".selectType(90, ref brushDynamic, brushDynamicsConfigs).nl(ref changed)) { brushDynamic?.Nested_Inspect().nl(ref changed); } } else if (brushDynamic.GetType() != typeof(BrushDynamic.None)) { brushDynamic = (BrushDynamic.None)Activator.CreateInstance(typeof(BrushDynamic.None)); } if (Mode_Type_PEGI().changes(ref changed) && GetBrushType(cpuBlit) == BrushTypes.Decal.Inst) { MaskSet(ColorMask.A, true); } if (p.terrain) { if (p.TexMeta != null && p.IsTerrainHeightTexture && p.NotUsingPreview) { "Preview Shader is needed to see changes to terrain height.".writeWarning(); } pegi.nl(); if (p.terrain && "Update Terrain".Click("Will Set Terrain texture as global shader values.").nl()) { p.UpdateModules(); } } return(changed); }
public virtual bool Inspect() { var p = PlaytimePainter.inspected; if (!p) { "No Painter Detected".nl(); return false; } pegi.nl(); if (p.skinnedMeshRenderer) { if ("Update Collider from Skinned Mesh".Click()) p.UpdateMeshCollider(); if (DocsEnabled && pegi.DocumentationClick("Why Update Collider from skinned mesh?")) pegi.FullWindwDocumentationOpen( ("To paint an object a collision detection is needed. Mesh Collider is not being animated. To paint it, update Mesh Collider with Update Collider button." + " For ingame painting it is preferable to use simple colliders like Speheres to avoid per frame updates for collider mesh." )); pegi.nl(); } var id = p.TexMeta; var changed = false; var cpuBlit = id.destination == TexTarget.Texture2D; p.PreviewShaderToggleInspect().changes(ref changed); if (!PainterCamera.GotBuffers && icon.Refresh.Click("Refresh Main Camera Buffers")) RenderTextureBuffersManager.RefreshPaintingBuffers(); if ((PainterCamera.GotBuffers || id.renderTexture) && id.texture2D) { if ((cpuBlit ? icon.CPU : icon.GPU).Click( cpuBlit ? "Switch to Render Texture" : "Switch to Texture2D", ref changed ,45)) { p.UpdateOrSetTexTarget(cpuBlit ? TexTarget.RenderTexture : TexTarget.Texture2D); SetSupportedFor(cpuBlit, !id.renderTexture); } } if (cpuBlit) { var smooth = _brushType(cpuBlit) != BrushTypes.Pixel.Inst.index; if (pegi.toggle(ref smooth, icon.Round, icon.Square, "Smooth/Pixels Brush", 45).changes(ref changed)) SetBrushType(cpuBlit, smooth ? BrushTypes.Normal.Inst : BrushTypes.Pixel.Inst.AsBase); } pegi.nl(); if (showBrushDynamics) { if ("Brush Dynamic".selectType( 90, ref brushDynamic, brushDynamicsConfigs, true).nl(ref changed)) brushDynamic?.Nested_Inspect().nl(ref changed); } else if (brushDynamic.GetType() != typeof(BrushDynamic.None)) brushDynamic = (BrushDynamic.None)Activator.CreateInstance(typeof(BrushDynamic.None)); #if UNITY_EDITOR #if !UNITY_2019_1_OR_NEWER if ( Tools.current != Tool.None ) { MsgPainter.LockToolToUseTransform.GetText().writeWarning(); if (MsgPainter.HideTransformTool.GetText().Click().nl()) QcUnity.HideUnityTool(); } #endif #endif if (Mode_Type_PEGI().changes(ref changed) && GetBrushType(cpuBlit) == BrushTypes.Decal.Inst) MaskSet(ColorMask.A, true); if (p.terrain) { if (p.TexMeta != null && p.IsTerrainHeightTexture && p.NotUsingPreview) "Preview Shader is needed to see changes to terrain height.".writeWarning(); pegi.nl(); if (p.terrain && "Update Terrain".Click("Will Set Terrain texture as global shader values.").nl()) p.UpdateShaderGlobals(); } return changed; }