Skip to content

Commit

Permalink
GH-800 Temporarily disable some property get/set validation rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Sep 7, 2024
1 parent 5da872b commit 57c0207
Showing 1 changed file with 34 additions and 32 deletions.
66 changes: 34 additions & 32 deletions src/script/nodes/properties/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,25 +308,26 @@ void OScriptNodeProperty::validate_node_during_build(BuildLog& p_log) const
{
p_log.error(this, "Requires a connection.");
}
else
{
const Ref<OScriptNodePin> source = target->get_connections()[0];
const Ref<OScriptTargetObject> target_object = source->resolve_target();
if (!target_object.is_valid() || !target_object->has_target())
{
if (!_property_exists(ClassDB::class_get_property_list(target->get_property_info().class_name)))
p_log.error(this, vformat("No property name '%s' found in class '%s'", _property.name, _property.class_name));
}
else
{
const Ref<Script> script = target_object->get_target()->get_script();
const bool script_property = script.is_valid() && _property_exists(script->get_script_property_list());
const bool object_property = _property_exists(target_object->get_target()->get_property_list());

if (!script_property && !object_property)
p_log.error(this, vformat("No property name '%s' found", _property.name));
}
}
// todo: Temporarily disabled as lookups are not always reliable, and validation errors are mistakenly thrown
// else
// {
// const Ref<OScriptNodePin> source = target->get_connections()[0];
// const Ref<OScriptTargetObject> target_object = source->resolve_target();
// if (!target_object.is_valid() || !target_object->has_target())
// {
// if (!_property_exists(ClassDB::class_get_property_list(target->get_property_info().class_name)))
// p_log.error(this, vformat("No property name '%s' found in class '%s'", _property.name, _property.class_name));
// }
// else
// {
// const Ref<Script> script = target_object->get_target()->get_script();
// const bool script_property = script.is_valid() && _property_exists(script->get_script_property_list());
// const bool object_property = _property_exists(target_object->get_target()->get_property_list());
//
// if (!script_property && !object_property)
// p_log.error(this, vformat("No property name '%s' found", _property.name));
// }
// }
}
else if (_call_mode == CALL_SELF)
{
Expand All @@ -336,19 +337,20 @@ void OScriptNodeProperty::validate_node_during_build(BuildLog& p_log) const
}
else if (_call_mode == CALL_NODE_PATH)
{
if (SceneTree* st = Object::cast_to<SceneTree>(Engine::get_singleton()->get_main_loop()))
{
// Only if the node is found in the current edited scene, validate existance of property
if (Node* node = st->get_edited_scene_root()->get_node_or_null(_node_path))
{
const Ref<Script> script = node->get_script();
const bool script_property = script.is_valid() && _property_exists(script->get_script_property_list());
const bool object_property = _property_exists(node->get_property_list());

if (!script_property && !object_property)
p_log.error(this, vformat("No property name '%s' found for node path '%s'.", _property.name, _node_path));
}
}
// todo: Temporarily disabled as lookups are not always reliable, and validation errors are mistakenly thrown
// if (SceneTree* st = Object::cast_to<SceneTree>(Engine::get_singleton()->get_main_loop()))
// {
// // Only if the node is found in the current edited scene, validate existance of property
// if (Node* node = st->get_edited_scene_root()->get_node_or_null(_node_path))
// {
// const Ref<Script> script = node->get_script();
// const bool script_property = script.is_valid() && _property_exists(script->get_script_property_list());
// const bool object_property = _property_exists(node->get_property_list());
//
// if (!script_property && !object_property)
// p_log.error(this, vformat("No property name '%s' found for node path '%s'.", _property.name, _node_path));
// }
// }
}
super::validate_node_during_build(p_log);
}
Expand Down

0 comments on commit 57c0207

Please sign in to comment.