UI: Improved Area Icon Using a SpaceType Callback #124556

Merged
Harley Acheson merged 5 commits from Harley/blender:AreaIcons into main 2024-07-12 00:08:35 +02:00
7 changed files with 7 additions and 7 deletions
Showing only changes of commit fb5c826db5 - Show all commits

View File

@ -129,7 +129,7 @@ struct SpaceType {
/* Return a custom name, based on subtype or other reason. */
blender::StringRefNull (*space_name_get)(ScrArea *area);
/* Return a custom icon, based on subtype or other reason. */
int (*space_icon_get)(ScrArea *area);
int (*space_icon_get)(const ScrArea *area);
/**
* Update pointers for all structs directly owned by this space.

View File

@ -916,7 +916,7 @@ blender::StringRefNull ED_area_name(ScrArea *area)
return item.name;
}
int ED_area_icon(ScrArea *area)
int ED_area_icon(const ScrArea *area)
{
if (area->type->space_icon_get) {
return area->type->space_icon_get(area);

View File

@ -874,7 +874,7 @@ static blender::StringRefNull action_space_name_get(ScrArea *area)
return item.name;
}
static int action_space_icon_get(ScrArea *area)
static int action_space_icon_get(const ScrArea *area)
{
SpaceAction *sact = static_cast<SpaceAction *>(area->spacedata.first);
const int index = RNA_enum_from_value(rna_enum_space_action_mode_items, sact->mode);

View File

@ -839,7 +839,7 @@ static blender::StringRefNull file_space_name_get(ScrArea *area)
return item.name;
}
static int file_space_icon_get(ScrArea *area)
static int file_space_icon_get(const ScrArea *area)
{
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
const int index = RNA_enum_from_value(rna_enum_space_file_browse_mode_items, sfile->browse_mode);

View File

@ -876,7 +876,7 @@ static blender::StringRefNull graph_space_name_get(ScrArea *area)
return item.name;
}
static int graph_space_icon_get(ScrArea *area)
static int graph_space_icon_get(const ScrArea *area)
{
SpaceGraph *sgraph = static_cast<SpaceGraph *>(area->spacedata.first);
const int index = RNA_enum_from_value(rna_enum_space_graph_mode_items, sgraph->mode);

View File

@ -1085,7 +1085,7 @@ static blender::StringRefNull image_space_name_get(ScrArea *area)
return item.name;
}
static int image_space_icon_get(ScrArea *area)
static int image_space_icon_get(const ScrArea *area)
{
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
const int index = RNA_enum_from_value(rna_enum_space_image_mode_items, sima->mode);

View File

@ -1341,7 +1341,7 @@ static blender::StringRefNull node_space_name_get(ScrArea *area)
return tree_type->ui_name;
}
static int node_space_icon_get(ScrArea *area)
static int node_space_icon_get(const ScrArea *area)
{
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
Harley marked this conversation as resolved Outdated

static_cast

`static_cast`

Will post a separate PR changing to static_cast for node_space_name_get and other places in the same file.

Will post a separate PR changing to static_cast for node_space_name_get and other places in the same file.
bke::bNodeTreeType *tree_type = bke::ntreeTypeFind(snode->tree_idname);