62 const char *default_tool);
70 const char *idname_pending);
79 if (workspace ==
nullptr) {
102 return tref ? tref->
runtime :
nullptr;
109 if ((tref->space_type == tkey->
space_type) && (tref->mode == tkey->
mode)) {
119 return tref ? tref->
runtime :
nullptr;
175 if (workspace ==
nullptr) {
194 if (gzgt !=
nullptr) {
216 if (item_idx == -1) {
226 if (active_tool->
runtime ==
nullptr) {
241 const char *brush_type_name)
257 if (paint->
brush !=
nullptr) {
258 if (std::optional<AssetWeakReference> brush_asset_reference =
262 __func__, *brush_asset_reference);
269 const int brush_type)
271 if (paint->
brush ==
nullptr) {
275 if (!brush_type_name || !brush_type_name[0]) {
281 paint, brush_type_name))
283 MEM_delete(existing_brush_ref->brush_asset_reference);
284 existing_brush_ref->brush_asset_reference = MEM_new<AssetWeakReference>(
386 std::optional<AssetWeakReference> brush_asset_reference =
387 [&]() -> std::optional<AssetWeakReference> {
390 paint, brush_type_name);
400 if (brush_asset_reference) {
411 std::optional<AssetWeakReference> main_brush_asset_reference =
412 [&]() -> std::optional<AssetWeakReference> {
419 if (main_brush_asset_reference) {
510 if (gzgt !=
nullptr) {
536 if (tref->
runtime ==
nullptr) {
570 if (tref->tag == 0) {
601 if (tref->
tag == 0) {
626 if (tref->
runtime ==
nullptr) {
630 if (tref_rt != tref->
runtime) {
636 bool use_fallback_keymap =
false;
640 use_fallback_keymap =
true;
646 use_fallback_keymap =
true;
651 if (use_fallback_keymap ==
false) {
663 if (win !=
nullptr) {
678 if ((tref_rt ==
nullptr) || (tref_rt->
data_block[0] ==
'\0')) {
748 switch (space_type) {
753 if (obact !=
nullptr) {
788 if (area !=
nullptr) {
810 } context_prev = {
nullptr};
821 int space_type_mask_handled = 0;
824 const int space_type_mask = (1 << area->spacetype);
826 ((space_type_mask_handled & space_type_mask) == 0))
828 space_type_mask_handled |= space_type_mask;
833 if (tref != area->
runtime.tool) {
834 if (context_prev.is_set ==
false) {
838 context_prev.is_set =
true;
851 if (context_prev.is_set) {
884 if (tref->space_type == area->
spacetype) {
885 if (tref->mode == mode) {
891 return !(is_tool_set_prev && (tref_prev == area->
runtime.
tool));
899 space_type_has_tools[tref->space_type] =
true;
905 area->runtime.tool =
nullptr;
906 area->runtime.is_tool_set =
true;
907 if (space_type_has_tools[area->spacetype]) {
941 if (mode == tref->
mode) {
942 area->runtime.tool = tref;
943 area->
runtime.is_tool_set =
true;
1016 if (
ot ==
nullptr) {
1058 const char *idname_pending)
1063 const bool this_match =
STREQ(idname_pending, tref->
idname);
1088 if (area->runtime.tool == tref) {
1089 area->runtime.tool =
nullptr;
1090 area->runtime.is_tool_set =
false;
1115 switch (tkey->
mode) {
1129 return "builtin.brush";
1131 return "builtin_brush.Comb";
1133 return "builtin.select_text";
1137 switch (tkey->
mode) {
1139 return "builtin.brush";
1141 return "builtin.sample";
1143 return "builtin.select_box";
1147 return "builtin.select_box";
1150 return "builtin.select_box";
1154 return "builtin.select_box";
1163 const char *default_tool)
1167 if (default_tool ==
nullptr) {
1203 if (win != win_prev) {
1205 if (workspace_iter != workspace) {
1250 if (win->
next !=
nullptr) {
1256 }
while ((win = win->
next));
1284 if (group ==
nullptr) {
1306 return (prop !=
nullptr);
1324 *dst_ptr = *src_ptr;
1325 if (dst_ptr->
data) {
1332 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)
std::optional< AssetWeakReference > BKE_paint_brush_type_default_reference(PaintMode paint_mode, std::optional< int > brush_type)
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)
bool BKE_paint_can_use_brush(const Paint *paint, const Brush *brush)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
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_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, 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_TOOL_GIZMO
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 AssetWeakReference * brush_asset_reference
ToolSystemBrushBindings tool_brush_bindings
PaintRuntimeHandle * runtime
struct ToolSettings * toolsettings
wmGizmoMapType_Params gzmap_params
eWM_GizmoFlagGroupTypeFlag flag
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, blender::wm::OpCallContext 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)