Skip to content

Commit c0f924d

Browse files
committed
sync with latest engine
1 parent 107c48b commit c0f924d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/editor/plugins.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
437437
}
438438

439439
StaticString<MAX_PATH_LENGTH> res_locator(anim.name, ":", gltf_path);
440-
compiler.writeCompiledResource(res_locator, Span<u8>((u8*)out.getData(), (int)out.getPos()));
440+
compiler.writeCompiledResource(res_locator, Span(out.data(), (u32)out.size()));
441441
}
442442
}
443443

@@ -475,7 +475,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
475475
logError("gltf") << "Could not create " << out_path;
476476
continue;
477477
}
478-
file.write(out.getData(), out.getPos());
478+
file.write(out.data(), out.size());
479479
file.close();
480480
}
481481
}
@@ -485,20 +485,20 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
485485
FileSystem& fs = editor.getEngine().getFileSystem();
486486
AssetCompiler& compiler = app.getAssetCompiler();
487487

488-
Array<u8> content(editor.getAllocator());
488+
OutputMemoryStream content(editor.getAllocator());
489489
if (!fs.getContentSync(Path(src), Ref(content))) {
490490
logError("gltf") << "Could not load " << src;
491491
return false;
492492
}
493493

494494
cgltf_data* gltf_data = nullptr;
495495
cgltf_options options = {};
496-
if (cgltf_parse(&options, content.begin(), content.byte_size(), &gltf_data) != cgltf_result_success) {
496+
if (cgltf_parse(&options, content.data(), content.size(), &gltf_data) != cgltf_result_success) {
497497
logError("gltf") << "Failed to parse " << src;
498498
return false;
499499
}
500500

501-
Array<Array<u8>> buffers(editor.getAllocator());
501+
Array<OutputMemoryStream> buffers(editor.getAllocator());
502502
for (u32 i = 0; i < gltf_data->buffers_count; ++i) {
503503
buffers.emplace(editor.getAllocator());
504504
}
@@ -516,7 +516,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
516516

517517
for (u32 i = 0; i < gltf_data->buffers_count; ++i) {
518518
ASSERT(!gltf_data->buffers[i].data);
519-
gltf_data->buffers[i].data = buffers[i].begin();
519+
gltf_data->buffers[i].data = buffers[i].getMutableData();
520520
}
521521

522522
ModelWriter writer(src.c_str(), editor.getAllocator());
@@ -534,7 +534,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
534534

535535
cgltf_free(gltf_data);
536536

537-
Span<u8> compiled_data((u8*)writer.out.getData(), (int)writer.out.getPos());
537+
Span<const u8> compiled_data(writer.out.data(), (u32)writer.out.size());
538538
return compiler.writeCompiledResource(src.c_str(), compiled_data);
539539
}
540540

@@ -568,7 +568,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
568568
FileSystem& fs = editor.getEngine().getFileSystem();
569569
AssetCompiler& compiler = plugin->app.getAssetCompiler();
570570

571-
Array<u8> content(editor.getAllocator());
571+
OutputMemoryStream content(editor.getAllocator());
572572
if (!fs.getContentSync(Path(data->path), Ref(content))) {
573573
logError("gltf") << "Could not load " << data->path;
574574
LUMIX_DELETE(editor.getAllocator(), data);
@@ -577,7 +577,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
577577

578578
cgltf_data* gltf_data = nullptr;
579579
cgltf_options options = {};
580-
if (cgltf_parse(&options, content.begin(), content.byte_size(), &gltf_data) != cgltf_result_success) {
580+
if (cgltf_parse(&options, content.data(), content.size(), &gltf_data) != cgltf_result_success) {
581581
logError("gltf") << "Failed to parse " << data->path;
582582
LUMIX_DELETE(editor.getAllocator(), data);
583583
return;

0 commit comments

Comments
 (0)