Use PROPERTY_USAGE_NONE instead of 0 for no property usage

Also use const more often.
This commit is contained in:
Aaron Franke 2021-06-30 21:24:34 -04:00
parent 382ddd497a
commit 2508fd0533
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
39 changed files with 126 additions and 126 deletions

View File

@ -248,7 +248,7 @@ struct _VCSort {
String name;
Variant::Type type;
int order;
int flags;
uint32_t flags;
bool operator<(const _VCSort &p_vcs) const { return order == p_vcs.order ? name < p_vcs.name : order < p_vcs.order; }
};

View File

@ -151,7 +151,7 @@ struct PropertyInfo {
String hint_string;
uint32_t usage = PROPERTY_USAGE_DEFAULT;
_FORCE_INLINE_ PropertyInfo added_usage(int p_fl) const {
_FORCE_INLINE_ PropertyInfo added_usage(uint32_t p_fl) const {
PropertyInfo pi = *this;
pi.usage |= p_fl;
return pi;
@ -163,7 +163,7 @@ struct PropertyInfo {
PropertyInfo() {}
PropertyInfo(Variant::Type p_type, const String p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = StringName()) :
PropertyInfo(const Variant::Type p_type, const String p_name, const PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", const uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = StringName()) :
type(p_type),
name(p_name),
hint(p_hint),

View File

@ -1038,7 +1038,7 @@ void EditorInspectorPlugin::parse_category(Object *p_object, const String &p_par
}
}
bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
if (get_script_instance()) {
Variant arg[6] = {
p_object, p_type, p_path, p_hint, p_hint_text, p_usage
@ -1437,7 +1437,7 @@ EditorInspectorSection::~EditorInspectorSection() {
Ref<EditorInspectorPlugin> EditorInspector::inspector_plugins[MAX_PLUGINS];
int EditorInspector::inspector_plugin_count = 0;
EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, const Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
for (int i = inspector_plugin_count - 1; i >= 0; i--) {
inspector_plugins[i]->parse_property(p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide);
if (inspector_plugins[i]->added_editors.size()) {

View File

@ -198,7 +198,7 @@ public:
virtual bool can_handle(Object *p_object);
virtual void parse_begin(Object *p_object);
virtual void parse_category(Object *p_object, const String &p_parse_category);
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false);
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
virtual void parse_end();
};
@ -356,7 +356,7 @@ public:
static void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
static void cleanup_plugins();
static EditorProperty *instantiate_property_editor(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false);
static EditorProperty *instantiate_property_editor(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
void set_undo_redo(UndoRedo *p_undo_redo);

View File

@ -2734,7 +2734,7 @@ void EditorInspectorDefaultPlugin::parse_begin(Object *p_object) {
//do none
}
bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
Control *editor = EditorInspectorDefaultPlugin::get_editor_for_property(p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide);
if (editor) {
add_property_editor(p_path, editor);
@ -2800,7 +2800,7 @@ static EditorPropertyRangeHint _parse_range_hint(PropertyHint p_hint, const Stri
return hint;
}
EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
double default_float_step = EDITOR_GET("interface/inspector/default_float_step");
switch (p_type) {

View File

@ -649,10 +649,10 @@ class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
virtual void parse_end() override;
static EditorProperty *get_editor_for_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false);
static EditorProperty *get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
};
#endif // EDITOR_PROPERTIES_H

View File

@ -337,7 +337,7 @@ void EditorPropertyArray::update_property() {
editor->setup("Object");
prop = editor;
} else {
prop = EditorInspector::instantiate_property_editor(nullptr, value_type, "", subtype_hint, subtype_hint_string, 0);
prop = EditorInspector::instantiate_property_editor(nullptr, value_type, "", subtype_hint, subtype_hint_string, PROPERTY_USAGE_NONE);
}
prop->set_object_and_property(object.ptr(), prop_name);

View File

@ -240,19 +240,19 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
}
for (Set<_EVCSort>::Element *E = vclist.front(); E; E = E->next()) {
int pinfo = 0;
uint32_t pusage = PROPERTY_USAGE_NONE;
if (E->get().save || !optimize_save) {
pinfo |= PROPERTY_USAGE_STORAGE;
pusage |= PROPERTY_USAGE_STORAGE;
}
if (!E->get().name.begins_with("_") && !E->get().name.begins_with("projects/")) {
pinfo |= PROPERTY_USAGE_EDITOR;
pusage |= PROPERTY_USAGE_EDITOR;
} else {
pinfo |= PROPERTY_USAGE_STORAGE; //hiddens must always be saved
pusage |= PROPERTY_USAGE_STORAGE; //hiddens must always be saved
}
PropertyInfo pi(E->get().type, E->get().name);
pi.usage = pinfo;
pi.usage = pusage;
if (hints.has(E->get().name)) {
pi = hints[E->get().name];
}

View File

@ -290,7 +290,7 @@ void EditorInspectorPluginFont::parse_begin(Object *p_object) {
add_custom_control(editor);
}
bool EditorInspectorPluginFont::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorPluginFont::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
if (p_path.begins_with("language_support_override/") && p_object->is_class("FontData")) {
String lang = p_path.replace("language_support_override/", "");

View File

@ -94,7 +94,7 @@ class EditorInspectorPluginFont : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
};
/*************************************************************************/

View File

@ -191,7 +191,7 @@ void EditorInspectorPluginOpenTypeFeatures::parse_begin(Object *p_object) {
void EditorInspectorPluginOpenTypeFeatures::parse_category(Object *p_object, const String &p_parse_category) {
}
bool EditorInspectorPluginOpenTypeFeatures::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorPluginOpenTypeFeatures::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
if (p_path == "opentype_features/_new") {
OpenTypeFeaturesAdd *editor = memnew(OpenTypeFeaturesAdd);
add_property_editor(p_path, editor);

View File

@ -88,7 +88,7 @@ public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
virtual void parse_category(Object *p_object, const String &p_parse_category) override;
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
};
/*************************************************************************/

View File

@ -278,7 +278,7 @@ void EditorInspectorRootMotionPlugin::parse_begin(Object *p_object) {
//do none
}
bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
if (p_path == "root_motion_track" && p_object->is_class("AnimationTree") && p_type == Variant::NODE_PATH) {
EditorPropertyRootMotion *editor = memnew(EditorPropertyRootMotion);
if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {

View File

@ -65,7 +65,7 @@ class EditorInspectorRootMotionPlugin : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
virtual void parse_end() override;
};

View File

@ -44,7 +44,7 @@ void EditorInspectorPluginStyleBox::parse_begin(Object *p_object) {
add_custom_control(preview);
}
bool EditorInspectorPluginStyleBox::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorPluginStyleBox::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, bool p_wide) {
return false; //do not want
}

View File

@ -61,7 +61,7 @@ class EditorInspectorPluginStyleBox : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
virtual void parse_end() override;
};

View File

@ -4864,7 +4864,7 @@ void EditorInspectorShaderModePlugin::parse_begin(Object *p_object) {
//do none
}
bool EditorInspectorShaderModePlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) {
bool EditorInspectorShaderModePlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) {
if (p_path == "mode" && p_object->is_class("VisualShader") && p_type == Variant::INT) {
EditorPropertyShaderMode *editor = memnew(EditorPropertyShaderMode);
Vector<String> options = p_hint_text.split(",");

View File

@ -505,7 +505,7 @@ class EditorInspectorShaderModePlugin : public EditorInspectorPlugin {
public:
virtual bool can_handle(Object *p_object) override;
virtual void parse_begin(Object *p_object) override;
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false) override;
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false) override;
virtual void parse_end() override;
};

View File

@ -2158,13 +2158,13 @@ void CSGPolygon3D::_notification(int p_what) {
void CSGPolygon3D::_validate_property(PropertyInfo &property) const {
if (property.name.begins_with("spin") && mode != MODE_SPIN) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("path") && mode != MODE_PATH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "depth" && mode != MODE_DEPTH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
CSGShape3D::_validate_property(property);

View File

@ -513,19 +513,19 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (property.name == "base_script") {
if (call_mode != CALL_MODE_INSTANCE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
if (property.name == "basic_type") {
if (call_mode != CALL_MODE_BASIC_TYPE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
if (property.name == "singleton") {
if (call_mode != CALL_MODE_SINGLETON) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
} else {
List<Engine::Singleton> names;
Engine::get_singleton()->get_singletons(&names);
@ -543,7 +543,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
} else {
Node *bnode = _get_base_node();
if (bnode) {
@ -614,7 +614,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
}
if (mc == 0) {
property.usage = 0; //do not show
property.usage = PROPERTY_USAGE_NONE; //do not show
} else {
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 (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 (call_mode != CALL_MODE_INSTANCE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
if (property.name == "basic_type") {
if (call_mode != CALL_MODE_BASIC_TYPE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
} else {
Node *bnode = _get_base_node();
if (bnode) {
@ -1352,7 +1352,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
property.hint_string = options;
property.type = Variant::STRING;
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 (call_mode != CALL_MODE_INSTANCE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
if (property.name == "basic_type") {
if (call_mode != CALL_MODE_BASIC_TYPE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
if (property.name == "node_path") {
if (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
} else {
Node *bnode = _get_base_node();
if (bnode) {
@ -2029,7 +2029,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
property.hint_string = options;
property.type = Variant::STRING;
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") {
property.type = type;
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);
if (constants.size() == 0) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
return;
}
property.hint_string = "";

View File

@ -174,7 +174,7 @@ float VisualScriptYield::get_wait_time() {
void VisualScriptYield::_validate_property(PropertyInfo &property) const {
if (property.name == "wait_time") {
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 (call_mode != CALL_MODE_NODE_PATH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
} else {
Node *bnode = _get_base_node();
if (bnode) {

View File

@ -464,31 +464,31 @@ Vector2 CPUParticles2D::get_gravity() const {
void CPUParticles2D::_validate_property(PropertyInfo &property) const {
if (property.name == "color" && color_ramp.is_valid()) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_rect_extents" && emission_shape != EMISSION_SHAPE_RECTANGLE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if ((property.name == "emission_point_texture" || property.name == "emission_color_texture") && (emission_shape < EMISSION_SHAPE_POINTS)) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_normals" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_points" && emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_colors" && emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -435,27 +435,27 @@ Vector3 CPUParticles3D::get_gravity() const {
void CPUParticles3D::_validate_property(PropertyInfo &property) const {
if (property.name == "color" && color_ramp.is_valid()) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if ((property.name == "emission_point_texture" || property.name == "emission_color_texture") && (emission_shape < EMISSION_SHAPE_POINTS)) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_normals" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("orbit_") && !particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -385,7 +385,7 @@ void GPUParticles3D::_validate_property(PropertyInfo &property) const {
if (property.name.begins_with("draw_pass_")) {
int index = property.name.get_slicec('_', 2).to_int() - 1;
if (index >= draw_passes.size()) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
return;
}
}

View File

@ -209,19 +209,19 @@ void Light3D::_validate_property(PropertyInfo &property) const {
}
if (get_light_type() == RS::LIGHT_DIRECTIONAL && property.name == "light_size") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (get_light_type() == RS::LIGHT_DIRECTIONAL && property.name == "light_specular") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (get_light_type() == RS::LIGHT_DIRECTIONAL && property.name == "light_projector") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (get_light_type() != RS::LIGHT_DIRECTIONAL && property.name == "light_angular_distance") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -1367,13 +1367,13 @@ LightmapGI::GenerateProbes LightmapGI::get_generate_probes() const {
void LightmapGI::_validate_property(PropertyInfo &property) const {
if (property.name == "environment_custom_sky" && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "environment_custom_color" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "environment_custom_energy" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -246,9 +246,9 @@ void GeometryInstance3D::_get_property_list(List<PropertyInfo> *p_list) const {
has_def_value = true;
}
if (instance_uniforms.has(pi.name)) {
pi.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE | (has_def_value ? (PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED) : 0);
pi.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE | (has_def_value ? (PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED) : PROPERTY_USAGE_NONE);
} else {
pi.usage = PROPERTY_USAGE_EDITOR | (has_def_value ? PROPERTY_USAGE_CHECKABLE : 0); //do not save if not changed
pi.usage = PROPERTY_USAGE_EDITOR | (has_def_value ? PROPERTY_USAGE_CHECKABLE : PROPERTY_USAGE_NONE); //do not save if not changed
}
pi.name = "shader_params/" + pi.name;

View File

@ -47,7 +47,7 @@ void AnimationNodeBlendSpace1D::_validate_property(PropertyInfo &property) const
String left = property.name.get_slicec('/', 0);
int idx = left.get_slicec('_', 2).to_int();
if (idx >= blend_points_used) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
AnimationRootNode::_validate_property(property);

View File

@ -34,8 +34,8 @@
void AnimationNodeBlendSpace2D::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::VECTOR2, blend_position));
r_list->push_back(PropertyInfo(Variant::INT, closest, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, length_internal, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::INT, closest, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, length_internal, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeBlendSpace2D::get_parameter_default_value(const StringName &p_parameter) const {
@ -556,13 +556,13 @@ String AnimationNodeBlendSpace2D::get_caption() const {
void AnimationNodeBlendSpace2D::_validate_property(PropertyInfo &property) const {
if (auto_triangles && property.name == "triangles") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("blend_point_")) {
String left = property.name.get_slicec('/', 0);
int idx = left.get_slicec('_', 2).to_int();
if (idx >= blend_points_used) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
AnimationRootNode::_validate_property(property);

View File

@ -43,7 +43,7 @@ StringName AnimationNodeAnimation::get_animation() const {
Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = nullptr;
void AnimationNodeAnimation::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const {
@ -130,10 +130,10 @@ AnimationNodeAnimation::AnimationNodeAnimation() {
void AnimationNodeOneShot::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::BOOL, active));
r_list->push_back(PropertyInfo(Variant::BOOL, prev_active, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, remaining, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, time_to_restart, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::BOOL, prev_active, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, remaining, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, time_to_restart, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeOneShot::get_parameter_default_value(const StringName &p_parameter) const {
@ -607,10 +607,10 @@ void AnimationNodeTransition::get_parameter_list(List<PropertyInfo> *r_list) con
}
r_list->push_back(PropertyInfo(Variant::INT, current, PROPERTY_HINT_ENUM, anims));
r_list->push_back(PropertyInfo(Variant::INT, prev_current, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::INT, prev, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::FLOAT, prev_xfading, PROPERTY_HINT_NONE, "", 0));
r_list->push_back(PropertyInfo(Variant::INT, prev_current, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::INT, prev, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
r_list->push_back(PropertyInfo(Variant::FLOAT, prev_xfading, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeTransition::get_parameter_default_value(const StringName &p_parameter) const {
@ -752,7 +752,7 @@ void AnimationNodeTransition::_validate_property(PropertyInfo &property) const {
if (n != "count") {
int idx = n.to_int();
if (idx >= enabled_inputs) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
}

View File

@ -385,7 +385,7 @@ void AnimationNode::_set_filters(const Array &p_filters) {
void AnimationNode::_validate_property(PropertyInfo &property) const {
if (!has_filter() && (property.name == "filter_enabled" || property.name == "filters")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -239,7 +239,7 @@ bool CanvasItemMaterial::get_particles_anim_loop() const {
void CanvasItemMaterial::_validate_property(PropertyInfo &property) const {
if (property.name.begins_with("particles_anim_") && !particles_animation) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -77,7 +77,7 @@ RID Material::get_rid() const {
void Material::_validate_property(PropertyInfo &property) const {
if (!_can_do_next_pass() && property.name == "next_pass") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
@ -1710,7 +1710,7 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
_validate_high_end("heightmap", property);
if (property.name.begins_with("particles_anim_") && billboard_mode != BILLBOARD_PARTICLES) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "billboard_keep_scale" && billboard_mode == BILLBOARD_DISABLED) {
@ -1740,33 +1740,33 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
// alpha scissor slider isn't needed when alpha antialiasing is enabled
if (property.name == "alpha_scissor_threshold" && transparency != TRANSPARENCY_ALPHA_SCISSOR) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
// alpha hash scale slider is only needed if transparency is alpha hash
if (property.name == "alpha_hash_scale" && transparency != TRANSPARENCY_ALPHA_HASH) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "alpha_antialiasing_mode" && !can_select_aa) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
// we can't choose an antialiasing mode if alpha isn't possible
if (property.name == "alpha_antialiasing_edge" && !alpha_aa_enabled) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "blend_mode" && alpha_aa_enabled) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if ((property.name == "heightmap_min_layers" || property.name == "heightmap_max_layers") && !deep_parallax) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (flags[FLAG_SUBSURFACE_MODE_SKIN] && (property.name == "subsurf_scatter_transmittance_color" || property.name == "subsurf_scatter_transmittance_texture" || property.name == "subsurf_scatter_transmittance_curve")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (orm) {
@ -1775,12 +1775,12 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
property.hint_string = "Unshaded,Per-Pixel";
}
if (property.name.begins_with("roughness") || property.name.begins_with("metallic") || property.name.begins_with("ao_texture")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
} else {
if (property.name == "orm_texture") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
@ -1788,47 +1788,47 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const {
if (shading_mode != SHADING_MODE_PER_VERTEX) {
//these may still work per vertex
if (property.name.begins_with("ao")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("emission")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("metallic")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("rim")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("roughness")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("subsurf_scatter")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
//these definitely only need per pixel
if (property.name.begins_with("anisotropy")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("clearcoat")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("normal")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("backlight")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("transmittance")) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
}

View File

@ -501,14 +501,14 @@ void NavigationMesh::_bind_methods() {
void NavigationMesh::_validate_property(PropertyInfo &property) const {
if (property.name == "geometry/collision_mask") {
if (parsed_geometry_type == PARSED_GEOMETRY_MESH_INSTANCES) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
return;
}
}
if (property.name == "geometry/source_group_name") {
if (source_geometry_mode == SOURCE_GEOMETRY_NAVMESH_CHILDREN) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
return;
}
}

View File

@ -1041,39 +1041,39 @@ RID ParticlesMaterial::get_shader_rid() const {
void ParticlesMaterial::_validate_property(PropertyInfo &property) const {
if (property.name == "color" && color_ramp.is_valid()) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if ((property.name == "emission_point_texture" || property.name == "emission_color_texture") && (emission_shape < EMISSION_SHAPE_POINTS)) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_normal_texture" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "emission_point_count" && (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS)) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "sub_emitter_frequency" && sub_emitter_mode != SUB_EMITTER_CONSTANT) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name == "sub_emitter_amount_at_end" && sub_emitter_mode != SUB_EMITTER_AT_END) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("orbit_") && !particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}

View File

@ -1873,7 +1873,7 @@ void AnimatedTexture::_validate_property(PropertyInfo &property) const {
if (prop.begins_with("frame_")) {
int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int();
if (frame >= frame_count) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
}

View File

@ -276,7 +276,7 @@ void AudioEffectChorus::_validate_property(PropertyInfo &property) const {
if (property.name.begins_with("voice/")) {
int voice_idx = property.name.get_slice("/", 1).to_int();
if (voice_idx > voice_count) {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
}

View File

@ -100,7 +100,7 @@ class AudioEffectLowPassFilter : public AudioEffectFilter {
void _validate_property(PropertyInfo &property) const override {
if (property.name == "gain") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
@ -113,7 +113,7 @@ class AudioEffectHighPassFilter : public AudioEffectFilter {
GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const override {
if (property.name == "gain") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}
@ -126,7 +126,7 @@ class AudioEffectBandPassFilter : public AudioEffectFilter {
GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const override {
if (property.name == "gain") {
property.usage = 0;
property.usage = PROPERTY_USAGE_NONE;
}
}