UI: Optional Complex Layout for Workspace Status #120595

Merged
Harley Acheson merged 51 commits from Harley/blender:WorkspaceStatus into main 2024-05-06 23:52:47 +02:00
47 changed files with 112 additions and 123 deletions
Showing only changes of commit 694420558e - Show all commits

View File

@ -123,4 +123,16 @@ class RepeatZoneComputeContext : public ComputeContext {
void print_current_in_line(std::ostream &stream) const override;
};
class OperatorComputeContext : public ComputeContext {
private:
static constexpr const char *s_static_type = "OPERATOR";
public:
OperatorComputeContext();
OperatorComputeContext(const ComputeContext *parent);
private:
void print_current_in_line(std::ostream &stream) const override;
};
} // namespace blender::bke

View File

@ -10,13 +10,12 @@
#include "BLI_compiler_attrs.h"
#ifdef __cplusplus
extern "C" {
#endif
struct Main;
struct bScreen;
struct bToolRef;
struct WorkSpace;
struct WorkSpaceInstanceHook;
struct WorkSpaceLayout;
typedef struct WorkSpaceStatusItem {
struct WorkSpaceStatusItem *next, *prev;
Harley marked this conversation as resolved Outdated

Remove this, only needed for listbase.

Remove this, only needed for listbase.
@ -29,7 +28,7 @@ typedef struct WorkSpaceStatusItem {
/** \name Create, Delete, Initialize
* \{ */
struct WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name);
WorkSpace *BKE_workspace_add(Main *bmain, const char *name);
Harley marked this conversation as resolved

Don't use pointers, use blender::Vector<WorkSpaceStatusItem>.

Don't do unnecessary = {}, that's automatic.

Don't use pointers, use `blender::Vector<WorkSpaceStatusItem>`. Don't do unnecessary `= {}`, that's automatic.
/**
* Remove \a workspace by freeing itself and its data. This is a higher-level wrapper that
* calls #workspace_free_data (through #BKE_id_free) to free the workspace data, and frees
@ -37,23 +36,20 @@ struct WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name);
*
* Always use this to remove (and free) workspaces. Don't free non-ID workspace members here.
*/
void BKE_workspace_remove(struct Main *bmain, struct WorkSpace *workspace);
void BKE_workspace_remove(Main *bmain, WorkSpace *workspace);
struct WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const struct Main *bmain,
int winid);
void BKE_workspace_instance_hook_free(const struct Main *bmain,
struct WorkSpaceInstanceHook *hook);
WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const Main *bmain, int winid);
void BKE_workspace_instance_hook_free(const Main *bmain, WorkSpaceInstanceHook *hook);
/**
* Add a new layout to \a workspace for \a screen.
*/
struct WorkSpaceLayout *BKE_workspace_layout_add(struct Main *bmain,
struct WorkSpace *workspace,
struct bScreen *screen,
const char *name) ATTR_NONNULL();
void BKE_workspace_layout_remove(struct Main *bmain,
struct WorkSpace *workspace,
struct WorkSpaceLayout *layout) ATTR_NONNULL();
WorkSpaceLayout *BKE_workspace_layout_add(Main *bmain,
WorkSpace *workspace,
bScreen *screen,
const char *name) ATTR_NONNULL();
void BKE_workspace_layout_remove(Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout)
ATTR_NONNULL();
void BKE_workspace_relations_free(ListBase *relation_list);
@ -63,8 +59,7 @@ void BKE_workspace_relations_free(ListBase *relation_list);
/** \name General Utilities
* \{ */
struct WorkSpaceLayout *BKE_workspace_layout_find(const struct WorkSpace *workspace,
const struct bScreen *screen)
WorkSpaceLayout *BKE_workspace_layout_find(const WorkSpace *workspace, const bScreen *screen)
ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
/**
* Find the layout for \a screen without knowing which workspace to look in.
@ -73,10 +68,9 @@ struct WorkSpaceLayout *BKE_workspace_layout_find(const struct WorkSpace *worksp
* \param r_workspace: Optionally return the workspace that contains the
* looked up layout (if found).
*/
struct WorkSpaceLayout *BKE_workspace_layout_find_global(const struct Main *bmain,
const struct bScreen *screen,
struct WorkSpace **r_workspace)
ATTR_NONNULL(1, 2);
WorkSpaceLayout *BKE_workspace_layout_find_global(const Main *bmain,
const bScreen *screen,
WorkSpace **r_workspace) ATTR_NONNULL(1, 2);
/**
* Circular workspace layout iterator.
@ -87,15 +81,14 @@ struct WorkSpaceLayout *BKE_workspace_layout_find_global(const struct Main *bmai
*
* \return the layout at which \a callback returned false.
*/
struct WorkSpaceLayout *BKE_workspace_layout_iter_circular(
const struct WorkSpace *workspace,
struct WorkSpaceLayout *start,
bool (*callback)(const struct WorkSpaceLayout *layout, void *arg),
void *arg,
bool iter_backward);
WorkSpaceLayout *BKE_workspace_layout_iter_circular(const WorkSpace *workspace,
WorkSpaceLayout *start,
bool (*callback)(const WorkSpaceLayout *layout,
void *arg),
void *arg,
bool iter_backward);
void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tref)
ATTR_NONNULL(1, 2);
void BKE_workspace_tool_remove(WorkSpace *workspace, bToolRef *tref) ATTR_NONNULL(1, 2);
/**
* Replace tools ID's, intended for use in versioning code.
@ -107,7 +100,7 @@ void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tre
* \param replace_table: An array of (source, destination) pairs.
* \param replace_table_num: The number of items in `replace_table`.
*/
void BKE_workspace_tool_id_replace_table(struct WorkSpace *workspace,
void BKE_workspace_tool_id_replace_table(WorkSpace *workspace,
const int space_type,
const int mode,
const char *idname_prefix_skip,
@ -123,15 +116,13 @@ void BKE_workspace_tool_id_replace_table(struct WorkSpace *workspace,
#define GETTER_ATTRS ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
#define SETTER_ATTRS ATTR_NONNULL(1)
struct WorkSpace *BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS;
void BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook,
struct WorkSpace *workspace) SETTER_ATTRS;
WorkSpace *BKE_workspace_active_get(WorkSpaceInstanceHook *hook) GETTER_ATTRS;
void BKE_workspace_active_set(WorkSpaceInstanceHook *hook, WorkSpace *workspace) SETTER_ATTRS;
/**
* Get the layout that is active for \a hook (which is the visible layout for the active workspace
* in \a hook).
*/
struct WorkSpaceLayout *BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook)
GETTER_ATTRS;
WorkSpaceLayout *BKE_workspace_active_layout_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS;
/**
* \brief Activate a layout
*
@ -143,33 +134,31 @@ struct WorkSpaceLayout *BKE_workspace_active_layout_get(const struct WorkSpaceIn
*
* #WorkSpaceInstanceHook.act_layout should only be modified directly to update the layout pointer.
*/
void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook,
void BKE_workspace_active_layout_set(WorkSpaceInstanceHook *hook,
int winid,
struct WorkSpace *workspace,
struct WorkSpaceLayout *layout) SETTER_ATTRS;
struct bScreen *BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook)
GETTER_ATTRS;
void BKE_workspace_active_screen_set(struct WorkSpaceInstanceHook *hook,
WorkSpace *workspace,
WorkSpaceLayout *layout) SETTER_ATTRS;
bScreen *BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS;
void BKE_workspace_active_screen_set(WorkSpaceInstanceHook *hook,
int winid,
struct WorkSpace *workspace,
struct bScreen *screen) SETTER_ATTRS;
WorkSpace *workspace,
bScreen *screen) SETTER_ATTRS;
const char *BKE_workspace_layout_name_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS;
void BKE_workspace_layout_name_set(struct WorkSpace *workspace,
struct WorkSpaceLayout *layout,
const char *BKE_workspace_layout_name_get(const WorkSpaceLayout *layout) GETTER_ATTRS;
void BKE_workspace_layout_name_set(WorkSpace *workspace,
WorkSpaceLayout *layout,
const char *new_name) ATTR_NONNULL();
struct bScreen *BKE_workspace_layout_screen_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS;
bScreen *BKE_workspace_layout_screen_get(const WorkSpaceLayout *layout) GETTER_ATTRS;
/**
* Get the layout to be activated should \a workspace become or be the active workspace in \a hook.
*/
struct WorkSpaceLayout *BKE_workspace_active_layout_for_workspace_get(
const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS;
WorkSpaceLayout *BKE_workspace_active_layout_for_workspace_get(
const WorkSpaceInstanceHook *hook, const WorkSpace *workspace) GETTER_ATTRS;
bool BKE_workspace_owner_id_check(const struct WorkSpace *workspace, const char *owner_id)
ATTR_NONNULL();
bool BKE_workspace_owner_id_check(const WorkSpace *workspace, const char *owner_id) ATTR_NONNULL();
void BKE_workspace_id_tag_all_visible(struct Main *bmain, int tag) ATTR_NONNULL();
void BKE_workspace_id_tag_all_visible(Main *bmain, int tag) ATTR_NONNULL();
void BKE_workspace_status_clear(struct WorkSpace *workspace);
@ -177,7 +166,3 @@ void BKE_workspace_status_clear(struct WorkSpace *workspace);
#undef SETTER_ATTRS
/** \} */
#ifdef __cplusplus
}
#endif

View File

@ -525,7 +525,7 @@ set(SRC
BKE_volume_render.hh
BKE_volume_to_mesh.hh
BKE_wm_runtime.hh
BKE_workspace.h
BKE_workspace.hh
BKE_world.h
BKE_writemovie.hh

View File

@ -55,7 +55,7 @@
#include "BKE_screen.hh"
#include "BKE_studiolight.h"
#include "BKE_undo_system.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_read_write.hh"
#include "BLO_readfile.hh"

View File

@ -117,4 +117,17 @@ void RepeatZoneComputeContext::print_current_in_line(std::ostream &stream) const
stream << "Repeat Zone ID: " << output_node_id_;
}
OperatorComputeContext::OperatorComputeContext() : OperatorComputeContext(nullptr) {}
OperatorComputeContext::OperatorComputeContext(const ComputeContext *parent)
: ComputeContext(s_static_type, parent)
{
hash_.mix_in(s_static_type, strlen(s_static_type));
}
void OperatorComputeContext::print_current_in_line(std::ostream &stream) const
{
stream << "Operator";
}
} // namespace blender::bke

