Closed capnm closed 6 years ago
diff --git a/src/gdprocmesh.cpp b/src/gdprocmesh.cpp
index b0f2d04..27afdcf 100644
--- a/src/gdprocmesh.cpp
+++ b/src/gdprocmesh.cpp
@@ -47,7 +47,8 @@ Array GDProcMesh::_get_property_list() {
}
Variant GDProcMesh::_get(String p_name) {
- if (p_name.begins_with(String("nodes/"))) {
+ String s = String("nodes/");
+ if (p_name.begins_with(s)) {
String index = p_name.split('/')[1];
int id = (int) index.to_int();
@@ -85,7 +86,8 @@ Variant GDProcMesh::_get(String p_name) {
}
bool GDProcMesh::_set(String p_name, Variant p_value) {
- if (p_name.begins_with(String("nodes/"))) {
+ String s = String("nodes/");
+ if (p_name.begins_with(s)) {
String index = p_name.split('/')[1];
int id = (int) index.to_int();
@@ -437,8 +452,9 @@ void GDProcMesh::_update() {
// clear left overs (we need to improve on this)
for (int64_t s = get_surface_count() - 1; s >= 0; s--) {
String name = surface_get_name(s);
+ String ss = String("Surface_");
- if (name.begins_with(String("Surface_"))) {
+ if (name.begins_with(ss)) {
String index = name.split('_')[1];
int id = (int) index.to_int();
??? https://github.com/godotengine/godot/issues/8490 https://github.com/GodotNativeTools/godot-cpp/pull/39
clang++ -o src/gdprocmesh.os -c -fPIC -g -O3 -std=c++14 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdprocmesh.cpp
In file included from src/gdprocmesh.cpp:1:
In file included from src/gdprocmesh.h:4:
godot-cpp/include/core/Godot.hpp:59:10: warning: returning reference to local temporary object
[-Wreturn-stack-address]
return a;
^
godot-cpp/include/core/Godot.hpp:196:35: note: in instantiation of member function
'godot::_ArgCast<const godot::Ref<godot::GDProcNode> &>::_arg_cast' requested here
*ret = (obj->*f)( _ArgCast<As>::_arg_cast(*args[I])... );
^
godot-cpp/include/core/Godot.hpp:223:10: note: in instantiation of function template specialization
'godot::_WrappedMethod<godot::GDProcMesh, int, const godot::Ref<godot::GDProcNode> &,
int>::apply<0, 1>' requested here
method->apply(var, obj, arg, typename __construct_sequence<sizeof...(As)>::type {});
^
godot-cpp/include/core/Godot.hpp:240:35: note: in instantiation of function template specialization
'godot::__wrapped_method<godot::GDProcMesh, int, const godot::Ref<godot::GDProcNode> &, int>'
requested here
return (__godot_wrapper_method) &__wrapped_method<T, R, As...>;
^
godot-cpp/include/core/Godot.hpp:278:43: note: in instantiation of function template specialization
'godot::___get_wrapper_function<godot::GDProcMesh, int, const godot::Ref<godot::GDProcNode> &,
int>' requested here
method.method = (__godot_wrapper_method) ___get_wrapper_function(method_ptr);
^
src/gdprocmesh.cpp:250:2: note: in instantiation of function template specialization
'godot::register_method<int (godot::GDProcMesh::*)(const godot::Ref<godot::GDProcNode> &,
int)>' requested here
register_method("add_node", &GDProcMesh::add_node);
^
1 warning generated.
g++ -o src/gdprocmesh.os -c -fPIC -g -O3 -std=c++14 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdprocmesh.cpp
In file included from src/gdprocmesh.h:4:0,
from src/gdprocmesh.cpp:1:
godot-cpp/include/core/Godot.hpp: In instantiation of 'static T godot::_ArgCast<T>::_arg_cast(godot::Variant) [with T = const godot::Ref<godot::GDProcNode>&]':
godot-cpp/include/core/Godot.hpp:196:44: required from 'void godot::_WrappedMethod<T, R, As>::apply(godot::Variant*, T*, godot::Variant**, godot::__Sequence<I ...>) [with int ...I = {0, 1}; T = godot::GDProcMesh; R = int; As = {const godot::Ref<godot::GDProcNode>&, int}]'
godot-cpp/include/core/Godot.hpp:223:2: required from 'godot_variant godot::__wrapped_method(godot_object*, void*, void*, int, godot_variant**) [with T = godot::GDProcMesh; R = int; As = {const godot::Ref<godot::GDProcNode>&, int}; godot_object = void]'
godot-cpp/include/core/Godot.hpp:240:9: required from 'godot_variant (* godot::___get_wrapper_function(R (T::*)(As ...)))(godot_object*, void*, void*, int, godot_variant**) [with T = godot::GDProcMesh; R = int; As = {const godot::Ref<godot::GDProcNode>&, int}; godot::__godot_wrapper_method = godot_variant (*)(void*, void*, void*, int, godot_variant**); godot_object = void]'
godot-cpp/include/core/Godot.hpp:278:66: required from 'void godot::register_method(const char*, M, godot_method_rpc_mode) [with M = int (godot::GDProcMesh::*)(const godot::Ref<godot::GDProcNode>&, int)]'
src/gdprocmesh.cpp:250:51: required from here
godot-cpp/include/core/Godot.hpp:59:10: warning: returning reference to temporary [-Wreturn-local-addr]
return a;
^
Does this compile now with my latest changes?
No. I just copied the terminal output for you quickly:
git log -1
commit 29f4b898e7c6d402ddeb68d27457d0b139a452eb (HEAD -> master, origin/master, origin/HEAD)
Author: Bastiaan Olij <mux213@gmail.com>
Date: Fri Aug 10 22:43:00 2018 +1000
Editor improvements, few more nodes, etc.
scons platform=linux
OSError: [Errno 2] No such file or directory: 'src/modifiers':
File "/data4/intranet/godot3-external-projects/BastiaanOlij/gdprocmesh/SConstruct", line 63:
add_sources(sources, "src/modifiers")
git diff
diff --git a/SConstruct b/SConstruct
index 961426a..63a8a86 100644
--- a/SConstruct
+++ b/SConstruct
@@ -60,7 +60,7 @@ add_sources(sources, "src/shapes")
add_sources(sources, "src/primitives")
add_sources(sources, "src/transforms")
add_sources(sources, "src/output")
-add_sources(sources, "src/modifiers")
+#add_sources(sources, "src/modifiers")
library = env.SharedLibrary(target=target_path + target_name, source=sources)
Default(library)
scons platform=linux
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/gdprocmesh.os -c -fPIC -g -O3 -std=c++14 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdprocmesh.cpp
src/gdprocmesh.cpp: In member function 'void godot::GDProcMesh::_update()':
src/gdprocmesh.cpp:599:77: warning: format '%lli' expects argument of type 'long long int', but argument 2 has type 'int64_t {aka long int}' [-Wformat=]
printf("Removing changed surface %lli, %s\n", s, name.utf8().get_data());
^
src/gdprocmesh.cpp:621:64: error: call of overloaded 'PoolVector3Array(godot::Variant&)' is ambiguous
} else if (((PoolVector3Array) arr[ArrayMesh::ARRAY_VERTEX]).size() == 0) {
^
In file included from godot-cpp/include/core/Variant.hpp:13:0,
from godot-cpp/include/core/Dictionary.hpp:4,
from godot-cpp/include/core/CoreTypes.hpp:10,
from godot-cpp/include/core/Godot.hpp:11,
from src/gdprocmesh.h:4,
from src/gdprocmesh.cpp:1:
godot-cpp/include/core/PoolArrays.hpp:566:2: note: candidate: godot::PoolVector3Array::PoolVector3Array(const godot::Array&)
PoolVector3Array(const Array& array);
^~~~~~~~~~~~~~~~
godot-cpp/include/core/PoolArrays.hpp:563:2: note: candidate: godot::PoolVector3Array::PoolVector3Array(const godot::PoolVector3Array&)
PoolVector3Array(const PoolVector3Array &p_other);
^~~~~~~~~~~~~~~~
src/gdprocmesh.cpp:625:59: error: call of overloaded 'PoolIntArray(godot::Variant&)' is ambiguous
} else if (((PoolIntArray) arr[ArrayMesh::ARRAY_INDEX]).size() == 0) {
^
In file included from godot-cpp/include/core/Variant.hpp:13:0,
from godot-cpp/include/core/Dictionary.hpp:4,
from godot-cpp/include/core/CoreTypes.hpp:10,
from godot-cpp/include/core/Godot.hpp:11,
from src/gdprocmesh.h:4,
from src/gdprocmesh.cpp:1:
godot-cpp/include/core/PoolArrays.hpp:181:2: note: candidate: godot::PoolIntArray::PoolIntArray(const godot::Array&)
PoolIntArray(const Array& array);
^~~~~~~~~~~~
godot-cpp/include/core/PoolArrays.hpp:178:2: note: candidate: godot::PoolIntArray::PoolIntArray(const godot::PoolIntArray&)
PoolIntArray(const PoolIntArray &p_other);
^~~~~~~~~~~~
scons: *** [src/gdprocmesh.os] Error 1
scons: building terminated because of errors.
clang
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o src/gdlibrary.os -c -fPIC -g -O3 -std=c++14 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdlibrary.cpp
clang++ -o src/gdprocnode.os -c -fPIC -g -O3 -std=c++14 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdprocnode.cpp
src/gdprocnode.cpp:38:10: warning: multi-character character constant [-Wmultichar]
params['to'] = Variant::STRING;
^
1 warning generated.
clang++ -o src/gdprocmesh.os -c -fPIC -g -O3 -std=c++14 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdprocmesh.cpp
src/gdprocmesh.cpp:599:52: warning: format specifies type 'long long' but the argument has type 'int64_t' (aka 'long') [-Wformat]
printf("Removing changed surface %lli, %s\n", s, name.utf8().get_data());
~~~~ ^
%li
src/gdprocmesh.cpp:621:18: error: ambiguous conversion for C-style cast from 'godot::Variant' to 'godot::PoolVector3Array'
} else if (((PoolVector3Array) arr[ArrayMesh::ARRAY_VERTEX]).size() == 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
godot-cpp/include/core/PoolArrays.hpp:563:2: note: candidate constructor
PoolVector3Array(const PoolVector3Array &p_other);
^
godot-cpp/include/core/PoolArrays.hpp:566:2: note: candidate constructor
PoolVector3Array(const Array& array);
^
src/gdprocmesh.cpp:625:18: error: ambiguous conversion for C-style cast from 'godot::Variant' to 'godot::PoolIntArray'
} else if (((PoolIntArray) arr[ArrayMesh::ARRAY_INDEX]).size() == 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
godot-cpp/include/core/PoolArrays.hpp:178:2: note: candidate constructor
PoolIntArray(const PoolIntArray &p_other);
^
godot-cpp/include/core/PoolArrays.hpp:181:2: note: candidate constructor
PoolIntArray(const Array& array);
^
1 warning and 2 errors generated.
scons: *** [src/gdprocmesh.os] Error 1
scons: building terminated because of errors.
Ah, yes I don't have any files in modifiers yet so the folder won't exist.
The other issues are new issues, really looks like Linux compilers are more strict then Microsofts compilers in automatically casting things.
scons has a built-in Glob function, it's easier to use:
sources = Glob('src/*.cpp')
sources += Glob('src/*/*.cpp')
You could try the Windows version of clang http://releases.llvm.org/download.html
Owh I'm going to try out Glob later today :)
I wonder if this is what a human can understand https://en.cppreference.com/w/cpp/language/explicit_cast
anyway, your code compiles with c++17 standard :
demo/addons/gdprocmesh/gdprocmesh.gdnlib
[entry]
Windows.64="res://addons/gdprocmesh/bin/win64/libgdprocmesh.dll"
+X11.64="res://addons/gdprocmesh/bin/x11/libgdprocmesh.so"
SConstruct
- env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++14'])
+ env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++17'])
g++ -o src/gdprocnode.os -c -fPIC -g -O3 -std=c++17 -fPIC -I. -Isrc -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen src/gdprocnode.cpp
src/gdprocnode.cpp:36:10: warning: multi-character character constant [-Wmultichar]
params['node'] = Variant::OBJECT;
^~~~~~
src/gdprocnode.cpp:37:10: warning: multi-character character constant [-Wmultichar]
params['from'] = Variant::STRING;
^~~~~~
src/gdprocnode.cpp:38:10: warning: multi-character character constant [-Wmultichar]
params['to'] = Variant::STRING;
Added :)
Strange that using the wrong quotes didn't break it on my end.
Feel free to submit a PR if you find more :)
I think now I understand how to use the API, but I keep an eye on your project :-)
12c5f355ef832088ee9511bf626f481449e42b60 SConstruct.txt
Errors
CC @Karroffel
clang6/linux:
gcc6/linux