├── assets ├── ui │ ├── icons │ │ ├── src │ │ │ ├── .gdignore │ │ │ ├── window-minimize.svg │ │ │ ├── plus-thick.svg │ │ │ ├── window-restore.svg │ │ │ ├── file.svg │ │ │ ├── folder.svg │ │ │ ├── content-copy.svg │ │ │ ├── export.svg │ │ │ ├── import.svg │ │ │ ├── cursor-move.svg │ │ │ ├── relative-scale.svg │ │ │ ├── lightbulb.svg │ │ │ ├── brush-variant.svg │ │ │ ├── content-paste.svg │ │ │ ├── cursor-default.svg │ │ │ ├── tag.svg │ │ │ ├── cube-outline.svg │ │ │ ├── rotate-right.svg │ │ │ └── close-thick.svg │ │ ├── close-thick.png │ │ └── close-thick.png.import │ ├── ui.theme │ ├── mb-bg.png │ ├── menubar.theme │ ├── fonts │ │ ├── Roboto-Medium.ttf │ │ ├── notosans-regular.ttf │ │ └── MaterialIcons-Regular.ttf │ ├── button_groups │ │ └── Tools.tres │ └── mb-bg.png.import ├── textures │ ├── floor.png │ ├── grid.png │ ├── hint.png │ ├── skip.png │ ├── wall.png │ ├── nodraw.png │ ├── trigger.png │ ├── floor.png.import │ ├── hint.png.import │ ├── skip.png.import │ ├── wall.png.import │ ├── nodraw.png.import │ ├── trigger.png.import │ └── grid.png.import ├── environments │ └── 3d_unshaded.tres └── shaders │ └── selected_mesh.shader ├── addons ├── vmflib │ ├── icon │ │ ├── .gdignore │ │ └── icon.png │ ├── vmflib_plugin.gd │ ├── plugin.cfg │ ├── VMFDataManager.gd │ ├── examples │ │ ├── Example2.gd │ │ ├── Example1.gd │ │ ├── Example1.tscn │ │ └── Example2.tscn │ ├── LICENSE │ ├── VMFRoot.gd │ ├── README.md │ └── VMF.gd └── imgui-godot │ ├── imgui-icon.png │ ├── plugin.cfg │ ├── ImGuiPlugin.gd │ ├── imgui-icon.png.import │ ├── ImGuiNode.cs │ ├── icon.tres │ └── ImGuiGD.cs ├── chisel-icon.svg.import ├── icon.png ├── scenes ├── ObjectMovementTest.tscn └── Main.tscn ├── default_env.tres ├── scripts ├── UINew │ ├── Docks │ │ ├── Properties │ │ │ ├── Entities.cs │ │ │ ├── ObjEdit.cs │ │ │ └── CreatePrimitive.cs │ │ ├── SelectionOptions.cs │ │ ├── Outline.cs │ │ ├── ToolProperties.cs │ │ ├── Tools.cs │ │ └── ActiveTexture.cs │ ├── StatusBar.cs │ ├── Dialogs │ │ ├── GameConfigSelect.cs │ │ ├── AssetBrowser │ │ │ ├── TextureBrowser.cs │ │ │ └── AssetBrowser.cs │ │ └── About.cs │ ├── MenuBar.cs │ └── EditorMain.cs ├── UI │ ├── Controls │ │ ├── View3D.cs │ │ ├── TextureRadio.cs │ │ └── ViewportContainerHack.cs │ ├── Menus │ │ ├── App.cs │ │ ├── Help.cs │ │ ├── File.cs │ │ └── View.cs │ ├── Docks │ │ ├── ToolsDock.cs │ │ └── TextureDock.cs │ ├── Dialogs │ │ ├── CubeCreate.cs │ │ └── TextureBrowser.cs │ └── RootPanel.cs ├── Utilities │ ├── MeshManager.cs │ ├── MeshBuilder.cs │ ├── AssetManager.cs │ └── FileManager.cs ├── 3DEnvironment │ ├── Gizmo.cs │ ├── SelectableMesh.cs │ ├── Grid3D.cs │ └── FreeCam.cs ├── Chisel.cs └── VTFLibWrapper.cs ├── newUI.tscn ├── Chisel.csproj ├── .gitignore ├── RootPanelTest.tscn ├── README.md ├── icon.png.import ├── Chisel.sln ├── LICENSE ├── project.godot ├── imguiviewporttest.tscn ├── Spatial.tscn ├── imgui.ini ├── imguiviewporttest.cs ├── EditorMain.tscn └── chisel-icon.svg /assets/ui/icons/src/.gdignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addons/vmflib/icon/.gdignore: -------------------------------------------------------------------------------- 1 | icon.png -------------------------------------------------------------------------------- /chisel-icon.svg.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="keep" 4 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/icon.png -------------------------------------------------------------------------------- /assets/ui/ui.theme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/ui.theme -------------------------------------------------------------------------------- /assets/ui/mb-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/mb-bg.png -------------------------------------------------------------------------------- /assets/ui/menubar.theme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/menubar.theme -------------------------------------------------------------------------------- /assets/textures/floor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/floor.png -------------------------------------------------------------------------------- /assets/textures/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/grid.png -------------------------------------------------------------------------------- /assets/textures/hint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/hint.png -------------------------------------------------------------------------------- /assets/textures/skip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/skip.png -------------------------------------------------------------------------------- /assets/textures/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/wall.png -------------------------------------------------------------------------------- /scenes/ObjectMovementTest.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene format=2] 2 | 3 | [node name="Spatial" type="Spatial"] 4 | -------------------------------------------------------------------------------- /addons/vmflib/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/addons/vmflib/icon/icon.png -------------------------------------------------------------------------------- /assets/textures/nodraw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/nodraw.png -------------------------------------------------------------------------------- /assets/textures/trigger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/textures/trigger.png -------------------------------------------------------------------------------- /addons/imgui-godot/imgui-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/addons/imgui-godot/imgui-icon.png -------------------------------------------------------------------------------- /assets/ui/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /assets/ui/icons/close-thick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/icons/close-thick.png -------------------------------------------------------------------------------- /assets/ui/fonts/notosans-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/fonts/notosans-regular.ttf -------------------------------------------------------------------------------- /assets/ui/icons/src/window-minimize.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/button_groups/Tools.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="ButtonGroup" format=2] 2 | 3 | [resource] 4 | resource_local_to_scene = false 5 | -------------------------------------------------------------------------------- /assets/ui/fonts/MaterialIcons-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashifolfi/Chisel/HEAD/assets/ui/fonts/MaterialIcons-Regular.ttf -------------------------------------------------------------------------------- /assets/ui/icons/src/plus-thick.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addons/vmflib/vmflib_plugin.gd: -------------------------------------------------------------------------------- 1 | tool 2 | extends EditorPlugin 3 | 4 | 5 | func _enter_tree() -> void: 6 | pass 7 | 8 | func _exit_tree() -> void: 9 | pass 10 | -------------------------------------------------------------------------------- /assets/environments/3d_unshaded.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" format=2] 2 | 3 | [resource] 4 | background_mode = 1 5 | ambient_light_color = Color( 1, 1, 1, 1 ) 6 | -------------------------------------------------------------------------------- /assets/ui/icons/src/window-restore.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addons/imgui-godot/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="Dear ImGui for Godot" 4 | description="Dear ImGui for Godot" 5 | author="Patrick Dawson" 6 | version="1.0" 7 | script="ImGuiPlugin.gd" 8 | -------------------------------------------------------------------------------- /assets/ui/icons/src/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/folder.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=2] 2 | 3 | [sub_resource type="ProceduralSky" id=1] 4 | 5 | [resource] 6 | background_mode = 2 7 | background_sky = SubResource( 1 ) 8 | -------------------------------------------------------------------------------- /addons/vmflib/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="vmflib" 4 | description="A port of the vmflib2 code at https://github.com/Trainzack/vmflib2." 5 | author="craftablescience" 6 | version="0.1.1" 7 | script="vmflib_plugin.gd" 8 | -------------------------------------------------------------------------------- /assets/ui/icons/src/content-copy.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/export.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/import.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/cursor-move.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addons/imgui-godot/ImGuiPlugin.gd: -------------------------------------------------------------------------------- 1 | tool 2 | extends EditorPlugin 3 | 4 | func _enter_tree(): 5 | add_custom_type("ImGuiNode", "Node2D", preload("ImGuiNode.cs"), preload("icon.tres")) 6 | 7 | func _exit_tree(): 8 | remove_custom_type("ImGuiNode") 9 | -------------------------------------------------------------------------------- /scenes/Main.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [ext_resource path="res://scripts/UI/RootPanel.cs" type="Script" id=2] 4 | 5 | [node name="RootPanel" type="Panel"] 6 | anchor_right = 1.0 7 | anchor_bottom = 1.0 8 | script = ExtResource( 2 ) 9 | -------------------------------------------------------------------------------- /assets/ui/icons/src/relative-scale.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/UINew/Docks/Properties/Entities.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | 3 | namespace Chisel.scripts.UINew.Docks.Properties 4 | { 5 | public class Entities : Node 6 | { 7 | public static void Dock() 8 | { 9 | // STUB 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /scripts/UINew/Docks/Properties/ObjEdit.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | 3 | namespace Chisel.scripts.UINew.Docks.Properties 4 | { 5 | public class ObjEdit : Node 6 | { 7 | public static void Dock() 8 | { 9 | // STUB 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /assets/ui/icons/src/lightbulb.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/UINew/Docks/Properties/CreatePrimitive.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | 3 | namespace Chisel.scripts.UINew.Docks.Properties 4 | { 5 | public class CreatePrimitive : Node 6 | { 7 | public static void Dock() 8 | { 9 | // STUB 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /assets/ui/icons/src/brush-variant.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/shaders/selected_mesh.shader: -------------------------------------------------------------------------------- 1 | shader_type spatial; 2 | render_mode blend_add, specular_schlick_ggx; 3 | 4 | void fragment() { 5 | // Color:2 6 | vec3 n_out2p0 = vec3(0.988235, 0.341176, 0.341176); 7 | float n_out2p1 = 0.772549; 8 | 9 | // Output:0 10 | ALBEDO = n_out2p0; 11 | ALPHA = n_out2p1; 12 | } -------------------------------------------------------------------------------- /assets/ui/icons/src/content-paste.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/textures/floor.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/floor.png-bc19f2b688ab458014752317127027f7.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/textures/floor.png" 10 | dest_files=[ "res://.import/floor.png-bc19f2b688ab458014752317127027f7.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /assets/textures/hint.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/hint.png-b876bac3886521203956b00f63bda60d.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/textures/hint.png" 10 | dest_files=[ "res://.import/hint.png-b876bac3886521203956b00f63bda60d.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /assets/textures/skip.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/skip.png-caac7b5e93ecc2c1552650bc14c6dc0f.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/textures/skip.png" 10 | dest_files=[ "res://.import/skip.png-caac7b5e93ecc2c1552650bc14c6dc0f.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /assets/textures/wall.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/wall.png-35b80c25b8f7299ed1631f28676b0e6a.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/textures/wall.png" 10 | dest_files=[ "res://.import/wall.png-35b80c25b8f7299ed1631f28676b0e6a.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /assets/textures/nodraw.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/nodraw.png-2c819abfd311026f0ca3f457ceada256.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/textures/nodraw.png" 10 | dest_files=[ "res://.import/nodraw.png-2c819abfd311026f0ca3f457ceada256.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /assets/textures/trigger.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/trigger.png-67d016d3fde069341ca37c157f6f4b2a.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/textures/trigger.png" 10 | dest_files=[ "res://.import/trigger.png-67d016d3fde069341ca37c157f6f4b2a.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /assets/ui/icons/close-thick.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/close-thick.png-41e602880cfe19729e869ed9ee56e9dd.image" 6 | 7 | [deps] 8 | 9 | source_file="res://assets/ui/icons/close-thick.png" 10 | dest_files=[ "res://.import/close-thick.png-41e602880cfe19729e869ed9ee56e9dd.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /addons/imgui-godot/imgui-icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="image" 4 | type="Image" 5 | path="res://.import/imgui-icon.png-8a48b8bc56072526ca8c04427759b63d.image" 6 | 7 | [deps] 8 | 9 | source_file="res://addons/imgui-godot/imgui-icon.png" 10 | dest_files=[ "res://.import/imgui-icon.png-8a48b8bc56072526ca8c04427759b63d.image" ] 11 | 12 | [params] 13 | 14 | -------------------------------------------------------------------------------- /scripts/UI/Controls/View3D.cs: -------------------------------------------------------------------------------- 1 | /* 2 | (C) 2022 by K. "Ashifolfi" J. 3 | */ 4 | 5 | using Godot; 6 | using Chisel; 7 | 8 | public class View3D : Panel 9 | { 10 | private void _on_ViewportContainer_mouse_entered() 11 | { 12 | Globals.In3DView = true; 13 | } 14 | 15 | public void _on_ViewportContainer_mouse_exited() 16 | { 17 | Globals.In3DView = false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /assets/ui/icons/src/cursor-default.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/tag.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/UI/Menus/App.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | 4 | public class App : MenuButton 5 | { 6 | PopupMenu Popup; 7 | 8 | public override void _Ready() 9 | { 10 | Popup = GetPopup(); 11 | Popup.Connect("id_pressed", GetNode("."), "_OnIDPressed"); 12 | } 13 | 14 | private void _OnIDPressed(int ID) 15 | { 16 | switch(ID) 17 | { 18 | case 0: 19 | GetTree().Quit(); 20 | break; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scripts/UI/Controls/TextureRadio.cs: -------------------------------------------------------------------------------- 1 | /* 2 | TextureRadio 3 | 4 | Custom button that contains a dictionary used to change active texture 5 | 6 | (C) 2022 by K. "Ashifolfi" J. 7 | */ 8 | 9 | using Godot; 10 | using Godot.Collections; 11 | using System; 12 | 13 | public class TextureRadio : CheckButton 14 | { 15 | [Export] public Dictionary HasTexture; 16 | [Export] public String TextureName; 17 | } -------------------------------------------------------------------------------- /scripts/UI/Menus/Help.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Chisel; 4 | 5 | public class Help : MenuButton 6 | { 7 | PopupMenu Popup; 8 | 9 | public override void _Ready() 10 | { 11 | Popup = GetPopup(); 12 | Popup.Connect("id_pressed", GetNode("."), "_OnIDPressed"); 13 | } 14 | 15 | private void _OnIDPressed(int ID) 16 | { 17 | switch(ID) 18 | { 19 | case 0: 20 | GetNode(Globals.RootPath + "Editor/About").Popup_(); 21 | break; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /assets/ui/icons/src/cube-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/rotate-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/ui/icons/src/close-thick.svg: -------------------------------------------------------------------------------- 1 | 2 | 10 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /addons/vmflib/VMFDataManager.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | 3 | var ENTITY_COUNT: int = 0 4 | var WORLD_COUNT: int = 0 5 | var SOLID_COUNT: int = 0 6 | var SIDE_COUNT: int = 0 7 | var GROUP_COUNT: int = 0 8 | var VISGROUP_COUNT: int = 0 9 | 10 | static func resetValues() -> void: 11 | VMFDataManager.ENTITY_COUNT = 0 12 | VMFDataManager.WORLD_COUNT = 0 13 | VMFDataManager.SOLID_COUNT = 0 14 | VMFDataManager.SIDE_COUNT = 0 15 | VMFDataManager.GROUP_COUNT = 0 16 | VMFDataManager.VISGROUP_COUNT = 0 17 | 18 | 19 | var DEFAULT_MATERIAL = "TOOLS/TOOLSNODRAW" 20 | -------------------------------------------------------------------------------- /addons/vmflib/examples/Example2.gd: -------------------------------------------------------------------------------- 1 | extends Button 2 | 3 | 4 | func _on_pressed() -> void: 5 | var vmf = VMF.new(VMF.GAMES.PORTAL_2) 6 | 7 | vmf.add_solid(VMF.Block.new(Vector3(0, 0, 0), Vector3(256, 256, 256)).set_material_side(vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A, Vector3.UP).brush) 8 | 9 | var info_player_start = VMF.Entities.Common.InfoPlayerStartEntity.new(vmf) 10 | 11 | vmf.write_vmf("user://output.vmf") 12 | 13 | get_parent().get_node("Label2").show() 14 | get_parent().get_node("Button2").show() 15 | 16 | 17 | func _on_Button2_pressed() -> void: 18 | OS.shell_open(OS.get_user_data_dir()) 19 | -------------------------------------------------------------------------------- /newUI.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=4 format=2] 2 | 3 | [ext_resource path="res://assets/ui/ui.theme" type="Theme" id=1] 4 | [ext_resource path="res://scripts/UINew/EditorMain.cs" type="Script" id=2] 5 | [ext_resource path="res://addons/imgui-godot/ImGuiNode.cs" type="Script" id=3] 6 | 7 | [node name="RootNode" type="Panel"] 8 | anchor_right = 1.0 9 | anchor_bottom = 1.0 10 | theme = ExtResource( 1 ) 11 | script = ExtResource( 2 ) 12 | 13 | [node name="ImGuiNode" type="Node2D" parent="."] 14 | script = ExtResource( 3 ) 15 | 16 | [connection signal="IGLayout" from="ImGuiNode" to="." method="_on_ImGuiNode_IGLayout"] 17 | -------------------------------------------------------------------------------- /Chisel.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net472 4 | true 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Godot-specific ignores 2 | .import/ 3 | export.cfg 4 | export_presets.cfg 5 | 6 | # Imported translations (automatically generated from CSV files) 7 | *.translation 8 | 9 | # Mono-specific ignores 10 | .mono/ 11 | data_*/ 12 | 13 | # Rider specific ignores 14 | .idea/ 15 | 16 | # DO NOT TRANSFER THE TESTING VTF FILES 17 | # THEY ARE FROM A RETAIL VALVE GAME 18 | /assets/textures/dev_measuregeneric01.vtf 19 | /assets/textures/dev_measuregeneric01b.vtf 20 | /assets/textures/dev_measurewall01a.vtf 21 | /assets/textures/dev_measurewall01b.vtf 22 | /assets/textures/dev_measurewall01c.vtf 23 | /assets/textures/dev_measurewall01d.vtf -------------------------------------------------------------------------------- /scripts/UINew/StatusBar.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Vector2 = System.Numerics.Vector2; 4 | using ImGuiNET; 5 | 6 | namespace Chisel.scripts.UINew 7 | { 8 | public class StatusBar : Node 9 | { 10 | public Boolean show = false; 11 | 12 | public override void _Ready() 13 | { 14 | Node ImGuiNode = GetNode("/root/RootNode/ImGuiNode"); 15 | ImGuiNode.Connect("IGLayout", GetNode("."), "_on_ImGuiNode_IGLayout"); 16 | } 17 | 18 | private void _on_ImGuiNode_IGLayout() 19 | { 20 | if (show == false) 21 | { 22 | return; 23 | } 24 | // Insert ImGui Code 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /scripts/UINew/Docks/SelectionOptions.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Vector2 = System.Numerics.Vector2; 4 | using ImGuiNET; 5 | 6 | namespace Chisel.scripts.UINew.Docks 7 | { 8 | public class SelectionOptions : Node 9 | { 10 | public Boolean show = false; 11 | 12 | public override void _Ready() 13 | { 14 | Node ImGuiNode = GetNode("/root/RootNode/ImGuiNode"); 15 | ImGuiNode.Connect("IGLayout", GetNode("."), "_on_ImGuiNode_IGLayout"); 16 | } 17 | 18 | private void _on_ImGuiNode_IGLayout() 19 | { 20 | if (show == false) 21 | { 22 | return; 23 | } 24 | // Insert ImGui Code 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /RootPanelTest.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=4 format=2] 2 | 3 | [ext_resource path="res://scripts/UI/RootPanel.cs" type="Script" id=1] 4 | [ext_resource path="res://scripts/UI/WindowDockContainer.cs" type="Script" id=2] 5 | [ext_resource path="res://scripts/UI/DockableDialog.cs" type="Script" id=3] 6 | 7 | [node name="UI" type="Panel"] 8 | anchor_right = 1.0 9 | anchor_bottom = 1.0 10 | script = ExtResource( 1 ) 11 | 12 | [node name="WindowDockContainer" type="PanelContainer" parent="."] 13 | anchor_bottom = 1.0 14 | margin_right = 315.0 15 | script = ExtResource( 2 ) 16 | 17 | [node name="WindowDialog" type="WindowDialog" parent="."] 18 | visible = true 19 | margin_left = 526.0 20 | margin_top = 235.0 21 | margin_right = 806.0 22 | margin_bottom = 438.0 23 | script = ExtResource( 3 ) 24 | -------------------------------------------------------------------------------- /assets/ui/mb-bg.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/mb-bg.png-1e5dd1fce14de21c0db052ed6396d38c.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://assets/ui/mb-bg.png" 13 | dest_files=[ "res://.import/mb-bg.png-1e5dd1fce14de21c0db052ed6396d38c.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | process/normal_map_invert_y=false 32 | stream=false 33 | size_limit=0 34 | detect_3d=true 35 | svg/scale=1.0 36 | -------------------------------------------------------------------------------- /scripts/UI/Menus/File.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Chisel; 4 | 5 | public class File : MenuButton 6 | { 7 | FileManager FileManager; 8 | PopupMenu Popup; 9 | 10 | public override void _Ready() 11 | { 12 | FileManager = GetNode(Globals.RootPath + "Editor/FileManager"); 13 | Popup = GetPopup(); 14 | Popup.Connect("id_pressed", GetNode("."), "_OnIDPressed"); 15 | } 16 | 17 | private void _OnIDPressed(int ID) 18 | { 19 | switch(ID) 20 | { 21 | // New Map 22 | case 0: 23 | GetNode(Globals.RootPath + "Editor/Main/ToolsView/View3D").Visible = true; 24 | break; 25 | // New Map from Template 26 | case 1: 27 | break; 28 | // Open Map 29 | case 2: 30 | FileManager.OpenMap(); 31 | break; 32 | // Save Map 33 | case 4: 34 | FileManager.SaveMap(); 35 | break; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /scripts/UI/Controls/ViewportContainerHack.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ViewportContainer Hack 3 | 4 | Because inputs aren't passed down to viewports by default apparently 5 | 6 | Taken from https://github.com/godotengine/godot/issues/17326#issuecomment-431186323 7 | Converted to C# by K. "Ashifolfi" J. 8 | */ 9 | using Godot; 10 | using System; 11 | using Chisel; 12 | 13 | public class ViewportContainerHack : ViewportContainer 14 | { 15 | public override void _Input(InputEvent @event) 16 | { 17 | if (Globals.In3DView == true) 18 | { 19 | if (@event is InputEventMouse) 20 | { 21 | InputEvent MouseEvent = (InputEvent)@event.Duplicate(); 22 | MouseEvent.Set("position", GetGlobalTransform().XformInv((Vector2)@event.Get("global_position"))); 23 | GetNode("Viewport").UnhandledInput(MouseEvent); 24 | } 25 | else 26 | { 27 | GetNode("Viewport").UnhandledInput(@event); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