View File

@ -39,7 +39,7 @@
#include "BKE_screen.hh"
#include "BKE_sound.h"
#include "BKE_wm_runtime.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RE_engine.h"

View File

@ -79,7 +79,7 @@
#include "BKE_preview_image.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLF_api.hh"

View File

@ -83,7 +83,7 @@
#include "BKE_screen.hh"
#include "BKE_sound.h"
#include "BKE_unit.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

View File

@ -25,7 +25,7 @@
#include "BKE_lib_query.hh"
#include "BKE_main.hh"
#include "BKE_viewer_path.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"

View File

@ -86,7 +86,7 @@
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_undo_system.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DRW_engine.hh"

View File

@ -87,7 +87,7 @@
#include "BKE_screen.hh"
#include "BKE_studiolight.h"
#include "BKE_unit.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "SEQ_iterator.hh"
#include "SEQ_modifier.hh"

View File

@ -80,7 +80,7 @@
#include "BKE_nla.h"
#include "BKE_node.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RNA_access.hh"
#include "RNA_enum_types.hh"

View File

@ -58,7 +58,7 @@
#include "BKE_node_tree_update.hh"
#include "BKE_paint.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_readfile.hh"

View File

@ -114,7 +114,7 @@
#include "BKE_node.hh"
#include "BKE_packedFile.h"
#include "BKE_report.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_blend_defs.hh"
#include "BLO_blend_validate.hh"

