Merge pull request #50041 from aaronfranke/prop-usage-flags

Use `PROPERTY_USAGE_NONE` instead of `0` for no property usage
This commit is contained in:
Rémi Verschelde
2021-07-01 21:29:32 +02:00
committed by GitHub
3 changed files with 18 additions and 18 deletions

View File

@@ -513,19 +513,19 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (property.name == "base_script") { if (property.name == "base_script") {
if (call_mode != CALL_MODE_INSTANCE) { if (call_mode != CALL_MODE_INSTANCE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
if (property.name == "basic_type") { if (property.name == "basic_type") {
if (call_mode != CALL_MODE_BASIC_TYPE) { if (call_mode != CALL_MODE_BASIC_TYPE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
if (property.name == "singleton") { if (property.name == "singleton") {
if (call_mode != CALL_MODE_SINGLETON) { if (call_mode != CALL_MODE_SINGLETON) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} else { } else {
List<Engine::Singleton> names; List<Engine::Singleton> names;
Engine::get_singleton()->get_singletons(&names); Engine::get_singleton()->get_singletons(&names);
@@ -543,7 +543,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (property.name == "node_path") { if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) { if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} else { } else {
Node *bnode = _get_base_node(); Node *bnode = _get_base_node();
if (bnode) { if (bnode) {
@@ -614,7 +614,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
} }
if (mc == 0) { if (mc == 0) {
property.usage = 0; //do not show property.usage = PROPERTY_USAGE_NONE; //do not show
} else { } else {
property.hint_string = "0," + itos(mc) + ",1"; property.hint_string = "0," + itos(mc) + ",1";
} }
@@ -622,7 +622,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (property.name == "rpc_call_mode") { if (property.name == "rpc_call_mode") {
if (call_mode == CALL_MODE_BASIC_TYPE) { if (call_mode == CALL_MODE_BASIC_TYPE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
} }
@@ -1278,19 +1278,19 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
if (property.name == "base_script") { if (property.name == "base_script") {
if (call_mode != CALL_MODE_INSTANCE) { if (call_mode != CALL_MODE_INSTANCE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
if (property.name == "basic_type") { if (property.name == "basic_type") {
if (call_mode != CALL_MODE_BASIC_TYPE) { if (call_mode != CALL_MODE_BASIC_TYPE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
if (property.name == "node_path") { if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) { if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} else { } else {
Node *bnode = _get_base_node(); Node *bnode = _get_base_node();
if (bnode) { if (bnode) {
@@ -1352,7 +1352,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
property.hint_string = options; property.hint_string = options;
property.type = Variant::STRING; property.type = Variant::STRING;
if (options == "") { if (options == "") {
property.usage = 0; //hide if type has no usable index property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
} }
} }
} }
@@ -1956,19 +1956,19 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
if (property.name == "base_script") { if (property.name == "base_script") {
if (call_mode != CALL_MODE_INSTANCE) { if (call_mode != CALL_MODE_INSTANCE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
if (property.name == "basic_type") { if (property.name == "basic_type") {
if (call_mode != CALL_MODE_BASIC_TYPE) { if (call_mode != CALL_MODE_BASIC_TYPE) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
if (property.name == "node_path") { if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) { if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} else { } else {
Node *bnode = _get_base_node(); Node *bnode = _get_base_node();
if (bnode) { if (bnode) {
@@ -2029,7 +2029,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
property.hint_string = options; property.hint_string = options;
property.type = Variant::STRING; property.type = Variant::STRING;
if (options == "") { if (options == "") {
property.usage = 0; //hide if type has no usable index property.usage = PROPERTY_USAGE_NONE; //hide if type has no usable index
} }
} }
} }

View File

@@ -1534,7 +1534,7 @@ void VisualScriptConstant::_validate_property(PropertyInfo &property) const {
if (property.name == "value") { if (property.name == "value") {
property.type = type; property.type = type;
if (type == Variant::NIL) { if (type == Variant::NIL) {
property.usage = 0; //do not save if nil property.usage = PROPERTY_USAGE_NONE; //do not save if nil
} }
} }
} }
@@ -2124,7 +2124,7 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c
Variant::get_constants_for_type(type, &constants); Variant::get_constants_for_type(type, &constants);
if (constants.size() == 0) { if (constants.size() == 0) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
return; return;
} }
property.hint_string = ""; property.hint_string = "";

View File

@@ -174,7 +174,7 @@ float VisualScriptYield::get_wait_time() {
void VisualScriptYield::_validate_property(PropertyInfo &property) const { void VisualScriptYield::_validate_property(PropertyInfo &property) const {
if (property.name == "wait_time") { if (property.name == "wait_time") {
if (yield_mode != YIELD_WAIT) { if (yield_mode != YIELD_WAIT) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} }
} }
} }
@@ -421,7 +421,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
if (property.name == "node_path") { if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) { if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0; property.usage = PROPERTY_USAGE_NONE;
} else { } else {
Node *bnode = _get_base_node(); Node *bnode = _get_base_node();
if (bnode) { if (bnode) {