Skip to content

Commit

Permalink
CraterCrashGH-498 Improve NodePath dialogs for nodes and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jul 13, 2024
1 parent f6dd912 commit b9e5699
Show file tree
Hide file tree
Showing 13 changed files with 883 additions and 221 deletions.
11 changes: 11 additions & 0 deletions src/common/property_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ namespace PropertyUtils
return Variant::get_type_name(p_property.type);
}

String get_variant_type_name(const PropertyInfo& p_property)
{
if (is_variant(p_property))
return "Variant";

if (p_property.type == Variant::OBJECT)
return "MiniObject";

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

String usage_to_string(uint32_t p_usage)
{
static HashMap<uint32_t, String> usage_names = get_property_usage_name_map();
Expand Down
5 changes: 5 additions & 0 deletions src/common/property_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ namespace PropertyUtils
/// @return the property type name
String get_property_type_name(const PropertyInfo& p_property);

/// Get the type name based on variant types only
/// @param p_property the property
/// @return the property type name
String get_variant_type_name(const PropertyInfo& p_property);

/// Converts a property info's <code>usage</code> bitfield to a string.
/// @param p_usage the property usage flags bitfield value
/// @return comma-separated string of property usage flags
Expand Down
6 changes: 6 additions & 0 deletions src/common/scene_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ namespace SceneUtils
return vbox->has_theme_icon(p_icon_name);
}

Color get_editor_color(const String& p_color_name, const String& p_category)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
return vbox->get_theme_color(p_color_name, p_category);
}

Ref<Texture2D> get_editor_icon(const String& p_icon_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
Expand Down
6 changes: 6 additions & 0 deletions src/common/scene_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ namespace SceneUtils
/// @return true if the icon exists; false otherwise
bool has_editor_icon(const String& p_icon_name);

/// Get the editor theme named color
/// @param p_color_name the color name
/// @param p_category the color category, defaults to "Editor"
/// @return the editor color
Color get_editor_color(const String& p_color_name, const String& p_category = "Editor");

/// Load an icon.
///
/// @param p_icon_name the editor icon to load
Expand Down
Loading

0 comments on commit b9e5699

Please sign in to comment.