View File

@ -35,7 +35,7 @@
#include "BKE_node.hh"
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_debug.hh"

View File

@ -41,7 +41,7 @@
#include "BKE_nla.h"
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

View File

@ -113,27 +113,6 @@ static const bNodeTree *get_node_group(const bContext &C, PointerRNA &ptr, Repor
return group;
}
class OperatorComputeContext : public ComputeContext {
private:
static constexpr const char *s_static_type = "OPERATOR";
std::string operator_name_;
public:
OperatorComputeContext(std::string operator_name)
: ComputeContext(s_static_type, nullptr), operator_name_(std::move(operator_name))
{
hash_.mix_in(s_static_type, strlen(s_static_type));
hash_.mix_in(operator_name_.data(), operator_name_.size());
}
private:
void print_current_in_line(std::ostream &stream) const override
{
stream << "Operator: " << operator_name_;
}
};
/**
* Geometry nodes currently requires working on "evaluated" data-blocks (rather than "original"
* data-blocks that are part of a #Main data-base). This could change in the future, but for now,
@ -405,7 +384,7 @@ static int run_node_group_exec(bContext *C, wmOperator *op)
IDProperty *properties = replace_inputs_evaluated_data_blocks(*op->properties, *depsgraph);
BLI_SCOPED_DEFER([&]() { IDP_FreeProperty_ex(properties, false); });
OperatorComputeContext compute_context(op->type->idname);
bke::OperatorComputeContext compute_context;
auto eval_log = std::make_unique<geo_log::GeoModifierLog>();
for (Object *object : objects) {

View File

@ -65,7 +65,7 @@
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "BKE_softbody.h"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

View File

@ -56,7 +56,7 @@
#include "BKE_scene.hh"
#include "BKE_texture.h"
#include "BKE_vfont.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BKE_world.h"
#include "NOD_composite.hh"

View File

@ -22,7 +22,7 @@
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RNA_access.hh"

View File

@ -28,7 +28,7 @@
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_sound.h"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_types.hh"

View File

@ -42,7 +42,7 @@
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_sound.h"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_types.hh"

View File

@ -20,7 +20,7 @@
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_readfile.hh"

View File

@ -17,7 +17,7 @@
#include "BKE_context.hh"
#include "BKE_main.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"

View File

@ -25,7 +25,7 @@
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "ED_node.hh" /* own include */
#include "ED_screen.hh"

