public string GetString() { if (TextureId == 0 && NormalId == 0) { return($" {VertexId}"); } return($" {VertexId}/{(TextureId != 0 ? TextureId.ToString() : "")}/{(NormalId != 0 ? NormalId.ToString() : "")}"); }
private void ReadBinaryData(FileReader reader) { Width = reader.ReadUInt16(); Height = reader.ReadUInt16(); unknown1 = reader.ReadUInt32(); CompSel = reader.ReadUInt32(); MipCount = reader.ReadUInt32(); unknown2 = reader.ReadUInt32(); TileMode = reader.ReadUInt32(); unknown3 = reader.ReadUInt32(); ImageSize = reader.ReadUInt32(); unknown4 = reader.ReadUInt32(); TextureId = reader.ReadUInt32(); Text = TextureId.ToString("X8"); SurfFormat = reader.ReadEnum <SurfaceFormat>(false); unknown5 = reader.ReadByte(); unknown6 = reader.ReadInt16(); unknown7 = reader.ReadUInt32(); }
public virtual bool Inspect() { if (!PainterCamera.Inst) { "No Painter Camera found".writeWarning(); if ("Refresh".Click()) { PainterSystem.applicationIsQuitting = false; } return(false); } ("Works with PaintWithoutComponent script. This lets you configure how painting will be received." + " PaintWithoutComponent.cs is usually attached to a main camera (if painting in first person). Current Texture: " + TextureId.ToString()) .fullWindowDocumentationClickOpen("About Painting Receiver"); var changes = false; if (icon.Refresh.Click("Find Components automatically")) { Refresh(); } if ("Renderer GetBrushType:".editEnum(90, ref type).nl()) { if (type == RendererType.Skinned && !skinnedMeshRenderer) { skinnedMeshRenderer = GetComponentInChildren <SkinnedMeshRenderer>(); } if (type == RendererType.Regular && !meshFilter) { meshFilter = GetComponent <MeshFilter>(); meshRenderer = GetComponent <MeshRenderer>(); } } switch (type) { case RendererType.Skinned: " Skinned Mesh Renderer".edit(90, ref skinnedMeshRenderer).nl(ref changes); break; case RendererType.Regular: " Mesh Filter".edit(90, ref meshFilter).nl(ref changes); " Renderer".edit(90, ref meshRenderer).nl(ref changes); break; } var r = Renderer; if ((r && r.sharedMaterials.Length > 1) || materialIndex != 0) { " Material".select_Index(80, ref materialIndex, r.sharedMaterials).nl(); } if (Material) { var lst = Material.MyGetTextureProperties_Editor(); if (" Property".select(80, ref _textureProperty, lst).nl()) { TexturePropertyName = _textureProperty.NameForDisplayPEGI(); } } if (gameObject.isStatic && !originalMesh) { "For STATIC Game Objects original mesh is needed:".writeHint(); pegi.nl(); if (meshFilter && icon.Search.Click("Find mesh")) { originalMesh = meshFilter.sharedMesh; } } if (gameObject.isStatic) { " Original Mesh".edit("Static objects use Combined mesh, so original one will be needed for painting", 50, ref originalMesh).nl(); } if (" Use second texture coordinates".toggleIcon("If shader uses texcoord2 (Baked Light) to display damage, turn this ON.", ref useTexcoord2).nl() && texture) { texture.GetTextureMeta().useTexCoord2 = useTexcoord2; } if (Material) { if (!Material.Has(TextureId) && !Material.mainTexture) { "No Material Property Selected and no MainTex on Material".nl(); } else { var current = Material.Get(TextureId); if (current) { } if (texture) { var t2D = texture as Texture2D; if (t2D) { icon.Done.write(); "CPU brush will work if object has MeshCollider".nl(); if (originalTexture) { var ot2D = originalTexture as Texture2D; if (ot2D) { if ((ot2D.width == t2D.width) && (ot2D.height == t2D.height)) { if (("Undo Changes".Click()).nl()) { Restore(); } } else { "Original and edited texture are not of the same size".nl(); } } else { "Original Texture is not a Texture 2D".nl(); } } } else { if (Renderer) { icon.Done.write(); "Will paint if object has any collider".nl(); if (skinnedMeshRenderer) { "Colliders should be placed close to actual mesh".nl(); "Otherwise brush size may be too small to reach the mesh".nl(); } } else { "Render Texture Painting needs Skinned Mesh or Mesh Filter to work".nl(); } if ((originalTexture) && ("Undo Changes".Click().nl())) { Restore(); } } } else { var rtm = TexturesPool.inst; if (rtm) { "Render Texture Pool will be used to get texture".nl(); if (!Renderer) { "! Renderer needs to be Assigned.".nl(); } else { icon.Done.write(); "COMPONENT SET UP CORRECTLY".write(); if (fromRtManager && "Restore".Click()) { Restore(); } pegi.nl(); } } else { "No Render Texture Pool found".write(); if ("Create".Click().nl()) { (TexturesPool.GetOrCreateInstance.gameObject.name + " created").showNotificationIn3D_Views(); } } } } } else { "No material found".nl(); } if ("Advanced".foldout(ref _showOptional).nl()) { if (texture || !MatTex) { "Start Texture:".edit("Copy of this texture will be modified.", 110, ref originalTexture).nl(ref changes); } "Target Texture".edit("If not using Render Textures Pool", 120, ref texture); if (Renderer && Material && "Find".Click().nl()) { texture = MatTex; } if (!texture || texture.GetType() == typeof(RenderTexture)) { "Mesh UV Offset".edit("Some Meshes have UV coordinates with displacement for some reason. " + "If your object doesn't use a mesh collider to provide a UV offset, this will be used.", 80, ref meshUvOffset).nl(); if (Mesh && "Offset from Mesh".Click().nl()) { var firstVertInSubmeshIndex = Mesh.GetTriangles(materialIndex)[0]; meshUvOffset = useTexcoord2 ? Mesh.uv2[firstVertInSubmeshIndex] : Mesh.uv[firstVertInSubmeshIndex]; meshUvOffset = new Vector2((int)meshUvOffset.x, (int)meshUvOffset.y); ("Mesh Offset is " + meshUvOffset.ToString()).showNotificationIn3D_Views(); } } } return(changes); }