Fix compilation with newest Godot

master
Marc Gilleron 2022-03-14 00:26:25 +00:00
parent 750fbeda53
commit c9edc64ae0
3 changed files with 14 additions and 18 deletions

View File

@ -83,7 +83,7 @@ void register_voxel_types() {
ClassDB::register_class<VoxelBlockyLibrary>();
ClassDB::register_class<VoxelColorPalette>();
ClassDB::register_class<VoxelInstanceLibrary>();
ClassDB::register_virtual_class<VoxelInstanceLibraryItem>();
ClassDB::register_abstract_class<VoxelInstanceLibraryItem>();
ClassDB::register_class<VoxelInstanceLibraryMultiMeshItem>();
ClassDB::register_class<VoxelInstanceLibrarySceneItem>();
ClassDB::register_class<VoxelDataBlockEnterInfo>();
@ -92,7 +92,7 @@ void register_voxel_types() {
ClassDB::register_class<gd::VoxelBuffer>();
// Nodes
ClassDB::register_virtual_class<VoxelNode>();
ClassDB::register_abstract_class<VoxelNode>();
ClassDB::register_class<VoxelTerrain>();
ClassDB::register_class<VoxelLodTerrain>();
ClassDB::register_class<VoxelViewer>();
@ -101,17 +101,17 @@ void register_voxel_types() {
ClassDB::register_class<VoxelInstanceComponent>();
// Streams
ClassDB::register_virtual_class<VoxelStream>();
ClassDB::register_abstract_class<VoxelStream>();
ClassDB::register_class<VoxelStreamBlockFiles>();
ClassDB::register_class<VoxelStreamRegionFiles>();
ClassDB::register_class<VoxelStreamScript>();
ClassDB::register_class<VoxelStreamSQLite>();
// Generators
ClassDB::register_virtual_class<VoxelGenerator>();
ClassDB::register_abstract_class<VoxelGenerator>();
ClassDB::register_class<VoxelGeneratorFlat>();
ClassDB::register_class<VoxelGeneratorWaves>();
ClassDB::register_virtual_class<VoxelGeneratorHeightmap>();
ClassDB::register_abstract_class<VoxelGeneratorHeightmap>();
ClassDB::register_class<VoxelGeneratorImage>();
ClassDB::register_class<VoxelGeneratorNoise2D>();
ClassDB::register_class<VoxelGeneratorNoise>();
@ -121,12 +121,12 @@ void register_voxel_types() {
// Utilities
ClassDB::register_class<VoxelBoxMover>();
ClassDB::register_class<VoxelRaycastResult>();
ClassDB::register_virtual_class<VoxelTool>();
ClassDB::register_virtual_class<VoxelToolTerrain>();
ClassDB::register_virtual_class<VoxelToolLodTerrain>();
ClassDB::register_abstract_class<VoxelTool>();
ClassDB::register_abstract_class<VoxelToolTerrain>();
ClassDB::register_abstract_class<VoxelToolLodTerrain>();
// I had to bind this one despite it being useless as-is because otherwise Godot lazily initializes its class.
// And this can happen in a thread, causing crashes due to the concurrent access
ClassDB::register_virtual_class<VoxelToolBuffer>();
ClassDB::register_abstract_class<VoxelToolBuffer>();
ClassDB::register_class<gd::VoxelBlockSerializer>();
ClassDB::register_class<VoxelVoxLoader>();
ClassDB::register_class<FastNoiseLite>();
@ -137,7 +137,7 @@ void register_voxel_types() {
#endif
// Meshers
ClassDB::register_virtual_class<VoxelMesher>();
ClassDB::register_abstract_class<VoxelMesher>();
ClassDB::register_class<VoxelMesherBlocky>();
ClassDB::register_class<VoxelMesherTransvoxel>();
ClassDB::register_class<VoxelMesherDMC>();

View File

@ -893,8 +893,7 @@ void VoxelTerrain::send_block_data_requests() {
}
void VoxelTerrain::emit_data_block_loaded(const VoxelDataBlock *block) {
const Variant vpos = block->position;
// Not sure about exposDing buffers directly... some stuff on them is useful to obtain directly,
// Not sure about exposing buffers directly... some stuff on them is useful to obtain directly,
// but also it allows scripters to mess with voxels in a way they should not.
// Example: modifying voxels without locking them first, while another thread may be reading them at the same
// time. The same thing could happen the other way around (threaded task modifying voxels while you try to read
@ -903,16 +902,13 @@ void VoxelTerrain::emit_data_block_loaded(const VoxelDataBlock *block) {
// absolutely necessary, buffers aren't exposed. Workaround: use VoxelTool
//const Variant vbuffer = block->voxels;
//const Variant *args[2] = { &vpos, &vbuffer };
const Variant *args[1] = { &vpos };
emit_signal(VoxelStringNames::get_singleton()->block_loaded, args, 1);
emit_signal(VoxelStringNames::get_singleton()->block_loaded, block->position);
}
void VoxelTerrain::emit_data_block_unloaded(const VoxelDataBlock *block) {
const Variant vpos = block->position;
// const Variant vbuffer = block->voxels;
// const Variant *args[2] = { &vpos, &vbuffer };
const Variant *args[1] = { &vpos };
emit_signal(VoxelStringNames::get_singleton()->block_unloaded, args, 1);
emit_signal(VoxelStringNames::get_singleton()->block_unloaded, block->position);
}
bool VoxelTerrain::try_get_paired_viewer_index(uint32_t id, size_t &out_i) const {

View File

@ -46,7 +46,7 @@ bool try_call_script(
#endif
Callable::CallError err;
Variant ret = script->call(method_name, args, argc, err);
Variant ret = script->callp(method_name, args, argc, err);
// TODO Why does Variant::get_call_error_text want a non-const Object pointer??? It only uses const methods
ERR_FAIL_COND_V_MSG(err.error != Callable::CallError::CALL_OK, false,