Rearrangements

This commit is contained in:
Ruslan Mustakov 2017-07-25 11:03:55 +07:00
commit 1e6646713f
6 changed files with 31 additions and 19 deletions

View file

@ -51,6 +51,17 @@ static:
import sets, strutils
var nativeClasses {.compileTime.} = initSet[string]()
var getClassMethodBind {.threadvar.}: ptr GodotMethodBind
proc getClassName*(o: ptr GodotObject): string =
if getClassMethodBind.isNil:
getClassMethodBind = getMethod(cstring"Object", cstring"get_class")
var ret: GodotString
getClassMethodBind.ptrCall(o, nil, addr ret)
result = $ret
if result.endsWith("SW"):
# There are physics type not known by ClassDB
result = result[0..result.len-3]
proc godotFinalizer[T: NimGodotObject](obj: T) =
# hmm, not sure yet how to deal with references correctly
# when T is Reference: