Skip to content

Commit

Permalink
CraterCrashGH-484 Show enum, bitfield, class icons in variable panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jul 6, 2024
1 parent 80ed037 commit ac5e2a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/editor/component_panels/variables_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void OrchestratorScriptVariablesComponentPanel::_create_variable_item(TreeItem*
item->set_button_disabled(0, index, true);
}

item->add_button(0, SceneUtils::get_editor_icon(p_variable->get_variable_type_name()), 2);
item->add_button(0, SceneUtils::get_class_icon(p_variable->get_variable_type_name()), 2);

if (!p_variable->get_description().is_empty())
{
Expand Down
7 changes: 7 additions & 0 deletions src/script/variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ String OScriptVariable::get_variable_type_name() const
if (_info.type == Variant::NIL)
return "Variant";

if (_info.hint == PROPERTY_HINT_ENUM || _info.usage & PROPERTY_USAGE_CLASS_IS_ENUM)
return "Enum";
else if (_info.hint == PROPERTY_HINT_FLAGS || _info.usage & PROPERTY_USAGE_CLASS_IS_BITFIELD)
return "Enum";
else if (_info.type == Variant::OBJECT && !_info.class_name.is_empty() && !_info.class_name.contains("."))
return _info.class_name;

return Variant::get_type_name(_info.type);
}

Expand Down

0 comments on commit ac5e2a2

Please sign in to comment.