Skip to content

Commit

Permalink
Various bug fixes with enum values. Fixed property setting. Implement…
Browse files Browse the repository at this point in the history
…ed exporting properties to Godot editor.
  • Loading branch information
ShadowApex committed Mar 15, 2018
1 parent 6a9cd12 commit 8eab03e
Show file tree
Hide file tree
Showing 165 changed files with 5,819 additions and 5,657 deletions.
9 changes: 9 additions & 0 deletions cmd/generate/classes/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func (v View) GetImports() []string {
}

func (v View) GoName(str string) string {
if str == "float" {
str = "real"
}
return casee.ToPascalCase(strings.Replace(str, "godot_", "", 1))
}

Expand All @@ -99,6 +102,9 @@ func (v View) GoNewFromPointerType(str string) string {
if strings.Contains(str, "enum") || strings.Contains(str, "Enum") {
return "Int"
}
if str == "float" {
str = "real"
}
str = strings.Replace(str, "*", "", 1)
str = strings.TrimSpace(str)
if v.IsGodotClass(str) {
Expand Down Expand Up @@ -196,6 +202,9 @@ func (v View) GoValue(returnString string) string {
if v.IsGodotClass(returnString) {
return returnString
} else {
if returnString == "float" {
returnString = "real"
}
return "gdnative." + casee.ToPascalCase(returnString)
}
}
Expand Down
11 changes: 11 additions & 0 deletions cmd/generate/templates/convert.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ import (
// getActualClass will return the concrete class type of the godot object based on
// the given class name.
func getActualClass(className gdnative.String, obj gdnative.Object) ObjectImplementer {
// Check to see if we already have an instance of this object in our Go instance registry.
if debug {
log.Println("Checking to see if", obj.ID(), "is in registry:", InstanceRegistry)
}
if instance, ok := InstanceRegistry.Get(obj.ID()); ok {
if debug {
log.Println("Class instance already found in registry!")
}
return instance.(ObjectImplementer)
}

switch className {
{{ range $i, $api := $view.APIs -}}
{{ if $view.IsValidClass $api.Name $api.BaseClass -}}
Expand Down
Loading

0 comments on commit 8eab03e

Please sign in to comment.