Skip to content
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

Fix #2213 custom uvmap on point domain #2238

Merged
merged 1 commit into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -429,17 +429,33 @@ def manage_material_info(self):
for attr in self.uvmap_attribute_list:
if attr + str(0) not in self.dots.dtype.names: # In case user exports custom attributes, we may have it already
# Vector in custom Attributes are Vector2 or Vector3 (but keeping only the first two data)
if self.blender_mesh.attributes[attr].data_type == "FLOAT_VECTOR":
data = np.empty(len(self.blender_mesh.loops) * 3, gltf2_blender_conversion.get_numpy_type('FLOAT2'))
self.blender_mesh.attributes[attr].data.foreach_get('vector', data)
data = data.reshape(-1, 3)
data = data[:,:2]
elif self.blender_mesh.attributes[attr].data_type == "FLOAT2":
data = np.empty(len(self.blender_mesh.loops) * 2, gltf2_blender_conversion.get_numpy_type('FLOAT2'))
self.blender_mesh.attributes[attr].data.foreach_get('vector', data)
data = data.reshape(-1, 2)
if self.blender_mesh.attributes[attr].domain == "CORNER":
if self.blender_mesh.attributes[attr].data_type == "FLOAT_VECTOR":
data = np.empty(len(self.blender_mesh.loops) * 3, gltf2_blender_conversion.get_numpy_type('FLOAT2'))
self.blender_mesh.attributes[attr].data.foreach_get('vector', data)
data = data.reshape(-1, 3)
data = data[:,:2]
elif self.blender_mesh.attributes[attr].data_type == "FLOAT2":
data = np.empty(len(self.blender_mesh.loops) * 2, gltf2_blender_conversion.get_numpy_type('FLOAT2'))
self.blender_mesh.attributes[attr].data.foreach_get('vector', data)
data = data.reshape(-1, 2)
else:
self.export_settings['log'].warning('We are not managing this case (UVMap as custom attribute for unknown type)')
continue
elif self.blender_mesh.attributes[attr].domain == "POINT":
if self.blender_mesh.attributes[attr].data_type == "FLOAT_VECTOR":
data = np.empty(len(self.blender_mesh.vertices) * 3, gltf2_blender_conversion.get_numpy_type('FLOAT2'))
self.blender_mesh.attributes[attr].data.foreach_get('vector', data)
data = data.reshape(-1, 3)
data = data[:,:2]
data = data[self.dots['vertex_index']]
elif self.blender_mesh.attributes[attr].data_type == "FLOAT2":
data = np.empty(len(self.blender_mesh.vertices) * 2, gltf2_blender_conversion.get_numpy_type('FLOAT2'))
self.blender_mesh.attributes[attr].data.foreach_get('vector', data)
data = data.reshape(-1, 2)
data = data[self.dots['vertex_index']]
else:
self.export_settings['log'].warning('We are not managing this case (UVMap as custom attribute for unknown type)')
self.export_settings['log'].warning('We are not managing this case (UVMap as custom attribute for unknown domain)')
continue
# Blender UV space -> glTF UV space
# u,v -> u,1-v
Expand Down
Loading