Reorganize Blender Web execution around capabilities
Some checks are pending
M6 deployable RC / quick (push) Waiting to run
M6 deployable RC / chromium (push) Blocked by required conditions
M6 deployable RC / release (push) Blocked by required conditions

This commit is contained in:
mes123456
2026-08-24 18:37:46 -04:00
parent 0b2c3ba0dd
commit a081c68c87
2530 changed files with 763976 additions and 79 deletions

View File

@@ -2143,6 +2143,36 @@ std::string read_raw_string(const ParsedBlend &blend,
return std::string(data, strnlen(data, available));
}
std::optional<json> asset_metadata_from_id(const ParsedBlend &blend, const ElementRef &element)
{
const std::optional<ElementRef> id = embedded_element(*blend.sdna, element, "id");
if (!id) return std::nullopt;
const std::optional<uint64_t> asset_pointer = read_pointer(*blend.sdna, *id, "asset_data");
if (!asset_pointer || *asset_pointer == 0) return std::nullopt;
const std::optional<ElementRef> metadata = element_for_pointer(blend, *asset_pointer);
if (!metadata) return std::nullopt;
auto dynamic_string = [&](const char *member) {
const std::optional<uint64_t> pointer = read_pointer(*blend.sdna, *metadata, member);
return pointer ? read_raw_string(blend, *pointer, 4096) : std::string();
};
json tags = json::array();
for (const ElementRef &tag : linked_list_elements(blend, *metadata, "tags")) {
const std::string name = read_string(*blend.sdna, tag, "name");
if (!name.empty()) tags.push_back(name);
}
return json{{"marked", true},
{"author", dynamic_string("author")},
{"description", dynamic_string("description")},
{"copyright", dynamic_string("copyright")},
{"license", dynamic_string("license")},
{"catalogSimpleName", read_string(*blend.sdna, *metadata, "catalog_simple_name")},
{"activeTag", read_integer(*blend.sdna, *metadata, "active_tag").value_or(0)},
{"preferredImportMethod",
read_integer(*blend.sdna, *metadata, "preferred_import_method").value_or(0)},
{"tags", std::move(tags)}};
}
std::optional<json> script_source_from_record(const ParsedBlend &blend,
const ElementRef &element,
const IdRecord &record)
@@ -3572,11 +3602,14 @@ json scene_ir_from_blend(const ParsedBlend &blend,
{"selectable", (visibility_flags & 2) == 0},
{"localMatrix", matrix},
{"worldMatrix", matrix},
{"transform",
{"transform",
{{"translation", float_array_or(location, {0.0f, 0.0f, 0.0f})},
{"rotationEuler", float_array_or(rotation, {0.0f, 0.0f, 0.0f})},
{"scale", float_array_or(scale, {1.0f, 1.0f, 1.0f})},
{"rotationMode", read_integer(*blend.sdna, element, "rotmode").value_or(1)}}}};
if (const std::optional<json> asset_data = asset_metadata_from_id(blend, element)) {
node["assetData"] = *asset_data;
}
json constraints = json::array();
for (const ElementRef &constraint : linked_list_elements(blend, element, "constraints")) {
const int64_t constraint_type = read_integer(*blend.sdna, constraint, "type").value_or(0);