Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor plugin #113

Open
wants to merge 121 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
649ce5c
Godot Editor Extension
migueldeicaza Apr 8, 2023
d9c0cee
Undo
migueldeicaza Apr 8, 2023
4f9b6ad
Merge main
migueldeicaza May 6, 2023
b0b4c1d
Adjust to API changes from main
migueldeicaza May 7, 2023
1ff382c
Add missing files
migueldeicaza May 7, 2023
ec7f02a
Editor work
migueldeicaza May 7, 2023
7bdf00d
Merge branch 'main' into editor-plugin
migueldeicaza May 7, 2023
c5f1d79
Update editor
migueldeicaza May 9, 2023
36a3d9c
Merge branch 'main' into editor-plugin
migueldeicaza May 9, 2023
fe6c9c2
Some updates
migueldeicaza May 10, 2023
710a587
Merge branch 'main' into editor-plugin
migueldeicaza May 10, 2023
f627747
Added save method
migueldeicaza May 14, 2023
da909cb
Merge branch 'main' into editor-plugin
migueldeicaza May 14, 2023
b653b90
Refactor method support so that we can use it to generate the utility…
migueldeicaza May 16, 2023
84e041c
Merge branch 'main' into editor-plugin
migueldeicaza May 16, 2023
dd6d75a
t puMerge branch 'main' into editor-plugin
migueldeicaza May 19, 2023
8b8da2f
Close file when we are done
migueldeicaza May 19, 2023
00c0337
Merge branch 'main' into editor-plugin
migueldeicaza May 19, 2023
e242609
Fix Variant constructor for strings, and implement property registration
migueldeicaza May 20, 2023
0879e16
Fix build script
migueldeicaza May 20, 2023
dfb0018
Add
migueldeicaza May 20, 2023
843ea38
Update CustomTypes.md
migueldeicaza May 20, 2023
35eaa5b
This implementation was wrong
migueldeicaza May 21, 2023
ce8c1a9
The constructor is not from a C-String, is from a Godot String, so de…
migueldeicaza May 21, 2023
32f4c6f
Another fix, but not the variant description fix
migueldeicaza May 21, 2023
fa9d627
Fix the manual marshaling I was doing for GStrings
migueldeicaza May 22, 2023
8c66963
Attempt to not change the file write time if the contents are the sam…
migueldeicaza May 24, 2023
0bd6734
Fix signal emission: fighting the Swift optimizer took me a while, th…
migueldeicaza May 25, 2023
0af43d2
Add asObject to convert a variant into a GodotObject
migueldeicaza May 25, 2023
be6a9d8
Reference types are now mostly optional.
migueldeicaza May 25, 2023
d724f61
Add support for additional default values: empty typedarrays, empty d…
migueldeicaza May 28, 2023
5cc6792
More automation, and support xcframework as a SwiftPM package
migueldeicaza May 28, 2023
41ff657
Update README.md
migueldeicaza May 28, 2023
7e02c0a
Update README.md
migueldeicaza May 28, 2023
c5f7ad3
When we startup, call all the callbacks, not just the last one regist…
migueldeicaza May 29, 2023
7d1da04
Update scripts to add arm64 to Mac builds
alicerunsonfedora May 28, 2023
a75d741
Add missing part of release
alicerunsonfedora May 28, 2023
8a7fdb4
Support SWIFT_GODOT_NODEPLOY
alicerunsonfedora May 28, 2023
050cf66
Move where deployment stops
alicerunsonfedora May 28, 2023
fd36a4a
Don't tag if SWIFT_GODOT_NODEPLOY
alicerunsonfedora May 28, 2023
521bbbb
Replace return with exit
alicerunsonfedora May 28, 2023
ad1152a
Invert condition
alicerunsonfedora May 28, 2023
b025ac5
Copy in arm64 module content
alicerunsonfedora May 28, 2023
c243644
Two fixes.
migueldeicaza May 29, 2023
ed548db
Make the XCFramework work for iOS
migueldeicaza May 30, 2023
9e5997c
Docs, and another test case
migueldeicaza May 30, 2023
81fcbe4
Cast to double the float parameters before marshaling them: #83; Gen…
migueldeicaza Jun 8, 2023
c09ac19
Variants are not structs in the binding, they are classes, so they ne…
migueldeicaza Jun 8, 2023
6b62f05
Update README.md
seivan May 31, 2023
73e11de
Do not attempt to call the variant object initialize with a nil, inst…
migueldeicaza Jun 8, 2023
c64200f
Fix incorrect usage of variants in the dictionary case
migueldeicaza Jun 11, 2023
6cd17b2
Typo fix, solves #90
migueldeicaza Jun 11, 2023
ac234a0
Url for the binary
migueldeicaza Jun 11, 2023
3d6aac1
Fix Variant(Object) creation, solves #93
migueldeicaza Jun 12, 2023
e4f6d00
Floats are stored as doubles in Variants
migueldeicaza Jun 12, 2023
5f9d039
Relocate docs dir, start tutorial work
alicerunsonfedora Jun 22, 2023
c0d8c73
Write first tutorial content!
alicerunsonfedora Jul 20, 2023
ae1faa6
Add main level tutorial
alicerunsonfedora Jul 22, 2023
02a1645
Fix Makefile
alicerunsonfedora Jul 23, 2023
e6ad813
Use Xcode 14.3 to fix CI
wacumov Aug 7, 2023
e3ee01f
Baseline work for 4.1 support
migueldeicaza Sep 1, 2023
ef27589
Add more types to the generation
migueldeicaza Sep 1, 2023
19f4723
Updates to Godot 4.1 address handling, this makes SwiftGodotKit not c…
migueldeicaza Sep 2, 2023
486eda0
Remove types that Godot dropped in 4.1
migueldeicaza Sep 2, 2023
669d610
Fix warning that was annoying me
migueldeicaza Sep 2, 2023
539c5c5
Add convenience methods for registering props
alicerunsonfedora May 29, 2023
04fa7fd
Add more registration conveniences
alicerunsonfedora May 29, 2023
ce10302
Split build logs
alicerunsonfedora Jun 4, 2023
a33d4be
Add arm64 builds only on M1
alicerunsonfedora Jun 4, 2023
ae8b2be
Fix assignment and check bugs
alicerunsonfedora Jun 4, 2023
ddb708f
Add extra lipo step
alicerunsonfedora Jun 11, 2023
090cf78
Documentation updates and fixes
migueldeicaza Sep 6, 2023
f1fad96
Doc update
migueldeicaza Sep 7, 2023
bba3008
Merge main
migueldeicaza Sep 20, 2023
68639ee
Update editor support
migueldeicaza Sep 21, 2023
44b41d8
Add
migueldeicaza Sep 21, 2023
27c74a6
Delete unused file
migueldeicaza Sep 21, 2023
d2df12f
Merge branch 'main' into editor-plugin
migueldeicaza Sep 21, 2023
768d708
Small progress, cleaning up errors and implementing baseline features
migueldeicaza Sep 21, 2023
915cd03
To allow Swift to create Editor plugins, I had to extend the API of
migueldeicaza Sep 23, 2023
8f14d0d
Small touchup
migueldeicaza Sep 23, 2023
429f4b1
Small fixes
migueldeicaza Sep 23, 2023
6457e3c
Merge branch 'main' into editor-plugin
migueldeicaza Sep 23, 2023
43c9993
Adjust to the API changes
migueldeicaza Sep 23, 2023
5d4e61b
Merge branch 'main' into editor-plugin
migueldeicaza Sep 24, 2023
e745d61
Upgrade API
migueldeicaza Sep 24, 2023
439ec27
This gets past the first problem: the issue seems to be the broken ui…
migueldeicaza Sep 24, 2023
4e0d203
Merge branch 'main' into editor-plugin
migueldeicaza Sep 24, 2023
a494720
Use RawValue abstraction instead of concrete type for GDExtensionVari…
tishin Sep 24, 2023
f0897ac
Add conditional compilation checks for UTI usage
tishin Sep 25, 2023
3c69ca6
Add the double constructor for variants
migueldeicaza Sep 26, 2023
f7fdf5b
update docs
migueldeicaza Sep 26, 2023
52934fb
Fix method flags type mismatch on Windows
tishin Sep 26, 2023
620ab67
Start of Macro work
migueldeicaza Sep 26, 2023
d10e641
I like what I got going on here, update the docs as well
migueldeicaza Sep 26, 2023
b5fd6b3
Update tutorials
migueldeicaza Sep 26, 2023
f1512a7
Update
migueldeicaza Sep 26, 2023
8270525
More doc updates
migueldeicaza Sep 26, 2023
53d001b
Bumpety bump
migueldeicaza Sep 26, 2023
8d05ed5
Add macros from Indexing-Your-Heart/game
alicerunsonfedora Sep 26, 2023
2aab344
Update tutorials
alicerunsonfedora Sep 26, 2023
94e99c0
Fix texture2DLiteral doc typo
alicerunsonfedora Sep 26, 2023
ad5eebf
Call GD.pushError before preconditionFailure
alicerunsonfedora Sep 26, 2023
946f8b4
Update SwiftGodotKit tutorial source
alicerunsonfedora Sep 26, 2023
7d0c0f1
Fix README
migueldeicaza Sep 27, 2023
f857bd9
Update macro docs
migueldeicaza Sep 27, 2023
86f6371
Fix warnings
migueldeicaza Sep 27, 2023
36e4136
Update docs, tutorial
alicerunsonfedora Sep 27, 2023
e005b72
Add explicit cast to AnyObject to fix compilation on Windows
tishin Sep 25, 2023
510204a
Drop the use of Regex literals, as Swift on Windows does not support …
migueldeicaza Sep 27, 2023
57c84aa
Static classes now surface static methods, without having to use the …
migueldeicaza Sep 27, 2023
e0d5bb4
Add another idiom
migueldeicaza Sep 27, 2023
2e0150b
Convenience API, remove old comment
migueldeicaza Sep 27, 2023
bba0c01
Special case some static classes for internals work
migueldeicaza Sep 27, 2023
e2721df
Update editor
migueldeicaza Sep 27, 2023
ee0f9c8
Small steps
migueldeicaza Oct 2, 2023
29bc2da
Remove classes that were dropped on 4.2
migueldeicaza Oct 2, 2023
e10cd3d
Undo mistake
migueldeicaza Oct 2, 2023
609bfc1
Fix Package.swift
migueldeicaza Oct 2, 2023
6506c69
Small bits
migueldeicaza Oct 2, 2023
a215240
This builds and generates something, but I have still work left to do…
migueldeicaza Oct 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Generator/Generator/ClassGen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ func processClass (cdef: JGodotExtensionAPIClass, outputDir: String?) async {
p ("internal \(fastInitOverrides)init (fast: Bool)") {
p ("super.init (name: \(cdef.name).className)")
}
if cdef.isInstantiable {

if cdef.isInstantiable || true {
p ("/// Initializes a new instance of the type \(cdef.name), call this constructor")
p ("/// when you create a subclass of this type.")
p ("public required init ()") {
Expand All @@ -661,7 +662,14 @@ func processClass (cdef: JGodotExtensionAPIClass, outputDir: String?) async {
} else {
p ("/// This class can not be instantiated by user code")
p ("public required init ()") {
p ("fatalError (\"You cannot subclass or instantiate \(cdef.name) directly\")")
// is_instantiable means "Users should not instantiate this", but I was incorrect
// assuming it meant they could not subclass, and let the engine deal with it.
// With the 'public required init' requirement, I am not sure how to surface
// this. Perhaps throw the error, and provide an altnerative constructor chain?
p ("public required init ()") {
p ("super.init (name: StringName (\"\(cdef.name)\"))")
}
//p ("fatalError (\"You cannot subclass or instantiate \(cdef.name) directly\")")
}
}

Expand Down
12 changes: 12 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ let package = Package(
name: "SimpleExtension",
type: .dynamic,
targets: ["SimpleExtension"]),
.library(
name: "SwiftGodotEditorExtension",
type: .dynamic,
targets: ["SwiftGodotEditorExtension"]),

],
dependencies: [
// Dependencies declare other packages that this package depends on.
Expand Down Expand Up @@ -84,6 +89,13 @@ let package = Package(
dependencies: ["SwiftGodotMacroLibrary", .target(name: "SwiftGodot")]),

// This contains sample code showing how to use the SwiftGodot API
.target(
name: "SwiftGodotEditorExtension",
dependencies: ["SwiftGodot"],
swiftSettings: [.unsafeFlags (["-suppress-warnings"])],
linkerSettings: [.unsafeFlags (
["-Xlinker", "-undefined",
"-Xlinker", "dynamic_lookup"])]),
.target(
name: "SimpleExtension",
dependencies: ["SwiftGodotMacros"],
Expand Down
51 changes: 40 additions & 11 deletions Plugins/CodeGeneratorPlugin/plugin.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
///
// Generator's Plugin definition.swift
//
//
Expand Down Expand Up @@ -337,17 +337,13 @@ let known = [
"GDExtension.swift",
"GDExtensionManager.swift",
"GDScript.swift",
"GDScriptEditorTranslationParserPlugin.swift",
"GDScriptNativeClass.swift",
"GLTFAccessor.swift",
"GLTFAnimation.swift",
"GLTFBufferView.swift",
"GLTFCamera.swift",
"GLTFDocument.swift",
"GLTFDocumentExtension.swift",
"GLTFDocumentExtensionConvertImporterMesh.swift",
"GLTFDocumentExtensionPhysics.swift",
"GLTFDocumentExtensionTextureWebP.swift",
"GLTFLight.swift",
"GLTFMesh.swift",
"GLTFNode.swift",
Expand All @@ -374,12 +370,11 @@ let known = [
"Geometry2D.swift",
"Geometry3D.swift",
"GeometryInstance3D.swift",
"GodotPhysicsServer2D.swift",
"GodotPhysicsServer3D.swift",
"Gradient.swift",
"GradientTexture1D.swift",
"GradientTexture2D.swift",
"GraphEdit.swift",
"GraphElement.swift",
"GraphNode.swift",
"GridContainer.swift",
"GridMap.swift",
Expand All @@ -397,7 +392,6 @@ let known = [
"HeightMapShape3D.swift",
"HingeJoint3D.swift",
"IP.swift",
"IPUnix.swift",
"Image.swift",
"ImageFormatLoader.swift",
"ImageFormatLoaderExtension.swift",
Expand Down Expand Up @@ -474,8 +468,6 @@ let known = [
"MissingResource.swift",
"MobileVRInterface.swift",
"MovieWriter.swift",
"MovieWriterMJPEG.swift",
"MovieWriterPNGWAV.swift",
"MultiMesh.swift",
"MultiMeshInstance2D.swift",
"MultiMeshInstance3D.swift",
Expand Down Expand Up @@ -522,6 +514,16 @@ let known = [
"OggPacketSequence.swift",
"OggPacketSequencePlayback.swift",
"OmniLight3D.swift",
"OpenXRAPIExtension.swift",
"OpenXRAction.swift",
"OpenXRActionMap.swift",
"OpenXRActionSet.swift",
"OpenXRExtensionWrapperExtension.swift",
"OpenXRHand.swift",
"OpenXRIPBinding.swift",
"OpenXRInteractionProfile.swift",
"OpenXRInteractionProfileMetadata.swift",
"OpenXRInterface.swift",
"OptimizedTranslation.swift",
"OptionButton.swift",
"PCKPacker.swift",
Expand Down Expand Up @@ -631,13 +633,31 @@ let known = [
"RegExMatch.swift",
"RemoteTransform2D.swift",
"RemoteTransform3D.swift",
"RenderSceneBuffers.swift",
"RenderSceneBuffersConfiguration.swift",
"RenderSceneBuffersExtension.swift",
"RenderSceneBuffersRD.swift",
"RenderingDevice.swift",
"RenderingServer.swift",
"Resource.swift",
"ResourceFormatImporterSaver.swift",
"ResourceFormatLoader.swift",
"ResourceFormatSaver.swift",
"ResourceImporter.swift",
"ResourceImporterBMFont.swift",
"ResourceImporterBitMap.swift",
"ResourceImporterCSVTranslation.swift",
"ResourceImporterDynamicFont.swift",
"ResourceImporterImage.swift",
"ResourceImporterImageFont.swift",
"ResourceImporterLayeredTexture.swift",
"ResourceImporterMP3.swift",
"ResourceImporterOBJ.swift",
"ResourceImporterOggVorbis.swift",
"ResourceImporterScene.swift",
"ResourceImporterShaderFile.swift",
"ResourceImporterTexture.swift",
"ResourceImporterTextureAtlas.swift",
"ResourceImporterWAV.swift",
"ResourceLoader.swift",
"ResourcePreloader.swift",
"ResourceSaver.swift",
Expand Down Expand Up @@ -742,9 +762,15 @@ let known = [
"Texture.swift",
"Texture2D.swift",
"Texture2DArray.swift",
"Texture2DArrayRD.swift",
"Texture2DRD.swift",
"Texture3D.swift",
"Texture3DRD.swift",
"TextureButton.swift",
"TextureCubemapRD.swift",
"TextureCubemapArrayRD.swift",
"TextureLayered.swift",
"TextureLayeredRD.swift",
"TextureProgressBar.swift",
"TextureRect.swift",
"Theme.swift",
Expand Down Expand Up @@ -852,6 +878,8 @@ let known = [
"VisualShaderNodeRandomRange.swift",
"VisualShaderNodeRemap.swift",
"VisualShaderNodeResizableBase.swift",
"VisualShaderNodeRotationByAxis.swift",
"VisualShaderNodeScreenNormalWorldSpace.swift",
"VisualShaderNodeSDFRaymarch.swift",
"VisualShaderNodeSDFToScreenUV.swift",
"VisualShaderNodeSample3D.swift",
Expand Down Expand Up @@ -899,6 +927,7 @@ let known = [
"VisualShaderNodeVectorLen.swift",
"VisualShaderNodeVectorOp.swift",
"VisualShaderNodeVectorRefract.swift",
"VisualShaderNodeWorldPositionFromDepth.swift",
"VoxelGI.swift",
"VoxelGIData.swift",
"WeakRef.swift",
Expand Down
8 changes: 8 additions & 0 deletions Sources/SwiftGodot/Core/File.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Miguel de Icaza on 9/20/23.
//

import Foundation
2 changes: 1 addition & 1 deletion Sources/SwiftGodot/Core/Wrapped.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func lookupObject<T:GodotObject> (nativeHandle: UnsafeRawPointer) -> T {
/// to instantiate it. Notice that this is different that direct instantiation from our API
///
func createFunc (_ userData: UnsafeMutableRawPointer?) -> UnsafeMutableRawPointer? {
print ("SWIFT: Creating object userData:\(userData)")
guard let userData else {
print ("Got a nil userData")
return nil
Expand All @@ -270,6 +269,7 @@ func createFunc (_ userData: UnsafeMutableRawPointer?) -> UnsafeMutableRawPointe
return nil
}
let o = type.init ()
print ("SWIFT: Creating object userData:\(userData) of \(type)")
return UnsafeMutableRawPointer (mutating: o.handle)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[configuration]
entry_symbol = "swift_entry_point"
compatibility_minimum = 4.1

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@Section(title: "SwiftGodotKit from Xcode") {
@ContentAndMedia {
Using Godot as a library using SwiftGodotKit

SwiftGodot provides the API bridge between the Swift world and the Godot API. This API can be used to implement new capabilities in both Godot extensions, or to drive Godot entirely from Swift. This tutorial covers how to drive Godot entirely from Swift, rather than how to extend Godot with Swift or implementing functionality for Godot in Swift.

Expand Down
Loading
Loading