Fix variable names.

This commit is contained in:
Relintai 2025-02-03 14:12:52 +01:00
parent 39c2c615a9
commit 1bc26692f6
2 changed files with 25 additions and 25 deletions

View File

@ -98,7 +98,7 @@ EditorPlugin::AfterGUIInput TerrainWorldEditor::do_input_action(Camera *p_camera
PhysicsDirectSpaceState::RayResult res; PhysicsDirectSpaceState::RayResult res;
if (ss->intersect_ray(from, to, res)) { if (ss->intersect_ray(from, to, res)) {
int selected_voxel = 0; int selected_terrain = 0;
int channel = 0; int channel = 0;
channel = _channel_type; channel = _channel_type;
@ -110,15 +110,15 @@ EditorPlugin::AfterGUIInput TerrainWorldEditor::do_input_action(Camera *p_camera
bool mode_add = false; bool mode_add = false;
if (_tool_mode == TOOL_MODE_ADD) { if (_tool_mode == TOOL_MODE_ADD) {
selected_voxel = _selected_type + 1; selected_terrain = _selected_type + 1;
mode_add = true; mode_add = true;
} else if (_tool_mode == TOOL_MODE_REMOVE) { } else if (_tool_mode == TOOL_MODE_REMOVE) {
selected_voxel = 0; selected_terrain = 0;
isolevel = 0; isolevel = 0;
mode_add = false; mode_add = false;
} }
_world->set_voxel_with_tool(mode_add, res.position, res.normal, selected_voxel, isolevel); _world->set_terrain_with_tool(mode_add, res.position, res.normal, selected_terrain, isolevel);
return EditorPlugin::AFTER_GUI_INPUT_STOP; return EditorPlugin::AFTER_GUI_INPUT_STOP;
} }
@ -311,7 +311,7 @@ void TerrainWorldEditor::_on_tool_button_pressed() {
} }
void TerrainWorldEditor::_on_insert_block_at_camera_button_pressed() { void TerrainWorldEditor::_on_insert_block_at_camera_button_pressed() {
int selected_voxel = 0; int selected_terrain = 0;
int channel = 0; int channel = 0;
channel = _channel_type; channel = _channel_type;
@ -330,13 +330,13 @@ void TerrainWorldEditor::_on_insert_block_at_camera_button_pressed() {
return; return;
Vector3 pos = cam->get_transform().origin; Vector3 pos = cam->get_transform().origin;
selected_voxel = _selected_type + 1; selected_terrain = _selected_type + 1;
if (_channel_isolevel == -1) { if (_channel_isolevel == -1) {
_world->set_voxel_at_world_position(pos, selected_voxel, channel); _world->set_terrain_at_world_position(pos, selected_terrain, channel);
} else { } else {
_world->set_voxel_at_world_position(pos, selected_voxel, channel, false); _world->set_terrain_at_world_position(pos, selected_terrain, channel, false);
_world->set_voxel_at_world_position(pos, _current_isolevel, _channel_isolevel); _world->set_terrain_at_world_position(pos, _current_isolevel, _channel_isolevel);
} }
} }
@ -356,17 +356,17 @@ void TerrainWorldEditorPlugin::_notification(int p_what) {
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
switch ((int)EditorSettings::get_singleton()->get("editors/terrain/editor_side")) { switch ((int)EditorSettings::get_singleton()->get("editors/terrain/editor_side")) {
case 0: { // Left. case 0: { // Left.
SpatialEditor::get_singleton()->move_control_to_left_panel(voxel_world_editor); SpatialEditor::get_singleton()->move_control_to_left_panel(terrain_world_editor);
} break; } break;
case 1: { // Right. case 1: { // Right.
SpatialEditor::get_singleton()->move_control_to_right_panel(voxel_world_editor); SpatialEditor::get_singleton()->move_control_to_right_panel(terrain_world_editor);
} break; } break;
} }
} }
} }
void TerrainWorldEditorPlugin::edit(Object *p_object) { void TerrainWorldEditorPlugin::edit(Object *p_object) {
voxel_world_editor->edit(Object::cast_to<TerrainWorld>(p_object)); terrain_world_editor->edit(Object::cast_to<TerrainWorld>(p_object));
} }
bool TerrainWorldEditorPlugin::handles(Object *p_object) const { bool TerrainWorldEditorPlugin::handles(Object *p_object) const {
@ -380,14 +380,14 @@ bool TerrainWorldEditorPlugin::handles(Object *p_object) const {
void TerrainWorldEditorPlugin::make_visible(bool p_visible) { void TerrainWorldEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
voxel_world_editor->show(); terrain_world_editor->show();
voxel_world_editor->spatial_editor_hb->show(); terrain_world_editor->spatial_editor_hb->show();
voxel_world_editor->set_process(true); terrain_world_editor->set_process(true);
} else { } else {
voxel_world_editor->spatial_editor_hb->hide(); terrain_world_editor->spatial_editor_hb->hide();
voxel_world_editor->hide(); terrain_world_editor->hide();
voxel_world_editor->edit(NULL); terrain_world_editor->edit(NULL);
voxel_world_editor->set_process(false); terrain_world_editor->set_process(false);
} }
} }
@ -397,13 +397,13 @@ TerrainWorldEditorPlugin::TerrainWorldEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("editors/terrain/editor_side", 1); EDITOR_DEF("editors/terrain/editor_side", 1);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/terrain/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/terrain/editor_side", PROPERTY_HINT_ENUM, "Left,Right"));
voxel_world_editor = memnew(TerrainWorldEditor(editor)); terrain_world_editor = memnew(TerrainWorldEditor(editor));
switch ((int)EditorSettings::get_singleton()->get("editors/terrain/editor_side")) { switch ((int)EditorSettings::get_singleton()->get("editors/terrain/editor_side")) {
case 0: { // Left. case 0: { // Left.
add_control_to_container(CONTAINER_SPATIAL_EDITOR_SIDE_LEFT, voxel_world_editor); add_control_to_container(CONTAINER_SPATIAL_EDITOR_SIDE_LEFT, terrain_world_editor);
} break; } break;
case 1: { // Right. case 1: { // Right.
add_control_to_container(CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, voxel_world_editor); add_control_to_container(CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, terrain_world_editor);
} break; } break;
} }
make_visible(false); make_visible(false);

View File

@ -100,15 +100,15 @@ private:
class TerrainWorldEditorPlugin : public EditorPlugin { class TerrainWorldEditorPlugin : public EditorPlugin {
GDCLASS(TerrainWorldEditorPlugin, EditorPlugin); GDCLASS(TerrainWorldEditorPlugin, EditorPlugin);
TerrainWorldEditor *voxel_world_editor; TerrainWorldEditor *terrain_world_editor;
EditorNode *editor; EditorNode *editor;
protected: protected:
void _notification(int p_what); void _notification(int p_what);
public: public:
bool forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } bool forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) { return terrain_world_editor->forward_spatial_input_event(p_camera, p_event); }
virtual EditorPlugin::AfterGUIInput forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } virtual EditorPlugin::AfterGUIInput forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return terrain_world_editor->forward_spatial_input_event(p_camera, p_event); }
virtual String get_name() const { return "TerrainWorldEditor"; } virtual String get_name() const { return "TerrainWorldEditor"; }
bool has_main_screen() const { return false; } bool has_main_screen() const { return false; }
virtual void edit(Object *p_object); virtual void edit(Object *p_object);