Skip to content

Commit

Permalink
GH-555 Add custom icons for pass-by reference/value
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jul 21, 2024
1 parent 172ce83 commit ce27cc2
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bo6446fycy5n"
path="res://.godot/imported/CircleReference.svg-452a6b59c24b710639430d28505145ae.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/orchestrator/editor/icons/CircleReference.svg"
dest_files=["res://.godot/imported/CircleReference.svg-452a6b59c24b710639430d28505145ae.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
1 change: 1 addition & 0 deletions project/addons/orchestrator/editor/icons/CircleValue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions project/addons/orchestrator/editor/icons/CircleValue.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bfk8ej2o0dgcf"
path="res://.godot/imported/CircleValue.svg-587a193410954141d7def4c437a0e723.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/orchestrator/editor/icons/CircleValue.svg"
dest_files=["res://.godot/imported/CircleValue.svg-587a193410954141d7def4c437a0e723.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
5 changes: 5 additions & 0 deletions src/common/scene_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ namespace SceneUtils
return vbox->get_theme_color(p_color_name, p_category);
}

Ref<Texture2D> get_icon(const String& p_name)
{
return ResourceLoader::get_singleton()->load(vformat("res://addons/orchestrator/editor/icons/%s.svg", p_name));
}

Ref<Texture2D> get_editor_icon(const String& p_icon_name)
{
VBoxContainer* vbox = OrchestratorPlugin::get_singleton()->get_editor_interface()->get_editor_main_screen();
Expand Down
5 changes: 5 additions & 0 deletions src/common/scene_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ namespace SceneUtils
/// @return the editor color
Color get_editor_color(const String& p_color_name, const String& p_category = "Editor");

/// Gets an Orchestrator editor icon
/// @param p_name the icon name
/// @return a reference to the icon
Ref<Texture2D> get_icon(const String& p_name);

/// Load an icon.
///
/// @param p_icon_name the editor icon to load
Expand Down
4 changes: 2 additions & 2 deletions src/editor/inspector/property_info_container_property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ void OrchestratorPropertyInfoContainerEditorProperty::_update_pass_by_details(in

if (PropertyUtils::is_passed_by_reference(p_property))
{
pass_by->set_button_icon(SceneUtils::get_editor_icon("KeyXScale"));
pass_by->set_button_icon(SceneUtils::get_icon("CircleReference"));
pass_by->set_tooltip_text("Property is passed by reference");
}
else
{
pass_by->set_button_icon(SceneUtils::get_editor_icon("KeyValue"));
pass_by->set_button_icon(SceneUtils::get_icon("CircleValue"));
pass_by->set_tooltip_text("Property is passed by value");
}
}
Expand Down

0 comments on commit ce27cc2

Please sign in to comment.