Skip to content

Commit

Permalink
Reorganize editor plugin files
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Dec 26, 2024
1 parent c8519b8 commit 3ad9b3e
Show file tree
Hide file tree
Showing 29 changed files with 72 additions and 18 deletions.
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,27 @@ Please see [System Architecture](https://terrain3d.readthedocs.io/en/stable/docs
If you wish to take on a major component, it's best to join our [discord server](https://tokisan.com/discord) and discuss your plans with Cory to make sure your efforts are aligned with other plans.

**Table of Contents**
* [Important Directories](#important-directories)
* [Setup Your System](#setup-your-system)
* [PR Workflow](#pr-workflow)
* [Code Style](#code-style)
* [Documentation](#documentation)


## Important Directories

* src - C++ source for the library
* src/shaders - GLSL source for the default shader
* doc/doc_classes - XML docs for C++ classes
* doc/docs - MD tutorial docs
* project/addons/terrain_3d
* src - GDScript for the editor plugin: the user interface for hand editing
* menu - GDScript for the tools menu: bakers, channel packer
* tools - GDScript for the importer, which will eventually be merged into the menu
* utils - GDScript for other objects, eg. terrain_3d_objects.gd
* extras - GDScript examples for users


## Setup Your System

Make sure you are setup to [build the plugin from source](https://terrain3d.readthedocs.io/en/stable/docs/building_from_source.html).
Expand Down
3 changes: 2 additions & 1 deletion project/addons/terrain_3d/extras/import_sgt.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Import From SimpleGrassTextured
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Import From SimpleGrassTextured
#
# This script demonstrates how to import transforms from SimpleGrassTextured. To use it:
#
Expand Down
1 change: 1 addition & 0 deletions project/addons/terrain_3d/extras/minimum.gdshader
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
// This shader is the minimum needed to allow the terrain to function, without any texturing.

shader_type spatial;
Expand Down
1 change: 1 addition & 0 deletions project/addons/terrain_3d/extras/project_on_terrain3d.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# This script is an addon for HungryProton's Scatter https://github.com/HungryProton/scatter
# It provides a `Project on Terrain3D` modifier, which allows Scatter
# to detect the terrain height from Terrain3D without using collision.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Bake LOD Dialog for Terrain3D
@tool
extends ConfirmationDialog

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bhvrrmb8bk1bt"]

[ext_resource type="Script" path="res://addons/terrain_3d/src/bake_lod_dialog.gd" id="1_sf76d"]
[ext_resource type="Script" path="res://addons/terrain_3d/menu/bake_lod_dialog.gd" id="1_sf76d"]

[node name="bake_lod_dialog" type="ConfirmationDialog"]
title = "Bake Terrain3D Mesh"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Baker for Terrain3D
extends Node

const BakeLodDialog: PackedScene = preload("res://addons/terrain_3d/src/bake_lod_dialog.tscn")
const BakeLodDialog: PackedScene = preload("res://addons/terrain_3d/menu/bake_lod_dialog.tscn")
const BAKE_MESH_DESCRIPTION: String = "This will create a child MeshInstance3D. LOD4+ is recommended. LOD0 is slow and dense with vertices every 1 unit. It is not an optimal mesh."
const BAKE_OCCLUDER_DESCRIPTION: String = "This will create a child OccluderInstance3D. LOD4+ is recommended and will take 5+ seconds per region to generate. LOD0 is unnecessarily dense and slow."
const SET_UP_NAVIGATION_DESCRIPTION: String = "This operation will:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Channel Packer for Terrain3D
extends RefCounted

const WINDOW_SCENE: String = "res://addons/terrain_3d/src/channel_packer.tscn"
const TEMPLATE_PATH: String = "res://addons/terrain_3d/src/channel_packer_import_template.txt"
const DRAG_DROP_SCRIPT: String = "res://addons/terrain_3d/src/channel_packer_dragdrop.gd"
const WINDOW_SCENE: String = "res://addons/terrain_3d/menu/channel_packer.tscn"
const TEMPLATE_PATH: String = "res://addons/terrain_3d/menu/channel_packer_import_template.txt"
const DRAG_DROP_SCRIPT: String = "res://addons/terrain_3d/menu/channel_packer_dragdrop.gd"
enum {
INFO,
WARN,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Channel Packer Dragdropper for Terrain3D
@tool
extends Button

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Directory Setup for Terrain3D
extends Node

const DIRECTORY_SETUP: String = "res://addons/terrain_3d/src/directory_setup.tscn"
const DIRECTORY_SETUP: String = "res://addons/terrain_3d/menu/directory_setup.tscn"

var plugin: EditorPlugin
var dialog: ConfirmationDialog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Menu for Terrain3D
extends HBoxContainer


const DirectoryWizard: Script = preload("res://addons/terrain_3d/src/directory_setup.gd")
const Packer: Script = preload("res://addons/terrain_3d/src/channel_packer.gd")
const Baker: Script = preload("res://addons/terrain_3d/src/baker.gd")
const DirectoryWizard: Script = preload("res://addons/terrain_3d/menu/directory_setup.gd")
const Packer: Script = preload("res://addons/terrain_3d/menu/channel_packer.gd")
const Baker: Script = preload("res://addons/terrain_3d/menu/baker.gd")

var plugin: EditorPlugin
var menu_button: MenuButton = MenuButton.new()
Expand Down Expand Up @@ -31,7 +33,7 @@ func _enter_tree() -> void:
add_child(directory_setup)
add_child(baker)

menu_button.text = "Terrain3D Tools"
menu_button.text = "Terrain3D"
menu_button.get_popup().add_item("Directory Setup...", MENU_DIRECTORY_SETUP)
menu_button.get_popup().add_item("Pack Textures...", MENU_PACK_TEXTURES)
menu_button.get_popup().add_separator("", MENU_SEPARATOR)
Expand Down
2 changes: 1 addition & 1 deletion project/addons/terrain_3d/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ name="Terrain3D"
description="A high performance, editable terrain system for Godot 4."
author="Cory Petkovsek & Roope Palmroos"
version="1.0.0-dev"
script="editor.gd"
script="src/editor_plugin.gd"
3 changes: 2 additions & 1 deletion project/addons/terrain_3d/src/asset_dock.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Asset Dock for Terrain3D
@tool
extends PanelContainer
#class_name Terrain3DAssetDock

signal confirmation_closed
signal confirmation_confirmed
Expand Down
3 changes: 3 additions & 0 deletions project/addons/terrain_3d/src/double_slider.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# DoubleSlider for Terrain3D
# Should work for other UIs
@tool
class_name DoubleSlider
extends Control
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Editor Plugin for Terrain3D
@tool
extends EditorPlugin
#class_name Terrain3DEditorPlugin Cannot be named until Godot #75388


# Includes
Expand Down
3 changes: 2 additions & 1 deletion project/addons/terrain_3d/src/gradient_operation_builder.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Gradient Operation Builder for Terrain3D
extends "res://addons/terrain_3d/src/operation_builder.gd"


Expand Down Expand Up @@ -52,4 +54,3 @@ func apply_operation(p_editor: Terrain3DEditor, p_global_position: Vector3, p_ca
p_editor.stop_operation()

_get_point_picker().clear()

2 changes: 2 additions & 0 deletions project/addons/terrain_3d/src/multi_picker.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Multipicker for Terrain3D
extends HBoxContainer


Expand Down
2 changes: 2 additions & 0 deletions project/addons/terrain_3d/src/operation_builder.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Operation Builder for Terrain3D
extends RefCounted


Expand Down
2 changes: 2 additions & 0 deletions project/addons/terrain_3d/src/region_gizmo.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Editor Region Gizmos for Terrain3D
extends EditorNode3DGizmo

var material: StandardMaterial3D
Expand Down
2 changes: 2 additions & 0 deletions project/addons/terrain_3d/src/tool_settings.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Tool settings bar for Terrain3D
extends PanelContainer

signal picking(type, callback)
Expand Down
2 changes: 2 additions & 0 deletions project/addons/terrain_3d/src/toolbar.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Toolbar for Terrain3D
extends VFlowContainer

signal tool_changed(p_tool: Terrain3DEditor.Tool, p_operation: Terrain3DEditor.Operation)
Expand Down
5 changes: 3 additions & 2 deletions project/addons/terrain_3d/src/ui.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# UI for Terrain3D
extends Node
#class_name Terrain3DUI Cannot be named until Godot #75388


# Includes
const TerrainMenu: Script = preload("res://addons/terrain_3d/menu/terrain_menu.gd")
const Toolbar: Script = preload("res://addons/terrain_3d/src/toolbar.gd")
const ToolSettings: Script = preload("res://addons/terrain_3d/src/tool_settings.gd")
const TerrainMenu: Script = preload("res://addons/terrain_3d/src/terrain_menu.gd")
const OperationBuilder: Script = preload("res://addons/terrain_3d/src/operation_builder.gd")
const GradientOperationBuilder: Script = preload("res://addons/terrain_3d/src/gradient_operation_builder.gd")
const COLOR_RAISE := Color.WHITE
Expand Down
2 changes: 2 additions & 0 deletions project/addons/terrain_3d/tools/importer.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Importer for Terrain3D
@tool
extends Terrain3D

Expand Down
3 changes: 3 additions & 0 deletions project/addons/terrain_3d/utils/terrain_3d_objects.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Objects parent for Terrain3D
# Children nodes get transform updates on sculpting
@tool
extends Node3D
class_name Terrain3DObjects
Expand Down
2 changes: 2 additions & 0 deletions project/addons/terrain_3d/utils/transform_changed_notifier.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © 2024 Cory Petkovsek, Roope Palmroos, and Contributors.
# Transform Changed Notifier for Terrain3D
@tool
extends Node3D

Expand Down
1 change: 0 additions & 1 deletion project/demo/data/assets.tres
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ distance_fade_max_distance = 75.0
[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_2qf8x"]
height_offset = 0.5
density = 10.0
visibility_range = 100.0
material_override = SubResource("StandardMaterial3D_mapyw")
generated_type = 1

Expand Down

0 comments on commit 3ad9b3e

Please sign in to comment.