Skip to content

Commit

Permalink
remap to texture doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
piXelicidio committed Aug 11, 2023
1 parent 8b8ef70 commit b8204db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Code/Editor/PolyPaintWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ void OnGUI()
using (new EditorGUI.DisabledScope(!_paintingMode))
{
OnGUI_PaintingTools();
OnGUI_Remapping();
OnGUI_SavePaintedMesh();
OnGUI_Remapping();
}

EGL.EndScrollView();
Expand All @@ -241,13 +241,13 @@ private void OnGUI_Remapping()
{
EGL.Space();
GL.BeginVertical(EditorStyles.textArea);
var RemapClicked = GL.Button("Remmap to texture in...");
var RemapClicked = GL.Button("Remap to texture in...");
_remapMaterial = (Material) EGL.ObjectField("Target Material", _remapMaterial, typeof(Material), true);
_autoSwitchMaterial = EGL.ToggleLeft("Switch Material after remap", _autoSwitchMaterial);

if (RemapClicked)
{
bool ok = TryRemmapingTo(_remapMaterial, out var tex2d, _autoSwitchMaterial);
bool ok = TryRemappingTo(_remapMaterial, out var tex2d, _autoSwitchMaterial);
if (ok && _autoSwitchMaterial)
{
if (_targetObject.TryGetComponent<Renderer>(out var r))
Expand All @@ -263,7 +263,7 @@ private void OnGUI_Remapping()
}


private bool TryRemmapingTo(Material remapMaterial, out Texture2D tex2d, bool switchTexure = false)
private bool TryRemappingTo(Material remapMaterial, out Texture2D tex2d, bool switchTexure = false)
{
tex2d = null;
if (_remapMaterial == null) return false;
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ This allows you to sample colors directly from the 3D object surface.

Mirrors the current tool cursor along a selected axis.

## Utilities
### Remap To Texture
Easily switch between color palettes without disrupting your UV mapping. This feature analyzes a new texture and reassigns UVs to the most similar colors, allowing for seamless transitions between palettes and optimization across multiple models. Ideal for low-poly art creation and texture consolidation.

## Requirements and Compatibility <a name="requirements-and-compatibility"></a>
- A mesh with a Mesh Filter or Skinned Mesh Renderer component.
- A material with a diffuse texture assigned. (This will act as palette color)
Expand All @@ -81,4 +85,7 @@ Digging DA Poly Paint? Keep the colors flowing by snagging my low-poly character

Check out: [City People Mega-Pack](https://assetstore.unity.com/packages/3d/characters/city-people-mega-pack-203329)

Your support helps paint a vibrant future for everyone. 🎨🌈
Your support helps paint a vibrant future for everyone. 🎨🌈

## Help & Support
| [PolyChat forum](https://github.com/piXelicidio/PolyChat/discussions/categories/scripted-tools) | [direct e-mail](mailto:denys.almaral@gmail.com) |

0 comments on commit b8204db

Please sign in to comment.