chore: checkpoint web Blender migration source, tools and docs
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-10 11:18:01 +08:00
parent 122142c26c
commit f3e21c6b98
6887 changed files with 257154 additions and 12294 deletions

View File

@@ -231,6 +231,45 @@ static bool mesh_attribute_valid(const Mesh &mesh,
return true;
}
/* UV consumers bind these roles by name, independently of the attribute's
* storage. Keep all roles attached to the same layer in object and edit mode. */
static void mesh_uv_map_rename_references(Mesh &mesh,
const StringRef old_name,
const StringRef new_name)
{
const bool active = old_name == mesh.active_uv_map_name();
const bool render = old_name == mesh.default_uv_map_name();
const bool stencil = old_name == StringRef(mesh.stencil_uv_map_attribute);
const bool clone = old_name == StringRef(mesh.clone_uv_map_attribute);
if (active) {
mesh.uv_maps_active_set(new_name);
}
if (render) {
mesh.uv_maps_default_set(new_name);
}
if (stencil) {
MEM_SAFE_DELETE(mesh.stencil_uv_map_attribute);
mesh.stencil_uv_map_attribute = BLI_strdupn(new_name.data(), new_name.size());
}
if (clone) {
MEM_SAFE_DELETE(mesh.clone_uv_map_attribute);
mesh.clone_uv_map_attribute = BLI_strdupn(new_name.data(), new_name.size());
}
}
static void mesh_uv_map_remove_references(Mesh &mesh, const StringRef name)
{
if (name == StringRef(mesh.stencil_uv_map_attribute)) {
MEM_SAFE_DELETE(mesh.stencil_uv_map_attribute);
}
if (name == StringRef(mesh.clone_uv_map_attribute)) {
MEM_SAFE_DELETE(mesh.clone_uv_map_attribute);
}
/* Removal and same-name recreation can happen between draws. A name/layout
* comparison alone cannot observe that transition, so invalidate at mutation. */
BKE_mesh_batch_cache_dirty_tag(&mesh, BKE_MESH_BATCH_DIRTY_UVEDIT_ALL);
}
bool BKE_attribute_rename(AttributeOwner &owner,
const StringRef old_name,
const StringRef new_name,
@@ -291,7 +330,15 @@ bool BKE_attribute_rename(AttributeOwner &owner,
BKE_id_attributes_default_color_set(&mesh->id, result_name);
}
const bool is_uv_map = attr.domain == AttrDomain::Corner &&
attr.type == bke::AttrType::Float2;
if (is_uv_map) {
mesh_uv_map_rename_references(*mesh, old_name, result_name);
}
StringRef(result_name).copy_utf8_truncated(const_cast<CustomDataLayer *>(attr.layer)->name);
if (is_uv_map) {
BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_UVEDIT_ALL);
}
return true;
}
@@ -336,11 +383,9 @@ bool BKE_attribute_rename(AttributeOwner &owner,
if (old_name == BKE_id_attributes_default_color_name(&mesh->id)) {
BKE_id_attributes_default_color_set(&mesh->id, new_name);
}
if (old_name == mesh->active_uv_map_name()) {
mesh->uv_maps_active_set(new_name);
}
if (old_name == mesh->default_uv_map_name()) {
mesh->uv_maps_default_set(new_name);
if (attr->domain() == AttrDomain::Corner && attr->data_type() == bke::AttrType::Float2) {
mesh_uv_map_rename_references(*mesh, old_name, new_name);
BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_UVEDIT_ALL);
}
}
@@ -418,6 +463,9 @@ CustomDataLayer *BKE_attribute_new(Mesh &mesh,
return nullptr;
}
BM_data_layer_add_named(&bm, customdata, type, uniquename.c_str());
if (type == CD_PROP_FLOAT2 && domain == AttrDomain::Corner) {
BKE_mesh_batch_cache_dirty_tag(&mesh, BKE_MESH_BATCH_DIRTY_UVEDIT_ALL);
}
const int index = CustomData_get_named_layer_index(customdata, type, uniquename);
return (index == -1) ? nullptr : &(customdata->layers[index]);
}
@@ -522,6 +570,7 @@ bool BKE_attribute_remove(AttributeOwner &owner, const StringRef name, ReportLis
if (type == CD_PROP_FLOAT2 && domain == int(AttrDomain::Corner)) {
char buffer[MAX_CUSTOMDATA_LAYER_NAME];
BM_data_layer_free_named(em->bm, data, BKE_uv_map_pin_name_get(name_copy, buffer));
mesh_uv_map_remove_references(*mesh, name_copy);
}
return true;
}
@@ -575,6 +624,7 @@ bool BKE_attribute_remove(AttributeOwner &owner, const StringRef name, ReportLis
if (bke::mesh::is_uv_map(metadata)) {
char buffer[MAX_CUSTOMDATA_LAYER_NAME];
attributes->remove(BKE_uv_map_pin_name_get(name_copy, buffer));
mesh_uv_map_remove_references(*mesh, name_copy);
}
return true;
}