Exemple #1
0
        public bool Inspect()
        {
            var changed = false;

            if (inspectedElement == -1)
            {
                var tmp = index;
                if ("Index".edit(ref tmp).nl(ref changed))
                {
                    ChangeIndexTo(tmp);
                }

                "Shake".edit(50, ref camShake, 0, 0.001f).nl();

                "Emission Color".edit(ref ecol).nl(ref changed);
                "Brightness".edit(ref brightness).nl(ref changed);
                if (!emissiveMesh)
                {
                    "Emissive Mesh".edit(ref emissiveMesh).nl(ref changed);
                }
            }

            if ("Projection".enter(ref inspectedElement, 1).nl())
            {
                cameraConfiguration.Nested_Inspect().nl(ref changed);
            }

            if (inspectedElement == -1 && cameraConfiguration.nearPlane < 5 && "Increase near plane to 5".Click())
            {
                cameraConfiguration.nearPlane = 5;
            }


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

            return(changed);
        }
        public bool BrushConfigPEGI(ref bool overrideBlitMode, BrushConfig br)
        {
            var changed = false;

            var p = InspectedPainter;

            var volTex = p.GetVolumeTexture();

            if (volTex)
            {
                overrideBlitMode = true;

                var id = p.ImgMeta;

                if (BrushConfig.showAdvanced)
                {
                    "Grid".toggle(50, ref _useGrid).nl();
                }

                var cpuBlit = id.TargetIsTexture2D().nl();

                br.showingSize = !_enableRayTracing || cpuBlit;


                if (!cpuBlit)
                {
                    if (BrushConfig.showAdvanced || _enableRayTracing)
                    {
                        "Ray-Tracing".toggleIcon(ref _enableRayTracing, true).changes(ref changed);

                        if (br.useAlphaBuffer)
                        {
                            icon.Warning.write(
                                "Ray Tracing doesn't use Alpha buffer. Alpha buffer will be automatically disabled");
                        }
                    }

                    if ("Ray Trace Camera".conditional_enter(_enableRayTracing && PainterCamera.depthProjectorCamera,
                                                             ref _exploreRayTaceCamera).nl_ifFoldedOut())
                    {
                        "Min".edit(40, ref minFov, 60, maxFov - 1).nl(ref changed);

                        "Max".edit(40, ref maxFov, minFov + 1, 170).nl(ref changed);

                        rayTraceCameraConfiguration.Nested_Inspect().nl(ref changed);
                    }



                    if (_enableRayTracing && BrushConfig.showAdvanced)
                    {
                        pegi.nl();
                        // "Bounced brightness mltpl".edit(ref arbitraryBrightnessIncrease, 1, 2).changes(ref changed);

                        //"A completely arbitrary value that increases the amount of bounced light. Used to utilize the full 0-1 range of the texture for increased percision"
                        //  .fullWindowDocumentationClick();

                        pegi.nl();
                    }

                    if (!_exploreRayTaceCamera && _enableRayTracing)
                    {
                        var dp = PainterCamera.depthProjectorCamera;

                        if (!dp)
                        {
                            if ("Create Projector Camera".Click().nl())
                            {
                                PainterCamera.GetProjectorCamera();
                            }
                        }
                        else if (dp.pauseAutoUpdates)
                        {
                            pegi.nl();
                            "Light Projectors paused".toggleIcon(ref dp.pauseAutoUpdates).nl(ref changed);
                        }

                        pegi.nl();
                    }
                }

                if (cpuBlit)
                {
                    /*if (_enableRayTracing)
                     *  icon.Warning.write("CPU Brush is slow for volumes");*/
                }
                else
                {
                    pegi.nl();

                    if (!br.GetBrushType(false).IsAWorldSpaceBrush)
                    {
                        "Only World space brush can edit volumes".writeHint();
                        pegi.nl();
                        if ("Change to Sphere brush".Click())
                        {
                            br.SetBrushType(false, BrushTypeSphere.Inst);
                        }
                    }
                }

                pegi.nl();


                if (!_exploreRayTaceCamera && PainterCamera.Data.showVolumeDetailsInPainter && (volTex.name + " " + VolumeEditingExtensions.VolumeSize(id.texture2D, volTex.hSlices)).foldout(ref _exploreVolumeData).nl())
                {
                    volTex.Nested_Inspect().changes(ref changed);
                }

                if (volTex.NeedsToManageMaterials)
                {
                    var painterMaterial = InspectedPainter.Material;
                    if (painterMaterial != null)
                    {
                        if (!volTex.materials.Contains(painterMaterial))
                        {
                            if ("Add This Material".Click().nl())
                            {
                                volTex.AddIfNew(p);
                            }
                        }
                    }
                }

                if (!cpuBlit)
                {
                    MsgPainter.Hardness.GetText().edit(MsgPainter.Hardness.GetDescription(), 70, ref br.hardness, 1f, 22f).nl(ref changed);
                }

                var tmpSpeed = br._dSpeed.value;
                if (MsgPainter.Speed.GetText().edit(40, ref tmpSpeed, 0.01f, 4.5f).nl(ref changed))
                {
                    br._dSpeed.value = tmpSpeed;
                }


                if (br.showingSize)
                {
                    var maxScale = volTex.size * volTex.Width * 4;

                    "Scale:".edit(40, ref br.brush3DRadius, 0.001f * maxScale, maxScale * 0.5f).changes(ref changed);

                    if (cpuBlit && !_brushShaderFroRayTrace && br.brush3DRadius > BrushScaleMaxForCpu(volTex))
                    {
                        icon.Warning.write(
                            "Size will be reduced when panting due to low performance of the CPU brush for volumes");
                    }
                }

                pegi.nl();

                /*
                 * if (br.GetBlitMode(cpuBlit).UsingSourceTexture && id.TargetIsRenderTexture())
                 * {
                 *  if (TexMGMTdata.sourceTextures.Count > 0)
                 *  {
                 *      "Copy From:".write(70);
                 *      changed |= pegi.selectOrAdd(ref br.selectedSourceTexture, ref TexMGMTdata.sourceTextures);
                 *  }
                 *  else
                 *      "Add Textures to Render Camera to copy from".nl();
                 * }*/
            }
            if (changed)
            {
                this.SetToDirty_Obj();
            }

            return(changed);
        }