Skip to content

Commit fc15255

Browse files
committed
docs: adds migration guide for render_world only mesh change
1 parent 36e748e commit fc15255

File tree

1 file changed

+125
-0
lines changed

1 file changed

+125
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
title: "Use `Mesh::try_* mesh` functions for `Assets<Mesh>` entries when there can be `RenderAssetUsages::RENDER_WORLD`-only meshes."
3+
pull_requests: [21732]
4+
---
5+
6+
Previously, the `Assets<Mesh>` resource would not retain `RenderAssetUsages::RENDER_WORLD`-only
7+
meshes once their data was extracted.
8+
9+
In 0.18, `Assets<Mesh>` retains `RenderAssetUsages::RENDER_WORLD`-only meshes, even after their data
10+
is extracted. To handle such meshes, `Mesh` now contains `Mesh::try_*` functions which return a
11+
`Result<..., MeshAccessError>`. These functions return an
12+
`Err(MeshAccessError,ExtractedToRenderWorld)` when the mesh has already been extracted.
13+
14+
If `Assets<Mesh>` can contain `RenderAssetUsages::RENDER_WORLD`-only meshes, the following `Mesh`
15+
functions should be changed to their `try_*` equivalent and handled appropriately:
16+
17+
```rust
18+
// assets: Res<'w, Assets<Mesh>>
19+
let mesh = assets.get(some_mesh_handle) // or assets.get_mut(some_mesh_handle)
20+
21+
// 0.17
22+
mesh.insert_attribute(...)
23+
mesh.with_inserted_attribute(...)
24+
mesh.remove_attribute(...)
25+
mesh.with_removed_attribute(...)
26+
mesh.contains_attribute(...)
27+
mesh.attribute(...)
28+
mesh.attribute_mut(...)
29+
mesh.attributes(...)
30+
mesh.attributes_mut(...)
31+
mesh.insert_indices(...)
32+
mesh.with_inserted_indices(...)
33+
mesh.indices(...)
34+
mesh.indices_mut(...)
35+
mesh.remove_indices(...)
36+
mesh.with_removed_indices(...)
37+
mesh.duplicate_vertices(...)
38+
mesh.with_duplicated_vertices(...)
39+
mesh.compute_normals(...)
40+
mesh.compute_flat_normals(...)
41+
mesh.compute_smooth_normals(...)
42+
mesh.compute_area_weighted_normals(...)
43+
mesh.compute_custom_smooth_normals(...)
44+
mesh.with_computed_normals(...)
45+
mesh.with_computed_flat_normals(...)
46+
mesh.with_computed_smooth_normals(...)
47+
mesh.with_computed_area_weighted_normals(...)
48+
mesh.with_custom_smooth_normals(...)
49+
mesh.transformed_by(...)
50+
mesh.transform_by(...)
51+
mesh.translated_by(...)
52+
mesh.translate_by(...)
53+
mesh.rotated_by(...)
54+
mesh.rotate_by(...)
55+
mesh.scaled_by(...)
56+
mesh.scale_by(...)
57+
mesh.normalize_joint_weights(...)
58+
// when feature = morph enabled
59+
mesh.has_morph_targets(...)
60+
mesh.set_morph_targets(...)
61+
mesh.morph_targets(...)
62+
mesh.with_morph_targets(...)
63+
mesh.set_morph_target_names(...)
64+
mesh.with_morph_target_names(...)
65+
mesh.morph_target_names(...)
66+
67+
// 0.18
68+
mesh.try_insert_attribute(...)
69+
mesh.try_with_inserted_attribute(...)
70+
mesh.try_remove_attribute(...)
71+
mesh.try_contains_attribute(...)
72+
mesh.try_with_removed_attribute(...)
73+
mesh.try_attribute_option(...) // or mesh.try_attribute(...)
74+
mesh.try_attribute_mut_option(...) // or mesh.try_attribute_mut(...)
75+
mesh.try_attributes(...)
76+
mesh.try_attributes_mut(...)
77+
mesh.try_insert_indices(...)
78+
mesh.try_with_inserted_indices(...)
79+
mesh.try_indices_option(...) // or mesh.try_indices(...)
80+
mesh.try_indices_mut_option(...) // or mesh.try_indices_mut(...)
81+
mesh.try_remove_indices(...)
82+
mesh.try_with_removed_indices(...)
83+
mesh.try_duplicate_vertices(...)
84+
mesh.try_with_duplicated_vertices(...)
85+
mesh.try_compute_normals(...)
86+
mesh.try_compute_flat_normals(...)
87+
mesh.try_compute_smooth_normals(...)
88+
mesh.try_compute_area_weighted_normals(...)
89+
mesh.try_compute_custom_smooth_normals(...)
90+
mesh.try_with_computed_normals(...)
91+
mesh.try_with_computed_flat_normals(...)
92+
mesh.try_with_computed_smooth_normals(...)
93+
mesh.try_with_computed_area_weighted_normals(...)
94+
mesh.try_with_custom_smooth_normals(...)
95+
mesh.try_transformed_by(...)
96+
mesh.try_transform_by(...)
97+
mesh.try_translated_by(...)
98+
mesh.try_translate_by(...)
99+
mesh.try_rotated_by(...)
100+
mesh.try_rotate_by(...)
101+
mesh.try_scaled_by(...)
102+
mesh.try_scale_by(...)
103+
mesh.try_normalize_joint_weights(...)
104+
// when feature = morph enabled
105+
mesh.try_has_morph_targets(...)
106+
mesh.try_set_morph_targets(...)
107+
mesh.try_morph_targets(...)
108+
mesh.try_with_morph_targets(...)
109+
mesh.try_set_morph_target_names(...)
110+
mesh.try_with_morph_target_names(...)
111+
mesh.try_morph_target_names(...)
112+
// the following functions do not have a try_ equivalent, but now panic if
113+
// the mesh data has been extracted to `RenderWorld`.
114+
mesh.get_vertex_size(...)
115+
mesh.get_vertex_buffer_size(...)
116+
mesh.get_index_buffer_bytes(...)
117+
mesh.get_mesh_vertex_buffer_layout(...)
118+
mesh.count_vertices(...)
119+
mesh.create_packed_vertex_buffer_data(...)
120+
mesh.write_packed_vertex_buffer_data(...)
121+
```
122+
123+
If the calls to `Mesh` functions (under the 0.17 section) are left unchanged after upgrading to 0.18,
124+
they will now panic if the mesh is a `RenderAssetUsages::RENDER_WORLD`-only mesh that has been
125+
extracted to the render world.

0 commit comments

Comments
 (0)