public virtual void UpdateMaterials() { materials.SetVolumeTexture(this); if (!setForGlobal) { return; } PositionAndScaleProperty.SetGlobal(PosSize4Shader); SlicesShadeProperty.SetGlobal(Slices4Shader); TextureInShaderProperty.SetGlobal(ImageMeta.CurrentTexture()); }
public virtual void UpdateMaterials() { materials.SetVolumeTexture(this); if (!setForGlobal) { return; } if (PositionAndScaleProperty.GlobalValue != PosSize4Shader) { // Debug.Log("Updating pos n shader during move " +Time.frameCount ); PositionAndScaleProperty.SetGlobal(PosSize4Shader); } SlicesShadeProperty.SetGlobal(Slices4Shader); TextureInShaderProperty.SetGlobal(ImageMeta.CurrentTexture()); }
public override bool Inspect() { var changed = false; pegi.toggleDefaultInspector(this); if (_textureInShaderr != null) { if (icon.Delete.Click()) { _textureInShaderr = null; } _textureInShaderr.GetNameForInspector().nl(); } if (searchedForPainter) { _painter = GetComponent <PlaytimePainter>(); } if (!_painter) { "Painter [None]".write(); if ("Search".Click()) { _painter = GetComponent <PlaytimePainter>(); } if (icon.Add.Click()) { _painter = GetComponent <PlaytimePainter>(); if (!_painter) { _painter = gameObject.AddComponent <PlaytimePainter>(); } } pegi.nl(); } else { if (_painter.gameObject != gameObject) { "Painter is on a different Game Object".writeWarning(); if ("Disconnect".Click()) { _painter = null; } } var mod = _painter.GetModule <VolumeTextureComponentModule>(); if (!mod.volumeTexture && "Assign volume texture to painter".Click().nl()) { mod.volumeTexture = this; } if (mod.volumeTexture) { if (mod.volumeTexture == this) { "This volume texture is attached".write(); } if (icon.UnLinked.Click("Unlink")) { mod.volumeTexture = null; } } pegi.nl(); } pegi.fullWindowDocumentationClickOpen(VolumeDocumentation); if (inspectedElement == -1) { "Also set for Global shader parameters".toggleIcon(ref setForGlobal).changes(ref changed); pegi.nl(); } if ("Volume Texture".enter(ref inspectedElement, 1).nl()) { var n = NameForPEGI; if ("Name".editDelayed(50, ref n).nl(ref changed)) { NameForPEGI = n; } if (setForGlobal) { "FOR GLOBAL ONLY:".nl(); PositionAndScaleProperty.NameForDisplayPEGI().write_ForCopy().nl(); SlicesShadeProperty.NameForDisplayPEGI().write_ForCopy().nl(); } var tex = ImageMeta.CurrentTexture(); if (tex == null) { ImageMeta = null; } if ("Texture".edit(60, ref tex).nl(ref changed)) { ImageMeta = tex ? tex.GetTextureMeta() : null; } "Volume Scale".edit(70, ref size).nl(ref changed); size = Mathf.Max(0.0001f, size); if (ImageMeta == null) { if (!TexturesPool.inst) { pegi.nl(); "Texture Width".edit(90, ref _tmpWidth).changes(ref changed); if ("Create Pool".Click().nl(ref changed)) { _tmpWidth = Mathf.ClosestPowerOfTwo(Mathf.Clamp(_tmpWidth, 128, 2048)); TexturesPool.GetOrCreateInstance.width = _tmpWidth; } } else { if ("Get From Pool".Click().nl(ref changed)) { ImageMeta = TexturesPool.inst.GetTexture2D().GetTextureMeta(); } TexturesPool.inst.Nested_Inspect().nl(); } } pegi.nl(); "Slices:".edit("How texture will be sliced for height", 80, ref hSlices, 1, 8).nl(ref changed); if (changed) { UpdateImageMeta(); } var w = Width; ("Will result in X:" + w + " Z:" + w + " Y:" + Height + "volume").nl(); } if ("Materials [{0}]".F(materials.Count).enter(ref inspectedElement, 2).nl_ifFoldedOut()) { "Materials".edit_List_UObj(ref materials, ref inspectedMaterial); if (inspectedMaterial == -1 && InspectedPainter) { var pMat = InspectedPainter.Material; if (pMat != null && materials.Contains(pMat) && "Remove This Material".Click().nl(ref changed)) { materials.Remove(pMat); } } } if (changed || icon.Refresh.Click("Update Materials")) { UpdateMaterials(); } pegi.nl(); return(changed); }