View File

@ -44,7 +44,7 @@
#include "BKE_main.hh"
#include "BKE_object.hh"
#include "BKE_report.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

View File

@ -63,7 +63,7 @@
#include "BKE_paint.hh"
#include "BKE_scene.hh"
#include "BKE_tracking.h"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_toolsystem.hh"

View File

@ -31,7 +31,7 @@
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_undo_system.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_blend_validate.hh"

View File

@ -10,7 +10,7 @@
#include "BKE_main.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_zones.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLI_listbase.h"
#include "BLI_string.h"

View File

@ -5,7 +5,7 @@
/** \file
* \ingroup DNA
*
* Use API in BKE_workspace.h to edit these.
* Use API in BKE_workspace.hh to edit these.
*/
#pragma once

View File

@ -60,7 +60,7 @@
# include "BKE_texture.h"
# include "BKE_vfont.hh"
# include "BKE_volume.hh"
# include "BKE_workspace.h"
# include "BKE_workspace.hh"
# include "BKE_world.h"
# include "DEG_depsgraph_build.hh"

View File

@ -76,7 +76,7 @@ const EnumPropertyItem rna_enum_ramp_blend_items[] = {
# include "BKE_paint.hh"
# include "BKE_scene.hh"
# include "BKE_texture.h"
# include "BKE_workspace.h"
# include "BKE_workspace.hh"
# include "DEG_depsgraph.hh"
# include "DEG_depsgraph_build.hh"

View File

@ -58,7 +58,7 @@ static const EnumPropertyItem rna_enum_region_panel_category_items[] = {
# include "BKE_global.hh"
# include "BKE_screen.hh"
# include "BKE_workspace.h"
# include "BKE_workspace.hh"
# include "DEG_depsgraph.hh"

View File

@ -563,7 +563,7 @@ static const EnumPropertyItem rna_enum_curve_display_handle_items[] = {
# include "BKE_preferences.h"
# include "BKE_scene.hh"
# include "BKE_screen.hh"
# include "BKE_workspace.h"
# include "BKE_workspace.hh"
# include "DEG_depsgraph.hh"
# include "DEG_depsgraph_build.hh"

View File

@ -20,7 +20,7 @@
#include "BKE_keyconfig.h"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"

View File

@ -45,7 +45,7 @@
# include "BKE_global.hh"
# include "BKE_idprop.hh"
# include "BKE_workspace.h"
# include "BKE_workspace.hh"
# include "MEM_guardedalloc.h"

View File

@ -10,7 +10,7 @@
#include "RNA_enum_types.hh"
#include "RNA_types.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "ED_render.hh"

View File

@ -59,7 +59,7 @@
#include "BKE_object.hh"
#include "BKE_pointcloud.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_read_write.hh"

View File

@ -16,7 +16,7 @@
#include "BKE_context.hh"
#include "BKE_main.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_types.hh"

View File

@ -24,7 +24,7 @@
#include "BKE_context.hh"
#include "BKE_main.hh"
#include "BKE_report.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"

View File

@ -37,7 +37,7 @@
#include "BKE_main.hh"
#include "BKE_report.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_message.hh"

View File

@ -44,7 +44,7 @@
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_undo_system.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BKE_sound.h"

View File

@ -82,7 +82,7 @@
#include "BKE_screen.hh"
#include "BKE_sound.h"
#include "BKE_undo_system.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLO_writefile.hh"

View File

@ -34,7 +34,7 @@
#include "BKE_idprop.hh"
#include "BKE_main.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "BLT_translation.hh"

View File

@ -21,7 +21,7 @@
#include "BKE_context.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "WM_api.hh"
#include "WM_types.hh"

View File

@ -32,7 +32,7 @@
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_paint.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RNA_access.hh"
#include "RNA_enum_types.hh"

View File

@ -41,7 +41,7 @@
#include "BKE_main.hh"
#include "BKE_report.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.h"
#include "BKE_workspace.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"