Merge pull request #29180 from fire/vs_type_hints
Visualscript: Add types for get and set.
This commit is contained in:
commit
617bbdb174
1 changed files with 23 additions and 9 deletions
|
@ -1026,7 +1026,6 @@ void VisualScriptPropertySet::_adjust_input_index(PropertyInfo &pinfo) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const {
|
PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const {
|
||||||
|
|
||||||
if (call_mode == CALL_MODE_INSTANCE || call_mode == CALL_MODE_BASIC_TYPE) {
|
if (call_mode == CALL_MODE_INSTANCE || call_mode == CALL_MODE_BASIC_TYPE) {
|
||||||
if (p_idx == 0) {
|
if (p_idx == 0) {
|
||||||
PropertyInfo pi;
|
PropertyInfo pi;
|
||||||
|
@ -1037,6 +1036,16 @@ PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<PropertyInfo> props;
|
||||||
|
ClassDB::get_property_list(_get_base_type(), &props, true);
|
||||||
|
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
|
||||||
|
if (E->get().name == property) {
|
||||||
|
PropertyInfo pinfo = PropertyInfo(E->get().type, "value", PROPERTY_HINT_TYPE_STRING, E->get().hint_string);
|
||||||
|
_adjust_input_index(pinfo);
|
||||||
|
return pinfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PropertyInfo pinfo = type_cache;
|
PropertyInfo pinfo = type_cache;
|
||||||
pinfo.name = "value";
|
pinfo.name = "value";
|
||||||
_adjust_input_index(pinfo);
|
_adjust_input_index(pinfo);
|
||||||
|
@ -1047,6 +1056,13 @@ PropertyInfo VisualScriptPropertySet::get_output_value_port_info(int p_idx) cons
|
||||||
if (call_mode == CALL_MODE_BASIC_TYPE) {
|
if (call_mode == CALL_MODE_BASIC_TYPE) {
|
||||||
return PropertyInfo(basic_type, "out");
|
return PropertyInfo(basic_type, "out");
|
||||||
} else if (call_mode == CALL_MODE_INSTANCE) {
|
} else if (call_mode == CALL_MODE_INSTANCE) {
|
||||||
|
List<PropertyInfo> props;
|
||||||
|
ClassDB::get_property_list(_get_base_type(), &props, true);
|
||||||
|
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
|
||||||
|
if (E->get().name == property) {
|
||||||
|
return PropertyInfo(E->get().type, "pass", PROPERTY_HINT_TYPE_STRING, E->get().hint_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
return PropertyInfo(Variant::OBJECT, "pass", PROPERTY_HINT_TYPE_STRING, get_base_type());
|
return PropertyInfo(Variant::OBJECT, "pass", PROPERTY_HINT_TYPE_STRING, get_base_type());
|
||||||
} else {
|
} else {
|
||||||
return PropertyInfo();
|
return PropertyInfo();
|
||||||
|
@ -1796,14 +1812,12 @@ PropertyInfo VisualScriptPropertyGet::get_input_value_port_info(int p_idx) const
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyInfo VisualScriptPropertyGet::get_output_value_port_info(int p_idx) const {
|
PropertyInfo VisualScriptPropertyGet::get_output_value_port_info(int p_idx) const {
|
||||||
|
List<PropertyInfo> props;
|
||||||
if (index != StringName()) {
|
ClassDB::get_property_list(_get_base_type(), &props, true);
|
||||||
|
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
|
||||||
Variant v;
|
if (E->get().name == property) {
|
||||||
Variant::CallError ce;
|
return PropertyInfo(E->get().type, "value." + String(index));
|
||||||
v = Variant::construct(type_cache, NULL, 0, ce);
|
}
|
||||||
Variant i = v.get(index);
|
|
||||||
return PropertyInfo(i.get_type(), "value." + String(index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PropertyInfo(type_cache, "value");
|
return PropertyInfo(type_cache, "value");
|
||||||
|
|
Loading…
Add table
Reference in a new issue