File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1+ from libc.stdint cimport intptr_t
12# godot_extension: class(parent="ResourceFormatSaver")
23@cython.final
34cdef class PythonResourceFormatSaver:
@@ -59,17 +60,15 @@ cdef class PythonResourceFormatSaver:
5960 # `resource` is an instance of `Resource`
6061
6162 # Convert the path to a Python string
62- cdef object py_path = gdapi.gd_string_to_pystr(& path)
63+ cdef object py_path = gdapi.gd_string_to_pystr(& path).replace( " res:// " , " " )
6364
64- spy_log(" CALLED PythonResourceFormatSaver::_save(resource=<resource>, path={py_path!r}, flags={flags})" )
65-
66- # For now, just write a simple placeholder file
67- # TODO: Once PythonScript._get_source_code() is properly implemented,
68- # we can call it directly here to get the actual source code
65+ spy_log(f" CALLED PythonResourceFormatSaver::_save(resource=<resource>, path={py_path!r}, flags={flags})" )
6966
67+ script = _load_class(" ScriptExtension" )._from_ptr(< uintptr_t> resource)
68+ source_code = script.get_source_code()
7069 try :
7170 with open (py_path, ' w' , encoding = ' utf-8' ) as f:
72- f.write(" # Python script saved from Godot \n " )
71+ f.write(str (source_code) )
7372 return Error.OK
7473 except :
7574 return Error.ERR_FILE_CANT_OPEN
You can’t perform that action at this time.
0 commit comments