Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.67k stars 250 forks source link

Using custom VoxelGeneratorScript in editor's voxelgraph? #557

Open Shadowblitz16 opened 1 year ago

Shadowblitz16 commented 1 year ago

Is there a way to register a VoxelGeneratorScript so I can use it in the editor and in the VoxelGeneratorGraph?

class_name VoxelGeneratorLevel extends VoxelGeneratorScript

const channel : int = VoxelBuffer.CHANNEL_TYPE

@export var levels : Array[Level]= []

func _generate_block(out_buffer: VoxelBuffer, origin_in_voxels: Vector3i, lod: int) -> void:
    if lod != 0: return

    for level in levels:
        if origin_in_voxels.y >= level.depth_min and origin_in_voxels.y < level.depth_max:
            out_buffer.fill(level.id, channel)
Zylann commented 1 year ago

No, graphs work in a different way compared to generators, it's not possible to nest them like this.