Chisel

4 |

5 | A multiplatform, godot-based level editor. 6 | 7 | Engine/Game Support: 8 | - Source [HEAVILY WIP, NO VMF,MDL,VMT SUPPORT] 9 | 10 |
11 |

Requirements

12 | 13 | ### Hardware requirements 14 | - GLES3/OpenGL 3.3+ Supported hardware 15 |
16 |
17 | 18 | ### Global Development requirements 19 | - a C# supporting IDE 20 | - Godot v3.x (>=3.4.4) 21 | 22 | ### Source engine specific requirements 23 | - VTFLib 24 | - VBSP, VRAD, VVIS to allow compiling maps to function 25 | 26 |
27 |

Note for Contributions

28 | All code related to support for games or game engines must use only information that was given to the public by the original developers. Leaked code will not be accepted. 29 | 30 | ***This project is written in C# exclusively. GDScript contributions will be rejected and requested to be converted into C#.*** 31 | -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path.s3tc="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.stex" 6 | path.etc2="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.stex" 7 | metadata={ 8 | "imported_formats": [ "s3tc", "etc2" ], 9 | "vram_texture": true 10 | } 11 | 12 | [deps] 13 | 14 | source_file="res://icon.png" 15 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.stex", "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.stex" ] 16 | 17 | [params] 18 | 19 | compress/mode=2 20 | compress/lossy_quality=0.7 21 | compress/hdr_mode=0 22 | compress/bptc_ldr=0 23 | compress/normal_map=0 24 | flags/repeat=true 25 | flags/filter=true 26 | flags/mipmaps=true 27 | flags/anisotropic=false 28 | flags/srgb=2 29 | process/fix_alpha_border=true 30 | process/premult_alpha=false 31 | process/HDR_as_SRGB=false 32 | process/invert_color=false 33 | process/normal_map_invert_y=false 34 | stream=false 35 | size_limit=0 36 | detect_3d=false 37 | svg/scale=1.0 38 | -------------------------------------------------------------------------------- /assets/textures/grid.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path.s3tc="res://.import/grid.png-76362706b7cff8d966c77743dd03cd1f.s3tc.stex" 6 | path.etc2="res://.import/grid.png-76362706b7cff8d966c77743dd03cd1f.etc2.stex" 7 | metadata={ 8 | "imported_formats": [ "s3tc", "etc2" ], 9 | "vram_texture": true 10 | } 11 | 12 | [deps] 13 | 14 | source_file="res://assets/textures/grid.png" 15 | dest_files=[ "res://.import/grid.png-76362706b7cff8d966c77743dd03cd1f.s3tc.stex", "res://.import/grid.png-76362706b7cff8d966c77743dd03cd1f.etc2.stex" ] 16 | 17 | [params] 18 | 19 | compress/mode=2 20 | compress/lossy_quality=0.7 21 | compress/hdr_mode=0 22 | compress/bptc_ldr=0 23 | compress/normal_map=0 24 | flags/repeat=true 25 | flags/filter=true 26 | flags/mipmaps=true 27 | flags/anisotropic=false 28 | flags/srgb=1 29 | process/fix_alpha_border=true 30 | process/premult_alpha=false 31 | process/HDR_as_SRGB=false 32 | process/invert_color=false 33 | process/normal_map_invert_y=false 34 | stream=false 35 | size_limit=0 36 | detect_3d=false 37 | svg/scale=1.0 38 | -------------------------------------------------------------------------------- /Chisel.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2012 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chisel", "Chisel.csproj", "{CA256F02-78B3-4AF1-B48A-497E2C895BD5}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Any CPU = Debug|Any CPU 8 | ExportDebug|Any CPU = ExportDebug|Any CPU 9 | ExportRelease|Any CPU = ExportRelease|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CA256F02-78B3-4AF1-B48A-497E2C895BD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {CA256F02-78B3-4AF1-B48A-497E2C895BD5}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {CA256F02-78B3-4AF1-B48A-497E2C895BD5}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU 15 | {CA256F02-78B3-4AF1-B48A-497E2C895BD5}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU 16 | {CA256F02-78B3-4AF1-B48A-497E2C895BD5}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU 17 | {CA256F02-78B3-4AF1-B48A-497E2C895BD5}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /scripts/UINew/Dialogs/GameConfigSelect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Godot; 3 | using ImGuiNET; 4 | 5 | namespace Chisel.scripts.UINew.Dialogs 6 | { 7 | public class GameConfigSelect : Node 8 | { 9 | public Boolean show; 10 | 11 | public override void _Ready() 12 | { 13 | show = false; 14 | } 15 | 16 | private void _on_ImGuiNode_IGLayout() 17 | { 18 | if (show == true) 19 | { 20 | ImGui.OpenPopup("Select Game Configuration"); 21 | } 22 | if (ImGui.BeginPopup("Select Game Configuration", 23 | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize)) 24 | { 25 | ImGui.SetWindowPos(new System.Numerics.Vector2( 26 | (OS.WindowSize.x / 2) - ImGui.GetWindowSize().X / 2, 27 | (OS.WindowSize.y / 2) - ImGui.GetWindowSize().Y / 2 28 | )); 29 | ImGui.Dummy(new System.Numerics.Vector2(320f, 320f)); 30 | ImGui.EndPopup(); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /scripts/UI/Menus/View.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Chisel; 4 | 5 | public class View : MenuButton 6 | { 7 | PopupMenu Popup; 8 | 9 | public override void _Ready() 10 | { 11 | Popup = GetPopup(); 12 | Popup.Connect("id_pressed", GetNode("."), "_OnIDPressed"); 13 | } 14 | 15 | private void _OnIDPressed(int ID) 16 | { 17 | switch(ID) 18 | { 19 | case 0: 20 | Panel View3D = GetNode(Globals.RootPath + "Editor/Main/ToolsView/View3D"); 21 | Panel Top2D = GetNode(Globals.RootPath + "Editor/Main/ToolsView/2DTop"); 22 | Panel Side2D = GetNode(Globals.RootPath + "Editor/Main/ToolsView/2DSide"); 23 | Panel Front2D = GetNode(Globals.RootPath + "Editor/Main/ToolsView/2DFront"); 24 | if (Globals.Enable2DView == true) 25 | { 26 | View3D.Visible = true; 27 | Top2D.Visible = true; 28 | Side2D.Visible = true; 29 | Front2D.Visible = true; 30 | View3D.RectSize = new Vector2(624, 359); 31 | } 32 | else 33 | { 34 | View3D.Visible = false; 35 | Top2D.Visible = false; 36 | Side2D.Visible = false; 37 | Front2D.Visible = false; 38 | View3D.RectSize = new Vector2(1249, 709); 39 | } 40 | break; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scripts/Utilities/MeshManager.cs: -------------------------------------------------------------------------------- 1 | /* 2 | MeshManager 3 | 4 | Handles anything that's done to already existing map objects 5 | 6 | (C) 2022 by K. "Ashifolfi" J. 7 | */ 8 | 9 | using Godot; 10 | using Godot.Collections; 11 | using System; 12 | using Chisel; 13 | using static Chisel.Utilities; 14 | 15 | public class MeshManager : Spatial 16 | { 17 | [Export] 18 | public StaticBody SelectedMesh; 19 | [Export] 20 | public Dictionary MeshList = new Dictionary(); 21 | 22 | public void DeleteMesh(StaticBody Body) 23 | { 24 | // Check to make sure we aren't about to destroy something we absolutely 25 | // should NOT be destroying. Crash if we are to prevent any dangerous things from happening 26 | Assert((Body.GetClass() == "StaticBody"), "Attempted to delete non valid object from map!"); 27 | if (IsInstanceValid(Body.GetParent())) 28 | { 29 | Body.GetParent().QueueFree(); 30 | SelectedMesh = null; 31 | } 32 | else 33 | { 34 | GD.Print("[WARN] Attempted to delete_mesh non-valid parent! File may be corrupt!"); 35 | } 36 | } 37 | 38 | public void TransformMesh(StaticBody Body) 39 | { 40 | // STUB 41 | } 42 | } -------------------------------------------------------------------------------- /scripts/UI/Docks/ToolsDock.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ToolsDock 3 | * 4 | * Contains the tool buttons 5 | * 6 | * TODO: Add layout constraints 7 | * TODO: Add icons for tools 8 | * 9 | * (C) 2022 by K. "Ashifolfi" J. 10 | */ 11 | using Godot; 12 | 13 | namespace Chisel.UI 14 | { 15 | public class ToolsDock : Node 16 | { 17 | private MeshManager MeshManager; 18 | 19 | public override void _Ready() 20 | { 21 | base._Ready(); 22 | MeshManager = GetNode(Globals.RootPath + "Editor/3dEnv/MeshManager"); 23 | } 24 | 25 | public override void _Process(float delta) 26 | { 27 | base._Process(delta); 28 | 29 | } 30 | 31 | private void _on_CreateCube_pressed() 32 | { 33 | GetNode(Globals.RootPath + "Editor/CubeCreate").Popup_(); 34 | } 35 | 36 | private void _on_Select_pressed() 37 | { 38 | MeshManager.SelectedMesh = null; 39 | } 40 | 41 | private void _on_Delete_pressed() 42 | { 43 | if (MeshManager.SelectedMesh != null) 44 | { 45 | MeshManager.DeleteMesh(MeshManager.SelectedMesh); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /scripts/3DEnvironment/Gizmo.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Chisel; 4 | 5 | public class Gizmo : Spatial 6 | { 7 | private StaticBody XArrow; 8 | private StaticBody YArrow; 9 | private StaticBody ZArrow; 10 | 11 | private MeshManager MeshManager; 12 | 13 | // Called when the node enters the scene tree for the first time. 14 | public override void _Ready() 15 | { 16 | // Setup variables to contain the gizmo arrows 17 | XArrow = GetNode("XArrow"); 18 | YArrow = GetNode("YArrow"); 19 | ZArrow = GetNode("ZArrow"); 20 | 21 | // Get the MeshManager 22 | MeshManager = GetNode(Globals.RootPath + "Editor/3dEnv/MeshManager"); 23 | 24 | // Make ourselves invisible 25 | Visible = false; 26 | } 27 | 28 | public override void _Process(float delta) 29 | { 30 | base._Process(delta); 31 | if (MeshManager.SelectedMesh != null) 32 | { 33 | MeshInstance SelMeshParent = (MeshInstance)MeshManager.SelectedMesh.GetParent(); 34 | Translation = SelMeshParent.Translation; 35 | Visible = true; 36 | } 37 | else 38 | { 39 | Visible = false; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /addons/vmflib/examples/Example1.gd: -------------------------------------------------------------------------------- 1 | extends Button 2 | 3 | 4 | func _on_pressed() -> void: 5 | var vmf = VMF.new(VMF.GAMES.PORTAL_2) 6 | 7 | vmf.add_solid(VMF.Block.new(Vector3(0, -32, 0), Vector3(512, 64, 512), vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A).brush) 8 | vmf.add_solid(VMF.Block.new(Vector3(0, 256 + 32, 0), Vector3(512, 64, 512), vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A).brush) 9 | 10 | vmf.add_solid(VMF.Block.new(Vector3(0, 128, 256 + 32), Vector3(512, 256, 64), vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A).brush) 11 | vmf.add_solid(VMF.Block.new(Vector3(0, 128, -256 - 32), Vector3(512, 256, 64), vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A).brush) 12 | 13 | vmf.add_solid(VMF.Block.new(Vector3(256 + 32, 128, 0), Vector3(64, 256, 512), vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A).brush) 14 | vmf.add_solid(VMF.Block.new(Vector3(-256 - 32, 128, 0), Vector3(64, 256, 512), vmf.COMMON_MATERIALS.DEV_MEASUREWALL01A).brush) 15 | 16 | var info_player_start = VMF.Entities.Common.InfoPlayerStartEntity.new(vmf) 17 | var light = VMF.Entities.Common.LightEntity.new(vmf, Vector3(0,128,0)) 18 | 19 | vmf.write_vmf("user://output.vmf") 20 | 21 | get_parent().get_node("Label2").show() 22 | get_parent().get_node("Button2").show() 23 | 24 | 25 | func _on_Button2_pressed() -> void: 26 | OS.shell_open(OS.get_user_data_dir()) 27 | -------------------------------------------------------------------------------- /addons/vmflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021, Brendan Lewis 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /addons/imgui-godot/ImGuiNode.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using System.Collections.Generic; 4 | using ImGuiNET; 5 | 6 | public class ImGuiNode : Node2D 7 | { 8 | [Export] 9 | DynamicFont Font = null; 10 | 11 | [Signal] 12 | public delegate void IGLayout(); 13 | 14 | public virtual void Init(ImGuiIOPtr io) 15 | { 16 | if (Font is null) 17 | { 18 | io.Fonts.AddFontDefault(); 19 | } 20 | else 21 | { 22 | ImGuiGD.AddFont(Font); 23 | } 24 | ImGuiGD.RebuildFontAtlas(); 25 | } 26 | 27 | public virtual void Layout() 28 | { 29 | EmitSignal(nameof(IGLayout)); 30 | } 31 | 32 | public override void _EnterTree() 33 | { 34 | ImGuiGD.Init(GetViewport()); 35 | Init(ImGui.GetIO()); 36 | } 37 | 38 | public override void _Process(float delta) 39 | { 40 | if (Visible) 41 | { 42 | ImGuiGD.Update(delta, GetViewport()); 43 | Layout(); 44 | ImGuiGD.Render(GetCanvasItem()); 45 | } 46 | } 47 | 48 | public override void _Input(InputEvent evt) 49 | { 50 | if (Visible && ImGuiGD.ProcessInput(evt)) 51 | { 52 | GetTree().SetInputAsHandled(); 53 | } 54 | } 55 | 56 | public override void _ExitTree() 57 | { 58 | ImGuiGD.Shutdown(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2022, K. "Ashifolfi" J. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=4 10 | 11 | _global_script_classes=[ { 12 | "base": "Node", 13 | "class": "VMF", 14 | "language": "GDScript", 15 | "path": "res://addons/vmflib/VMF.gd" 16 | } ] 17 | _global_script_class_icons={ 18 | "VMF": "" 19 | } 20 | 21 | [application] 22 | 23 | config/name="Chisel" 24 | config/description="Open Source, Cross Platform alternative to Valve's Hammer Editor for Source Engine" 25 | run/main_scene="res://newUI.tscn" 26 | config/use_custom_user_dir=true 27 | config/custom_user_dir_name="chisel-data" 28 | boot_splash/image="res://icon.png" 29 | boot_splash/fullsize=false 30 | config/icon="res://icon.png" 31 | 32 | [display] 33 | 34 | window/size/width=1366 35 | window/size/height=768 36 | window/size/test_width=1280 37 | window/size/test_height=720 38 | 39 | [editor_plugins] 40 | 41 | enabled=PoolStringArray( "res://addons/imgui-godot/plugin.cfg", "res://addons/vmflib/plugin.cfg" ) 42 | 43 | [locale] 44 | 45 | translations=PoolStringArray( ) 46 | locale_filter=[ 0, [ ] ] 47 | 48 | [physics] 49 | 50 | common/enable_pause_aware_picking=true 51 | 52 | [rendering] 53 | 54 | environment/default_environment="res://default_env.tres" 55 | -------------------------------------------------------------------------------- /scripts/3DEnvironment/SelectableMesh.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Selectable Object 3 | 4 | (C) 2022 by K. "AshiFolfi" J. 5 | */ 6 | 7 | using Godot; 8 | using System; 9 | using Chisel; 10 | 11 | public class SelectableMesh : StaticBody 12 | { 13 | MeshManager MeshManager; 14 | 15 | public override void _Ready() 16 | { 17 | MeshManager = GetNode(Globals.RootPath + "Editor/3dEnv/MeshManager"); 18 | } 19 | 20 | public override void _Process(float delta) 21 | { 22 | if (MeshManager.SelectedMesh != GetNode("./")) 23 | { 24 | Material Mat = GetNode("../").GetSurfaceMaterial(0); 25 | Mat.NextPass = null; 26 | } 27 | } 28 | 29 | public void _OnSelected(Node Camera, InputEvent @event, Vector2 Position, Vector3 Normal, int ShapeIdx) 30 | { 31 | if (@event is InputEventMouseButton) 32 | { 33 | switch ((ButtonList)@event.Get("button_index")) 34 | { 35 | case ButtonList.Left: 36 | MeshManager.SelectedMesh = GetNode("./"); 37 | Material Mat = GetNode("../").GetSurfaceMaterial(0); 38 | ShaderMaterial ShadMat = new ShaderMaterial(); 39 | ShadMat.Shader = (Shader)GD.Load("res://assets/shaders/selected_mesh.shader"); 40 | Mat.NextPass = ShadMat; 41 | break; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /scripts/UINew/Docks/Outline.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Outliner 3 | * 4 | * Displays every entity and brush inside the map along with their names 5 | * 6 | * (C) 2022 by K. "ashifolfi" J. 7 | */ 8 | using Godot; 9 | using System; 10 | using Vector2 = System.Numerics.Vector2; 11 | using ImGuiNET; 12 | 13 | namespace Chisel.scripts.UINew.Docks 14 | { 15 | public class Outline : Node 16 | { 17 | public Boolean show = true; 18 | 19 | public override void _Ready() 20 | { 21 | Node ImGuiNode = GetNode("/root/RootNode/ImGuiNode"); 22 | ImGuiNode.Connect("IGLayout", GetNode("."), "_on_ImGuiNode_IGLayout"); 23 | } 24 | 25 | private void _on_ImGuiNode_IGLayout() 26 | { 27 | if (show == false) 28 | { 29 | return; 30 | } 31 | 32 | ImGui.Begin("Outliner", ref show, ImGuiWindowFlags.NoCollapse); 33 | 34 | // Upper options 35 | ImGui.Text("Filter: "); 36 | ImGui.SameLine(); 37 | String Input = ""; 38 | ImGui.InputText("", ref Input, UInt32.MaxValue); 39 | Boolean dummy1 = false; 40 | Boolean dummy2 = false; 41 | ImGui.Checkbox("Include hidden objects", ref dummy1); 42 | ImGui.Checkbox("Show object IDs", ref dummy2); 43 | 44 | // Actual map outline 45 | 46 | ImGui.End(); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /scripts/UINew/Docks/ToolProperties.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using Vector2 = System.Numerics.Vector2; 4 | using ImGuiNET; 5 | 6 | namespace Chisel.scripts.UINew.Docks 7 | { 8 | public class ToolProperties : Node 9 | { 10 | public Boolean show = true; 11 | 12 | public override void _Ready() 13 | { 14 | Node ImGuiNode = GetNode("/root/RootNode/ImGuiNode"); 15 | ImGuiNode.Connect("IGLayout", GetNode("."), "_on_ImGuiNode_IGLayout"); 16 | } 17 | 18 | private void _on_ImGuiNode_IGLayout() 19 | { 20 | if (show == false) 21 | { 22 | return; 23 | } 24 | 25 | ImGui.Begin("Tool Properties", ref show, ImGuiWindowFlags.NoCollapse); 26 | 27 | // Show the current Tool's Properties 28 | switch (Globals.ToolsMode) 29 | { 30 | case "ObjEdit": 31 | Docks.Properties.ObjEdit.Dock(); 32 | break; 33 | case "Entities": 34 | Docks.Properties.Entities.Dock(); 35 | break; 36 | case "CreatePrimitive": 37 | Docks.Properties.CreatePrimitive.Dock(); 38 | break; 39 | } 40 | 41 | //ImGui.Dummy(new Vector2(100, 320)); 42 | 43 | ImGui.End(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /imguiviewporttest.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=5 format=2] 2 | 3 | [ext_resource path="res://addons/imgui-godot/ImGuiNode.cs" type="Script" id=1] 4 | [ext_resource path="res://imguiviewporttest.cs" type="Script" id=2] 5 | [ext_resource path="res://scripts/3DEnvironment/FreeCam.cs" type="Script" id=3] 6 | 7 | [sub_resource type="CubeMesh" id=1] 8 | 9 | [node name="Control" type="Control"] 10 | anchor_right = 1.0 11 | anchor_bottom = 1.0 12 | script = ExtResource( 2 ) 13 | 14 | [node name="ViewportContainer" type="ViewportContainer" parent="."] 15 | margin_right = 800.0 16 | margin_bottom = 600.0 17 | 18 | [node name="Viewport" type="Viewport" parent="ViewportContainer"] 19 | size = Vector2( 800, 600 ) 20 | size_override_stretch = true 21 | handle_input_locally = false 22 | render_target_v_flip = true 23 | render_target_update_mode = 3 24 | physics_object_picking = true 25 | 26 | [node name="Camera" type="Camera" parent="ViewportContainer/Viewport"] 27 | transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3.89414 ) 28 | script = ExtResource( 3 ) 29 | 30 | [node name="MeshInstance" type="MeshInstance" parent="ViewportContainer/Viewport"] 31 | transform = Transform( 0.577832, 0, 0, 0, 0.577832, 0, 0, 0, 0.577832, 0, 0, -0.298568 ) 32 | mesh = SubResource( 1 ) 33 | skeleton = NodePath("../Camera") 34 | material/0 = null 35 | 36 | [node name="ImGuiNode" type="Node2D" parent="."] 37 | script = ExtResource( 1 ) 38 | 39 | [connection signal="IGLayout" from="ImGuiNode" to="." method="_on_ImGuiNode_IGLayout"] 40 | -------------------------------------------------------------------------------- /scripts/UINew/Dialogs/AssetBrowser/TextureBrowser.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * TextureBrowser 3 | * 4 | * Allows the user to view every texture found inside mounted game content 5 | * and change the active texture. 6 | * 7 | * Part of the AssetBrowser component 8 | * 9 | * (C) 2022 by K. "ashifolfi" J. 10 | */ 11 | using Godot; 12 | using System; 13 | using System.Collections.Generic; 14 | using Vector2 = System.Numerics.Vector2; 15 | using ImGuiNET; 16 | 17 | namespace Chisel.scripts.UINew.Dialogs.AssetBrowser 18 | { 19 | public class TextureBrowser 20 | { 21 | public Boolean show = false; 22 | 23 | public static void TextureBrowser_Main(AssetManager AssetManager) 24 | { 25 | ImGui.Columns(3); 26 | 27 | foreach (String Tex in AssetManager.TextureList.Keys) 28 | { 29 | ImageTexture Material; 30 | AssetManager.TextureList[Tex].TryGetValue("texture", out Material); 31 | IntPtr MatID = ImGuiGD.BindTexture(Material); 32 | 33 | ImGui.ImageButton(MatID, new Vector2(128, 128)); 34 | if (ImGui.IsItemActivated()) 35 | { 36 | AssetManager.ActiveTexture = AssetManager.TextureList[Tex]; 37 | AssetManager.ActiveTextureName = Tex; 38 | GD.Print(Tex); 39 | GD.Print(Material); 40 | } 41 | 42 | ImGui.NextColumn(); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Spatial.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=6 format=2] 2 | 3 | [sub_resource type="GDScript" id=3] 4 | script/source = "extends StaticBody 5 | 6 | 7 | func _on_StaticBody_input_event(camera, event, position, normal, shape_idx): 8 | if event is InputEventMouseMotion: 9 | get_node(\"../MeshInstance2\").translation = position 10 | " 11 | 12 | [sub_resource type="PlaneMesh" id=1] 13 | 14 | [sub_resource type="BoxShape" id=2] 15 | extents = Vector3( 1, 0.0102573, 1 ) 16 | 17 | [sub_resource type="CubeMesh" id=4] 18 | 19 | [sub_resource type="SpatialMaterial" id=5] 20 | albedo_color = Color( 1, 0, 0, 1 ) 21 | 22 | [node name="Spatial" type="Spatial"] 23 | 24 | [node name="StaticBody" type="StaticBody" parent="."] 25 | transform = Transform( 2.51871, 0, 0, 0, 2.51871, 0, 0, 0, 2.51871, 0, 0, 0 ) 26 | script = SubResource( 3 ) 27 | 28 | [node name="MeshInstance" type="MeshInstance" parent="StaticBody"] 29 | mesh = SubResource( 1 ) 30 | skeleton = NodePath("../..") 31 | material/0 = null 32 | 33 | [node name="CollisionShape" type="CollisionShape" parent="StaticBody"] 34 | shape = SubResource( 2 ) 35 | 36 | [node name="MeshInstance2" type="MeshInstance" parent="."] 37 | transform = Transform( 0.422921, 0, 0, 0, 0.422921, 0, 0, 0, 0.422921, 0, 0, 0 ) 38 | mesh = SubResource( 4 ) 39 | material/0 = SubResource( 5 ) 40 | 41 | [node name="Camera" type="Camera" parent="."] 42 | transform = Transform( 1, 0, 0, 0, 0.914678, 0.404184, 0, -0.404184, 0.914678, 0, 2.86629, 4.4128 ) 43 | 44 | [connection signal="input_event" from="StaticBody" to="StaticBody" method="_on_StaticBody_input_event"] 45 | -------------------------------------------------------------------------------- /imgui.ini: -------------------------------------------------------------------------------- 1 | [Window][Debug##Default] 2 | Pos=272,80 3 | Size=525,471 4 | Collapsed=0 5 | 6 | [Window][Tools] 7 | Pos=0,19 8 | Size=65,701 9 | Collapsed=0 10 | DockId=0x00000003,0 11 | 12 | [Window][DockSpaceViewport_11111111] 13 | Pos=0,19 14 | Size=1280,701 15 | Collapsed=0 16 | 17 | [Window][Asset Browser] 18 | Pos=253,105 19 | Size=640,541 20 | Collapsed=0 21 | 22 | [Window][Viewport Test] 23 | Pos=200,63 24 | Size=800,600 25 | Collapsed=0 26 | 27 | [Window][Active Texture] 28 | Pos=67,514 29 | Size=166,206 30 | Collapsed=0 31 | DockId=0x00000008,0 32 | 33 | [Window][Tool Properties] 34 | Pos=67,19 35 | Size=166,493 36 | Collapsed=0 37 | DockId=0x00000007,0 38 | 39 | [Window][Outliner] 40 | Pos=1005,19 41 | Size=275,701 42 | Collapsed=0 43 | DockId=0x00000002,0 44 | 45 | [Docking][Data] 46 | DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=1280,701 Split=X 47 | DockNode ID=0x00000003 Parent=0x8B93E3BD SizeRef=65,703 Selected=0xD44407B5 48 | DockNode ID=0x00000004 Parent=0x8B93E3BD SizeRef=1299,703 Split=X 49 | DockNode ID=0x00000001 Parent=0x00000004 SizeRef=1089,703 Split=X 50 | DockNode ID=0x00000005 Parent=0x00000001 SizeRef=166,703 Split=Y Selected=0xA9C20E18 51 | DockNode ID=0x00000007 Parent=0x00000005 SizeRef=166,494 Selected=0x177EB6CC 52 | DockNode ID=0x00000008 Parent=0x00000005 SizeRef=166,207 Selected=0xA9C20E18 53 | DockNode ID=0x00000006 Parent=0x00000001 SizeRef=854,703 CentralNode=1 54 | DockNode ID=0x00000002 Parent=0x00000004 SizeRef=275,703 Selected=0x94263E27 55 | 56 | -------------------------------------------------------------------------------- /addons/vmflib/VMFRoot.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | 3 | 4 | var vmf_class_name: String = "UntitledClass" 5 | var properties: Dictionary 6 | var auto_properties: Array 7 | var children: Array 8 | 9 | 10 | func _init(className: String) -> void: 11 | self.properties = {} 12 | self.auto_properties = [] 13 | self.children = [] 14 | self.setVmfClassName(className) 15 | 16 | func getAsStr(tab_level: int = -1) -> String: 17 | var string: String = "" 18 | var tab_prefix: String = "" 19 | for i in range(tab_level): 20 | tab_prefix += "\t" 21 | var tab_prefix_inner = tab_prefix + "\t" 22 | if self.vmf_class_name != "": 23 | string += tab_prefix + self.vmf_class_name + "\n" 24 | string += tab_prefix + "{\n" 25 | for attr_name in self.auto_properties: 26 | var value = self.get(attr_name) 27 | if !(value == null): 28 | string += tab_prefix_inner + "\"" + str(attr_name) + "\" \"" + str(value) + "\"\n" 29 | for key in self.properties.keys(): 30 | string += tab_prefix_inner + "\"" + str(key) + "\" " + "\"" + str(self.properties[key]) + "\"\n" 31 | for child in self.children: 32 | string += child.getAsStr(tab_level + 1) 33 | if self.vmf_class_name != "": 34 | string += tab_prefix + "}\n" 35 | return string 36 | 37 | func setVmfClassName(className: String) -> void: 38 | self.vmf_class_name = className 39 | 40 | func getVmfClassName() -> String: 41 | return self.vmf_class_name 42 | 43 | func getProperties() -> Dictionary: 44 | return self.properties 45 | 46 | func getAutoProperties() -> Array: 47 | return self.auto_properties 48 | 49 | func getChildren() -> Array: 50 | return self.children 51 | -------------------------------------------------------------------------------- /scripts/UI/Dialogs/CubeCreate.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Primitive creation dialog 3 | (C) 2022 K. "Ashifolfi" J. 4 | */ 5 | 6 | using Godot; 7 | using System; 8 | using Chisel; 9 | 10 | 11 | public class CubeCreate : WindowDialog 12 | { 13 | private AssetManager AssetManager; 14 | private MeshBuilder MeshBuilder; 15 | 16 | // Called when the node enters the scene tree for the first time. 17 | public override void _Ready() 18 | { 19 | // Very important nodes we require to create primitives 20 | AssetManager = GetNode(Globals.RootPath + "Editor/AssetManager"); 21 | MeshBuilder = GetNode(Globals.RootPath + "Editor/3dEnv/MeshBuilder"); 22 | } 23 | 24 | private void OnCreatePressed() 25 | { 26 | // Grab and parse location values as floats 27 | Vector3 Pos = new Vector3(); 28 | Pos.x = float.Parse(GetNode("Pos/X/LineEdit").Text); 29 | Pos.y = float.Parse(GetNode("Pos/Y/LineEdit").Text); 30 | Pos.z = float.Parse(GetNode("Pos/Z/LineEdit").Text); 31 | 32 | // Grab and parse scale values as floats 33 | Vector3 Size = new Vector3(); 34 | Size.x = float.Parse(GetNode("Size/W/LineEdit").Text); 35 | Size.y = float.Parse(GetNode("Size/H/LineEdit").Text); 36 | Size.z = float.Parse(GetNode("Size/L/LineEdit").Text); 37 | GD.Print(Size); 38 | GD.Print(Pos); 39 | 40 | // Grab our active texture 41 | ImageTexture name; 42 | AssetManager.ActiveTexture.TryGetValue("texture", out name); 43 | Texture Texture = name; 44 | 45 | // Call the MeshBuilder to create our cube with the provided information 46 | MeshBuilder.CreateCube(Size, Pos, Texture); 47 | 48 | // And hide ourselves 49 | Visible = false; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /addons/vmflib/examples/Example1.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [ext_resource path="res://addons/vmflib/examples/Example1.gd" type="Script" id=1] 4 | 5 | [node name="Example1" type="Control"] 6 | anchor_right = 1.0 7 | anchor_bottom = 1.0 8 | __meta__ = { 9 | "_edit_use_anchors_": false 10 | } 11 | 12 | [node name="CenterContainer" type="CenterContainer" parent="."] 13 | anchor_right = 1.0 14 | anchor_bottom = 1.0 15 | 16 | [node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] 17 | margin_left = 433.0 18 | margin_top = 281.0 19 | margin_right = 590.0 20 | margin_bottom = 319.0 21 | 22 | [node name="Label" type="Label" parent="CenterContainer/VBoxContainer"] 23 | margin_right = 157.0 24 | margin_bottom = 14.0 25 | text = "Generate a simple level:" 26 | align = 1 27 | 28 | [node name="Button" type="Button" parent="CenterContainer/VBoxContainer"] 29 | margin_top = 18.0 30 | margin_right = 157.0 31 | margin_bottom = 38.0 32 | text = "Click Me" 33 | script = ExtResource( 1 ) 34 | 35 | [node name="Label2" type="Label" parent="CenterContainer/VBoxContainer"] 36 | visible = false 37 | margin_top = 42.0 38 | margin_right = 421.0 39 | margin_bottom = 56.0 40 | text = "Your VMF is at %appdata%/Godot/NameOfProjectHere/output.vmf" 41 | align = 1 42 | 43 | [node name="Button2" type="Button" parent="CenterContainer/VBoxContainer"] 44 | visible = false 45 | margin_top = 42.0 46 | margin_right = 157.0 47 | margin_bottom = 62.0 48 | text = "Show VMF" 49 | [connection signal="pressed" from="CenterContainer/VBoxContainer/Button" to="CenterContainer/VBoxContainer/Button" method="_on_pressed"] 50 | [connection signal="pressed" from="CenterContainer/VBoxContainer/Button2" to="CenterContainer/VBoxContainer/Button" method="_on_Button2_pressed"] 51 | -------------------------------------------------------------------------------- /addons/vmflib/examples/Example2.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [ext_resource path="res://addons/vmflib/examples/Example2.gd" type="Script" id=1] 4 | 5 | [node name="Example2" type="Control"] 6 | anchor_right = 1.0 7 | anchor_bottom = 1.0 8 | __meta__ = { 9 | "_edit_use_anchors_": false 10 | } 11 | 12 | [node name="CenterContainer" type="CenterContainer" parent="."] 13 | anchor_right = 1.0 14 | anchor_bottom = 1.0 15 | __meta__ = { 16 | "_edit_use_anchors_": false 17 | } 18 | 19 | [node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] 20 | margin_left = 436.0 21 | margin_top = 281.0 22 | margin_right = 587.0 23 | margin_bottom = 319.0 24 | 25 | [node name="Label" type="Label" parent="CenterContainer/VBoxContainer"] 26 | margin_right = 151.0 27 | margin_bottom = 14.0 28 | text = "Generate a single cube:" 29 | align = 1 30 | 31 | [node name="Button" type="Button" parent="CenterContainer/VBoxContainer"] 32 | margin_top = 18.0 33 | margin_right = 151.0 34 | margin_bottom = 38.0 35 | text = "Click Me" 36 | script = ExtResource( 1 ) 37 | 38 | [node name="Label2" type="Label" parent="CenterContainer/VBoxContainer"] 39 | visible = false 40 | margin_top = 42.0 41 | margin_right = 421.0 42 | margin_bottom = 56.0 43 | text = "Your VMF is at %appdata%/Godot/NameOfProjectHere/output.vmf" 44 | align = 1 45 | 46 | [node name="Button2" type="Button" parent="CenterContainer/VBoxContainer"] 47 | visible = false 48 | margin_top = 42.0 49 | margin_right = 157.0 50 | margin_bottom = 62.0 51 | text = "Show VMF" 52 | [connection signal="pressed" from="CenterContainer/VBoxContainer/Button" to="CenterContainer/VBoxContainer/Button" method="_on_pressed"] 53 | [connection signal="pressed" from="CenterContainer/VBoxContainer/Button2" to="CenterContainer/VBoxContainer/Button" method="_on_Button2_pressed"] 54 | -------------------------------------------------------------------------------- /scripts/UINew/Docks/Tools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Vector2 = System.Numerics.Vector2; 3 | using Godot; 4 | using ImGuiNET; 5 | 6 | namespace Chisel.scripts.UINew.Docks 7 | { 8 | public class Tools : Node 9 | { 10 | public Boolean show = true; 11 | 12 | public override void _Ready() 13 | { 14 | Node ImGuiNode = GetNode("/root/RootNode/ImGuiNode"); 15 | ImGuiNode.Connect("IGLayout", GetNode("."), "_on_ImGuiNode_IGLayout"); 16 | 17 | // Prepare every image texture for the tool buttons 18 | 19 | } 20 | 21 | private void _on_ImGuiNode_IGLayout() 22 | { 23 | if (show == false) 24 | { 25 | return; 26 | } 27 | 28 | ImGui.Begin("Tools", ref show, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.AlwaysAutoResize); 29 | 30 | ImGui.Separator(); 31 | ImGui.Separator(); 32 | // Tool buttons 33 | // Yes all transform tools are separated out because why not 34 | ImGui.Button("Select", new Vector2(50, 50)); 35 | ImGui.Button("Move", new Vector2(50, 50)); 36 | ImGui.Button("Rotate", new Vector2(50, 50)); 37 | ImGui.Button("Scale", new Vector2(50, 50)); 38 | ImGui.Button("Pivot", new Vector2(50, 50)); 39 | ImGui.Separator(); 40 | // Now for the other tools 41 | ImGui.Button("Entities", new Vector2(50, 50)); 42 | ImGui.Button("Brush", new Vector2(50, 50)); 43 | ImGui.Button("Clipping", new Vector2(50, 50)); 44 | ImGui.Button("Apply Texture", new Vector2(50, 50)); 45 | ImGui.Button("Face Edit", new Vector2(50, 50)); 46 | ImGui.Button("Displacement", new Vector2(50, 50)); 47 | ImGui.Button("Sprinkle", new Vector2(50, 50)); 48 | 49 | ImGui.End(); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /imguiviewporttest.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using System; 3 | using ImGuiNET; 4 | using Vector2 = System.Numerics.Vector2; 5 | using Chisel; 6 | 7 | public class imguiviewporttest : Control 8 | { 9 | public Boolean show = true; 10 | 11 | public override void _Ready() 12 | { 13 | 14 | } 15 | 16 | public override void _Process(float delta) 17 | { 18 | 19 | } 20 | 21 | public override void _Input(InputEvent @event) 22 | { 23 | if (@event is InputEventMouse) 24 | { 25 | InputEvent MouseEvent = (InputEvent)@event.Duplicate(); 26 | MouseEvent.Set("position", GetGlobalTransform().XformInv((Godot.Vector2)@event.Get("global_position"))); 27 | GetNode("ViewportContainer/Viewport").UnhandledInput(MouseEvent); 28 | } 29 | else 30 | { 31 | GetNode("ViewportContainer/Viewport").UnhandledInput(@event); 32 | } 33 | } 34 | 35 | private void _on_ImGuiNode_IGLayout() 36 | { 37 | if (show == false) 38 | { 39 | return; 40 | } 41 | 42 | ImGui.Begin("Viewport Test", ref show, ImGuiWindowFlags.None); 43 | 44 | InputHandler(); 45 | 46 | Texture Tex = GetNode("ViewportContainer/Viewport").GetTexture(); 47 | IntPtr TexId = ImGuiGD.BindTexture(Tex); 48 | 49 | ImGui.Image(TexId, new Vector2(Tex.GetWidth(), Tex.GetHeight())); 50 | ImGui.SetWindowSize(new Vector2(Tex.GetWidth(), Tex.GetHeight())); 51 | ImGui.End(); 52 | } 53 | 54 | private void InputHandler() 55 | { 56 | if (ImGui.IsMouseDown(ImGuiMouseButton.Right)) 57 | { 58 | Globals.CameraOn = true; 59 | 60 | } 61 | else 62 | { 63 | Globals.CameraOn = false; 64 | } 65 | 66 | if (ImGui.IsWindowHovered()) 67 | Globals.In3DView = true; 68 | else 69 | Globals.In3DView = false; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /scripts/UI/Docks/TextureDock.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * TextureDock 3 | * 4 | * Serves the same purpose as the material dock in hammer 5 | * TODO: Fix issue with textures discoloring once used on a primitive 6 | * 7 | * (C) 2022 by K. "ashifolfi" J. 8 | */ 9 | using Godot; 10 | 11 | namespace Chisel.UI 12 | { 13 | public class TextureDock : Node 14 | { 15 | private AssetManager AssetManager; 16 | private TextureBrowser TextureBrowser; 17 | public override void _Ready() 18 | { 19 | base._Ready(); 20 | 21 | // Bind our elements to variables 22 | AssetManager = GetNode(Globals.RootPath + "Editor/AssetManager"); 23 | TextureBrowser = GetNode(Globals.RootPath + "Editor/TextureBrowser"); 24 | } 25 | 26 | public override void _Process(float delta) 27 | { 28 | base._Process(delta); 29 | // Simple shortcuts 30 | Label TexName = GetNode