Expose VoxelTool.is_area_editable()

This commit is contained in:
Marc Gilleron 2020-08-24 13:51:08 +01:00
parent d848da3a6f
commit e30a3f51d6
2 changed files with 4 additions and 0 deletions

View File

@ -265,6 +265,8 @@ void VoxelTool::_bind_methods() {
ClassDB::bind_method(D_METHOD("raycast", "origin", "direction", "max_distance", "collision_mask"),
&VoxelTool::_b_raycast, DEFVAL(10.0), DEFVAL(0xffffffff));
ClassDB::bind_method(D_METHOD("is_area_editable", "box"), &VoxelTool::_b_is_area_editable);
ADD_PROPERTY(PropertyInfo(Variant::INT, "value"), "set_value", "get_value");
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel");
ADD_PROPERTY(PropertyInfo(Variant::INT, "eraser_value"), "set_eraser_value", "get_eraser_value");

View File

@ -97,6 +97,8 @@ private:
Variant _b_get_voxel_metadata(Vector3 pos) { return get_voxel_metadata(Vector3i(pos)); }
void _b_set_voxel_metadata(Vector3 pos, Variant meta) { return set_voxel_metadata(Vector3i(pos), meta); }
bool _b_is_area_editable(AABB box) { return is_area_editable(Rect3i(box.position, box.size)); }
protected:
uint64_t _value = 0;
uint64_t _eraser_value = 0; // air