Fix removal of scene instances
This commit is contained in:
parent
443cb4b55d
commit
8f243f6121
@ -59,6 +59,7 @@ Godot 4 is required from this version.
|
|||||||
- `VoxelTool`: `raycast` locking up if you send a Vector3 containing NaN
|
- `VoxelTool`: `raycast` locking up if you send a Vector3 containing NaN
|
||||||
- `VoxelInstancer`: fix instances not refreshing when an item is modified and the mesh block size is 32
|
- `VoxelInstancer`: fix instances not refreshing when an item is modified and the mesh block size is 32
|
||||||
- `VoxelInstancer`: fix crash when removing an item from the library while an instancer node is using it
|
- `VoxelInstancer`: fix crash when removing an item from the library while an instancer node is using it
|
||||||
|
- `VoxelInstancer`: fix errors when removing scene instances
|
||||||
- `VoxelToolTerrain`: `run_blocky_random_tick` no longer snaps area borders to chunk borders in unintuitive ways
|
- `VoxelToolTerrain`: `run_blocky_random_tick` no longer snaps area borders to chunk borders in unintuitive ways
|
||||||
- `VoxelStreamScript`: fix voxel data not getting retrieved when `BLOCK_FOUND` is returned
|
- `VoxelStreamScript`: fix voxel data not getting retrieved when `BLOCK_FOUND` is returned
|
||||||
|
|
||||||
|
@ -1470,7 +1470,7 @@ void VoxelInstancer::on_body_removed(
|
|||||||
|
|
||||||
// Unregister the body
|
// Unregister the body
|
||||||
unsigned int body_count = block.bodies.size();
|
unsigned int body_count = block.bodies.size();
|
||||||
unsigned int last_instance_index = --body_count;
|
const unsigned int last_instance_index = --body_count;
|
||||||
VoxelInstancerRigidBody *moved_body = block.bodies[last_instance_index];
|
VoxelInstancerRigidBody *moved_body = block.bodies[last_instance_index];
|
||||||
if (instance_index != last_instance_index) {
|
if (instance_index != last_instance_index) {
|
||||||
moved_body->set_instance_index(instance_index);
|
moved_body->set_instance_index(instance_index);
|
||||||
@ -1487,11 +1487,11 @@ void VoxelInstancer::on_body_removed(
|
|||||||
void VoxelInstancer::on_scene_instance_removed(
|
void VoxelInstancer::on_scene_instance_removed(
|
||||||
Vector3i data_block_position, unsigned int render_block_index, unsigned int instance_index) {
|
Vector3i data_block_position, unsigned int render_block_index, unsigned int instance_index) {
|
||||||
Block &block = *_blocks[render_block_index];
|
Block &block = *_blocks[render_block_index];
|
||||||
ERR_FAIL_INDEX(instance_index, block.bodies.size());
|
ERR_FAIL_INDEX(instance_index, block.scene_instances.size());
|
||||||
|
|
||||||
// Unregister the scene instance
|
// Unregister the scene instance
|
||||||
unsigned int instance_count = block.scene_instances.size();
|
unsigned int instance_count = block.scene_instances.size();
|
||||||
unsigned int last_instance_index = --instance_count;
|
const unsigned int last_instance_index = --instance_count;
|
||||||
SceneInstance moved_instance = block.scene_instances[last_instance_index];
|
SceneInstance moved_instance = block.scene_instances[last_instance_index];
|
||||||
if (instance_index != last_instance_index) {
|
if (instance_index != last_instance_index) {
|
||||||
ERR_FAIL_COND(moved_instance.component == nullptr);
|
ERR_FAIL_COND(moved_instance.component == nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user