60 const char *default_tool);
68 const char *idname_pending);
77 if (workspace ==
nullptr) {
100 return tref ? tref->
runtime :
nullptr;
107 if ((tref->space_type == tkey->
space_type) && (tref->mode == tkey->
mode)) {
117 return tref ? tref->
runtime :
nullptr;
173 if (workspace ==
nullptr) {
192 if (gzgt !=
nullptr) {
214 if (item_idx == -1) {
224 if (active_tool->
runtime ==
nullptr) {
239 const char *brush_type_name)
255 if (paint->
brush !=
nullptr) {
256 if (std::optional<AssetWeakReference> brush_asset_reference =
260 __func__, *brush_asset_reference);
267 const int brush_type)
269 if (paint->
brush ==
nullptr) {
273 if (!brush_type_name || !brush_type_name[0]) {
279 paint, brush_type_name))
281 MEM_delete(existing_brush_ref->brush_asset_reference);
282 existing_brush_ref->brush_asset_reference = MEM_new<AssetWeakReference>(
384 std::optional<AssetWeakReference> brush_asset_reference =
385 [&]() -> std::optional<AssetWeakReference> {
388 paint, brush_type_name);
398 if (brush_asset_reference) {
409 std::optional<AssetWeakReference> main_brush_asset_reference =
410 [&]() -> std::optional<AssetWeakReference> {
418 if (main_brush_asset_reference) {
509 if (gzgt !=
nullptr) {
535 if (tref->
runtime ==
nullptr) {
569 if (tref->tag == 0) {
600 if (tref->
tag == 0) {
625 if (tref->
runtime ==
nullptr) {
629 if (tref_rt != tref->
runtime) {
635 bool use_fallback_keymap =
false;
639 use_fallback_keymap =
true;
645 use_fallback_keymap =
true;
650 if (use_fallback_keymap ==
false) {
662 if (win !=
nullptr) {
677 if ((tref_rt ==
nullptr) || (tref_rt->
data_block[0] ==
'\0')) {
747 switch (space_type) {
752 if (obact !=
nullptr) {
787 if (area !=
nullptr) {
809 } context_prev = {
nullptr};
820 int space_type_mask_handled = 0;
823 const int space_type_mask = (1 << area->spacetype);
825 ((space_type_mask_handled & space_type_mask) == 0))
827 space_type_mask_handled |= space_type_mask;
832 if (tref != area->
runtime.tool) {
833 if (context_prev.is_set ==
false) {
837 context_prev.is_set =
true;
850 if (context_prev.is_set) {
883 if (tref->space_type == area->
spacetype) {
884 if (tref->mode == mode) {
890 return !(is_tool_set_prev && (tref_prev == area->
runtime.
tool));
898 space_type_has_tools[tref->space_type] =
true;
904 area->runtime.tool =
nullptr;
905 area->runtime.is_tool_set =
true;
906 if (space_type_has_tools[area->spacetype]) {
940 if (mode == tref->
mode) {
941 area->runtime.tool = tref;
942 area->
runtime.is_tool_set =
true;
989 return (tref &&
STREQ(tref->
idname, name)) ? tref :
nullptr;
1015 if (
ot ==
nullptr) {
1057 const char *idname_pending)
1062 const bool this_match =
STREQ(idname_pending, tref->
idname);
1087 if (area->runtime.tool == tref) {
1088 area->runtime.tool =
nullptr;
1089 area->runtime.is_tool_set =
false;
1114 switch (tkey->
mode) {
1128 return "builtin.brush";
1130 return "builtin_brush.Comb";
1132 return "builtin.select_text";
1136 switch (tkey->
mode) {
1138 return "builtin.brush";
1140 return "builtin.sample";
1144 return "builtin.select_box";
1147 return "builtin.select_box";
1151 return "builtin.select_box";
1160 const char *default_tool)
1164 if (default_tool ==
nullptr) {
1200 if (win != win_prev) {
1202 if (workspace_iter != workspace) {
1247 if (win->
next !=
nullptr) {
1253 }
while ((win = win->
next));
1281 if (group ==
nullptr) {
1303 return (prop !=
nullptr);
1321 *dst_ptr = *src_ptr;
1322 if (dst_ptr->
data) {
1329 if (group !=
nullptr) {
WorkSpace * CTX_wm_workspace(const bContext *C)
@ CTX_MODE_VERTEX_GPENCIL_LEGACY
@ CTX_MODE_WEIGHT_GPENCIL_LEGACY
@ CTX_MODE_SCULPT_GPENCIL_LEGACY
@ CTX_MODE_PAINT_GREASE_PENCIL
@ CTX_MODE_PAINT_GPENCIL_LEGACY
@ CTX_MODE_SCULPT_GREASE_PENCIL
@ CTX_MODE_WEIGHT_GREASE_PENCIL
@ CTX_MODE_VERTEX_GREASE_PENCIL
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, eObjectMode object_mode)
void CTX_wm_window_set(bContext *C, wmWindow *win)
Main * CTX_data_main(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, blender::StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_ReplaceInGroup_ex(IDProperty *group, IDProperty *prop, IDProperty *prop_exist, int flag)
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
bool BKE_paint_brush_set(Paint *paint, Brush *brush)
Paint * BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode)
const EnumPropertyItem * BKE_paint_get_tool_enum_from_paintmode(PaintMode mode)
void BKE_paint_previous_asset_reference_clear(Paint *paint)
std::optional< AssetWeakReference > BKE_paint_brush_type_default_reference(eObjectMode ob_mode, std::optional< int > brush_type)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
bool BKE_paint_brush_poll(const Paint *paint, const Brush *brush)
PaintMode BKE_paintmode_get_from_tool(const bToolRef *tref)
std::optional< int > BKE_paint_get_brush_type_from_paintmode(const Brush *brush, PaintMode mode)
bool BKE_paint_ensure_from_paintmode(Scene *sce, PaintMode mode)
void BKE_workspace_id_tag_all_visible(Main *bmain, int tag) ATTR_NONNULL()
#define BLI_assert_unreachable()
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findstring_ptr(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_INLINE bool BLI_listbase_is_single(const ListBase *lb)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define SNPRINTF(dst, format,...)
char * STRNCPY(char(&dst)[N], const char *src)
#define CLOG_WARN(clg_ref,...)
ID and Library types, which are fundamental for SDNA.
Object is a sort of wrapper for general info.
#define OBEDIT_FROM_OBACT(ob)
@ AREA_FLAG_ACTIVE_TOOL_UPDATE
@ TOOLREF_FLAG_FALLBACK_KEYMAP
@ TOOLREF_FLAG_USE_BRUSHES
Read Guarded memory(de)allocation.
@ WM_GIZMOGROUPTYPE_TOOL_INIT
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
CLG_LogRef * WM_LOG_TOOLS
void * MEM_callocN(size_t len, const char *str)
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
std::optional< AssetWeakReference > asset_edit_weak_reference_from_id(const ID &id)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier)
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[]
struct AssetWeakReference * brush_asset_reference
struct Paint_Runtime runtime
struct AssetWeakReference * brush_asset_reference
ToolSystemBrushBindings tool_brush_bindings
struct ToolSettings * toolsettings
wmGizmoMapType_Params gzmap_params
eWM_GizmoFlagGroupTypeFlag flag
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
bool WM_gizmo_group_type_ensure_ptr(wmGizmoGroupType *gzgt)
void WM_gizmo_group_remove_by_tool(bContext *C, Main *bmain, const wmGizmoGroupType *gzgt, const bToolRef *tref)
wmGizmoGroupType * WM_gizmogrouptype_find(const StringRef idname, bool quiet)
void WM_gizmoconfig_update_tag_group_type_init(wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
wmGizmoMapType * WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params)
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Scene * WM_window_get_active_scene(const wmWindow *win)
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)