You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Removal of InputEvent as built-in Variant type..
this might cause bugs I haven't found yet..
This commit is contained in:
@@ -943,18 +943,6 @@ static Ref<VisualScriptNode> create_function_call_node(const String &p_name) {
|
||||
////////////////SET//////////////////////
|
||||
//////////////////////////////////////////
|
||||
|
||||
static const char *event_type_names[InputEvent::TYPE_MAX] = {
|
||||
"None",
|
||||
"Key",
|
||||
"MouseMotion",
|
||||
"MouseButton",
|
||||
"JoypadMotion",
|
||||
"JoypadButton",
|
||||
"ScreenTouch",
|
||||
"ScreenDrag",
|
||||
"Action"
|
||||
};
|
||||
|
||||
int VisualScriptPropertySet::get_output_sequence_port_count() const {
|
||||
|
||||
return call_mode != CALL_MODE_BASIC_TYPE ? 1 : 0;
|
||||
@@ -1119,24 +1107,6 @@ Variant::Type VisualScriptPropertySet::get_basic_type() const {
|
||||
return basic_type;
|
||||
}
|
||||
|
||||
void VisualScriptPropertySet::set_event_type(InputEvent::Type p_type) {
|
||||
|
||||
if (event_type == p_type)
|
||||
return;
|
||||
event_type = p_type;
|
||||
if (call_mode == CALL_MODE_BASIC_TYPE) {
|
||||
_update_cache();
|
||||
}
|
||||
_change_notify();
|
||||
_update_base_type();
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
InputEvent::Type VisualScriptPropertySet::get_event_type() const {
|
||||
|
||||
return event_type;
|
||||
}
|
||||
|
||||
void VisualScriptPropertySet::set_base_type(const StringName &p_type) {
|
||||
|
||||
if (base_type == p_type)
|
||||
@@ -1182,14 +1152,8 @@ void VisualScriptPropertySet::_update_cache() {
|
||||
//not super efficient..
|
||||
|
||||
Variant v;
|
||||
if (basic_type == Variant::INPUT_EVENT) {
|
||||
InputEvent ev;
|
||||
ev.type = event_type;
|
||||
v = ev;
|
||||
} else {
|
||||
Variant::CallError ce;
|
||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||
}
|
||||
Variant::CallError ce;
|
||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
v.get_property_list(&pinfo);
|
||||
@@ -1341,12 +1305,6 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
}
|
||||
|
||||
if (property.name == "property/event_type") {
|
||||
if (call_mode != CALL_MODE_BASIC_TYPE || basic_type != Variant::INPUT_EVENT) {
|
||||
property.usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (property.name == "property/node_path") {
|
||||
if (call_mode != CALL_MODE_NODE_PATH) {
|
||||
property.usage = 0;
|
||||
@@ -1418,9 +1376,6 @@ void VisualScriptPropertySet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_set_type_cache", "type_cache"), &VisualScriptPropertySet::_set_type_cache);
|
||||
ClassDB::bind_method(D_METHOD("_get_type_cache"), &VisualScriptPropertySet::_get_type_cache);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_event_type", "event_type"), &VisualScriptPropertySet::set_event_type);
|
||||
ClassDB::bind_method(D_METHOD("get_event_type"), &VisualScriptPropertySet::get_event_type);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_property", "property"), &VisualScriptPropertySet::set_property);
|
||||
ClassDB::bind_method(D_METHOD("get_property"), &VisualScriptPropertySet::get_property);
|
||||
|
||||
@@ -1438,14 +1393,6 @@ void VisualScriptPropertySet::_bind_methods() {
|
||||
bt += Variant::get_type_name(Variant::Type(i));
|
||||
}
|
||||
|
||||
String et;
|
||||
for (int i = 0; i < InputEvent::TYPE_MAX; i++) {
|
||||
if (i > 0)
|
||||
et += ",";
|
||||
|
||||
et += event_type_names[i];
|
||||
}
|
||||
|
||||
List<String> script_extensions;
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
|
||||
@@ -1463,7 +1410,6 @@ void VisualScriptPropertySet::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "property/base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "property/type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_type_cache", "_get_type_cache");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "property/basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "property/event_type", PROPERTY_HINT_ENUM, et), "set_event_type", "get_event_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "property/node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "property/property"), "set_property", "get_property");
|
||||
|
||||
@@ -1574,7 +1520,6 @@ VisualScriptPropertySet::VisualScriptPropertySet() {
|
||||
call_mode = CALL_MODE_SELF;
|
||||
base_type = "Object";
|
||||
basic_type = Variant::NIL;
|
||||
event_type = InputEvent::NONE;
|
||||
}
|
||||
|
||||
template <VisualScriptPropertySet::CallMode cmode>
|
||||
@@ -1764,14 +1709,8 @@ void VisualScriptPropertyGet::_update_cache() {
|
||||
//not super efficient..
|
||||
|
||||
Variant v;
|
||||
if (basic_type == Variant::INPUT_EVENT) {
|
||||
InputEvent ev;
|
||||
ev.type = event_type;
|
||||
v = ev;
|
||||
} else {
|
||||
Variant::CallError ce;
|
||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||
}
|
||||
Variant::CallError ce;
|
||||
v = Variant::construct(basic_type, NULL, 0, ce);
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
v.get_property_list(&pinfo);
|
||||
@@ -1919,24 +1858,6 @@ Variant::Type VisualScriptPropertyGet::get_basic_type() const {
|
||||
return basic_type;
|
||||
}
|
||||
|
||||
void VisualScriptPropertyGet::set_event_type(InputEvent::Type p_type) {
|
||||
|
||||
if (event_type == p_type)
|
||||
return;
|
||||
event_type = p_type;
|
||||
if (call_mode == CALL_MODE_BASIC_TYPE) {
|
||||
_update_cache();
|
||||
}
|
||||
_change_notify();
|
||||
_update_base_type();
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
||||
InputEvent::Type VisualScriptPropertyGet::get_event_type() const {
|
||||
|
||||
return event_type;
|
||||
}
|
||||
|
||||
void VisualScriptPropertyGet::_set_type_cache(Variant::Type p_type) {
|
||||
type_cache = p_type;
|
||||
}
|
||||
@@ -1965,11 +1886,6 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
|
||||
property.usage = 0;
|
||||
}
|
||||
}
|
||||
if (property.name == "property/event_type") {
|
||||
if (call_mode != CALL_MODE_BASIC_TYPE || basic_type != Variant::INPUT_EVENT) {
|
||||
property.usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (property.name == "property/node_path") {
|
||||
if (call_mode != CALL_MODE_NODE_PATH) {
|
||||
@@ -2041,9 +1957,6 @@ void VisualScriptPropertyGet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_set_type_cache", "type_cache"), &VisualScriptPropertyGet::_set_type_cache);
|
||||
ClassDB::bind_method(D_METHOD("_get_type_cache"), &VisualScriptPropertyGet::_get_type_cache);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_event_type", "event_type"), &VisualScriptPropertyGet::set_event_type);
|
||||
ClassDB::bind_method(D_METHOD("get_event_type"), &VisualScriptPropertyGet::get_event_type);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_property", "property"), &VisualScriptPropertyGet::set_property);
|
||||
ClassDB::bind_method(D_METHOD("get_property"), &VisualScriptPropertyGet::get_property);
|
||||
|
||||
@@ -2061,14 +1974,6 @@ void VisualScriptPropertyGet::_bind_methods() {
|
||||
bt += Variant::get_type_name(Variant::Type(i));
|
||||
}
|
||||
|
||||
String et;
|
||||
for (int i = 0; i < InputEvent::TYPE_MAX; i++) {
|
||||
if (i > 0)
|
||||
et += ",";
|
||||
|
||||
et += event_type_names[i];
|
||||
}
|
||||
|
||||
List<String> script_extensions;
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
ScriptServer::get_language(i)->get_recognized_extensions(&script_extensions);
|
||||
@@ -2086,7 +1991,6 @@ void VisualScriptPropertyGet::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "property/base_script", PROPERTY_HINT_FILE, script_ext_hint), "set_base_script", "get_base_script");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "property/type_cache", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_type_cache", "_get_type_cache");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "property/basic_type", PROPERTY_HINT_ENUM, bt), "set_basic_type", "get_basic_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "property/event_type", PROPERTY_HINT_ENUM, et), "set_event_type", "get_event_type");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "property/node_path", PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE), "set_base_path", "get_base_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "property/property"), "set_property", "get_property");
|
||||
|
||||
@@ -2184,7 +2088,6 @@ VisualScriptPropertyGet::VisualScriptPropertyGet() {
|
||||
call_mode = CALL_MODE_SELF;
|
||||
base_type = "Object";
|
||||
basic_type = Variant::NIL;
|
||||
event_type = InputEvent::NONE;
|
||||
type_cache = Variant::NIL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user