You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
More visual script work
-Block switches to 2d/3d editor if editing visual script -Added cast node in flow control -Added ability to do RPC in visual script -Comment nodes -Fix bug with inverted cable in connecting backwards -Copy and paste nodes, including from different scripts
This commit is contained in:
121
core/object.cpp
121
core/object.cpp
@@ -59,30 +59,112 @@ struct _ObjectDebugLock {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
PropertyInfo::operator Dictionary() const {
|
||||
|
||||
Dictionary d;
|
||||
d["name"]=name;
|
||||
d["type"]=type;
|
||||
d["hint"]=hint;
|
||||
d["hint_string"]=hint_string;
|
||||
d["usage"]=usage;
|
||||
return d;
|
||||
|
||||
}
|
||||
|
||||
PropertyInfo PropertyInfo::from_dict(const Dictionary& p_dict) {
|
||||
|
||||
PropertyInfo pi;
|
||||
|
||||
if (p_dict.has("type"))
|
||||
pi.type=Variant::Type(int(p_dict["type"]));
|
||||
|
||||
if (p_dict.has("name"))
|
||||
pi.name=p_dict["name"];
|
||||
|
||||
if (p_dict.has("hint"))
|
||||
pi.hint=PropertyHint(int(p_dict["hint"]));
|
||||
|
||||
if (p_dict.has("hint_string"))
|
||||
|
||||
pi.hint_string=p_dict["hint_string"];
|
||||
|
||||
if (p_dict.has("usage"))
|
||||
pi.usage=p_dict["usage"];
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
||||
|
||||
Array convert_property_list(const List<PropertyInfo> * p_list) {
|
||||
|
||||
Array va;
|
||||
for (const List<PropertyInfo>::Element *E=p_list->front();E;E=E->next()) {
|
||||
|
||||
const PropertyInfo &pi = E->get();
|
||||
Dictionary d;
|
||||
d["name"]=pi.name;
|
||||
d["type"]=pi.type;
|
||||
d["hint"]=pi.hint;
|
||||
d["hint_string"]=pi.hint_string;
|
||||
d["usage"]=pi.usage;
|
||||
va.push_back(d);
|
||||
|
||||
va.push_back(Dictionary(E->get()));
|
||||
}
|
||||
|
||||
return va;
|
||||
}
|
||||
|
||||
MethodInfo::operator Dictionary() const {
|
||||
|
||||
|
||||
Dictionary d;
|
||||
d["name"]=name;
|
||||
d["args"]=convert_property_list(&arguments);
|
||||
Array da;
|
||||
for(int i=0;i<default_arguments.size();i++)
|
||||
da.push_back(default_arguments[i]);
|
||||
d["default_args"]=da;
|
||||
d["flags"]=flags;
|
||||
d["id"]=id;
|
||||
Dictionary r = return_val;
|
||||
d["return"]=r;
|
||||
return d;
|
||||
|
||||
}
|
||||
|
||||
MethodInfo::MethodInfo() {
|
||||
|
||||
id=0;
|
||||
flags=METHOD_FLAG_NORMAL;
|
||||
}
|
||||
|
||||
MethodInfo MethodInfo::from_dict(const Dictionary& p_dict) {
|
||||
|
||||
MethodInfo mi;
|
||||
|
||||
if (p_dict.has("name"))
|
||||
mi.name=p_dict["name"];
|
||||
Array args;
|
||||
if (p_dict.has("args")) {
|
||||
args=p_dict["args"];
|
||||
}
|
||||
|
||||
for(int i=0;i<args.size();i++) {
|
||||
Dictionary d = args[i];
|
||||
mi.arguments.push_back(PropertyInfo::from_dict(d));
|
||||
}
|
||||
Array defargs;
|
||||
if (p_dict.has("default_args")) {
|
||||
defargs=p_dict["default_args"];
|
||||
}
|
||||
for(int i=0;i<defargs.size();i++) {
|
||||
mi.default_arguments.push_back(defargs[i]);
|
||||
}
|
||||
|
||||
if (p_dict.has("return")) {
|
||||
mi.return_val=PropertyInfo::from_dict(p_dict["return"]);
|
||||
}
|
||||
|
||||
if (p_dict.has("flags"))
|
||||
mi.flags=p_dict["flags"];
|
||||
|
||||
return mi;
|
||||
}
|
||||
|
||||
MethodInfo::MethodInfo(const String& p_name) {
|
||||
|
||||
id=0;
|
||||
@@ -1012,25 +1094,6 @@ Array Object::_get_property_list_bind() const {
|
||||
}
|
||||
|
||||
|
||||
static Dictionary _get_dict_from_method(const MethodInfo &mi) {
|
||||
|
||||
Dictionary d;
|
||||
d["name"]=mi.name;
|
||||
d["args"]=convert_property_list(&mi.arguments);
|
||||
Array da;
|
||||
for(int i=0;i<mi.default_arguments.size();i++)
|
||||
da.push_back(mi.default_arguments[i]);
|
||||
d["default_args"]=da;
|
||||
d["flags"]=mi.flags;
|
||||
d["id"]=mi.id;
|
||||
Dictionary r;
|
||||
r["type"]=mi.return_val.type;
|
||||
r["hint"]=mi.return_val.hint;
|
||||
r["hint_string"]=mi.return_val.hint_string;
|
||||
d["return_type"]=r;
|
||||
return d;
|
||||
|
||||
}
|
||||
|
||||
Array Object::_get_method_list_bind() const {
|
||||
|
||||
@@ -1040,7 +1103,7 @@ Array Object::_get_method_list_bind() const {
|
||||
|
||||
for(List<MethodInfo>::Element *E=ml.front();E;E=E->next()) {
|
||||
|
||||
Dictionary d = _get_dict_from_method(E->get());
|
||||
Dictionary d = E->get();
|
||||
//va.push_back(d);
|
||||
ret.push_back(d);
|
||||
}
|
||||
@@ -1305,7 +1368,7 @@ Array Object::_get_signal_list() const{
|
||||
Array ret;
|
||||
for (List<MethodInfo>::Element *E=signal_list.front();E;E=E->next()) {
|
||||
|
||||
ret.push_back(_get_dict_from_method(E->get()));
|
||||
ret.push_back(Dictionary(E->get()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user