Skip to content

Preserve UV Maps #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: v3-dev
Choose a base branch
from
Open

Preserve UV Maps #293

wants to merge 13 commits into from

Conversation

bimgeek
Copy link
Contributor

@bimgeek bimgeek commented Jul 13, 2025

DO NOT MERGE BEFORE #290

This PR adds UV mapping preservation functionality.

  • Added store_uv_mappings() function to capture UV layer data before object deletion
  • Added restore_uv_mappings() function to apply stored UV data to newly loaded objects
  • UV data includes layer names, coordinates, and active layer settings
  • Data is serialized as JSON and stored in property groups
blender.uv.mapping.mp4

@bimgeek bimgeek requested a review from dogukankaratas July 13, 2025 16:28
@bimgeek bimgeek marked this pull request as ready for review July 13, 2025 16:30
# First, collect UV mapping data from property groups before they are cleared
uv_mapping_data = {}
for s_obj in model_card.objects:
if s_obj.uv_data_serialized: # Only process objects that have UV data stored
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question... why do serialise and store the uvs to the model card.
Are the original meshes not still in the file, can we pull the UVs from them?

# Restore UV coordinates
expected_coords = len(mesh.loops) * 2 # 2 coords per loop

if len(uv_coords) == expected_coords:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the number of loops on the new mesh is different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants