Differential D2917 Diff 9555 source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
| Show All 32 Lines | |||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "WM_message.h" | |||||
| #include "wm.h" | #include "wm.h" | ||||
| /* own includes */ | /* own includes */ | ||||
| #include "wm_manipulator_wmapi.h" | #include "wm_manipulator_wmapi.h" | ||||
| #include "wm_manipulator_intern.h" | #include "wm_manipulator_intern.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | void WM_manipulatortype_target_property_def( | ||||
| mpt->data_type = data_type; | mpt->data_type = data_type; | ||||
| mpt->array_length = array_length; | mpt->array_length = array_length; | ||||
| mpt->index_in_type = wt->target_property_defs_len; | mpt->index_in_type = wt->target_property_defs_len; | ||||
| wt->target_property_defs_len += 1; | wt->target_property_defs_len += 1; | ||||
| BLI_addtail(&wt->target_property_defs, mpt); | BLI_addtail(&wt->target_property_defs, mpt); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Property Utilities | |||||
| * \{ */ | |||||
| static void wm_manipulator_do_msg_notify_tag_refresh( | |||||
| bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) | |||||
| { | |||||
| wmManipulatorMap *mmap = msg_val->user_data; | |||||
| WM_manipulatormap_tag_refresh(mmap); | |||||
| } | |||||
| /** | |||||
| * Runs on the "prepare draw" pass, | |||||
| * drawing the region clears. | |||||
| */ | |||||
| void WM_manipulator_target_property_subscribe_all( | |||||
| const bContext *C, wmManipulator *mpr) | |||||
| { | |||||
| if (mpr->type->target_property_defs_len) { | |||||
| ARegion *ar = CTX_wm_region(C); | |||||
| struct wmMsgBus *mbus = CTX_wm_message_bus(C); | |||||
| wmManipulatorProperty *mpr_prop_array = WM_manipulator_target_property_array(mpr); | |||||
| for (int i = 0; i < mpr->type->target_property_defs_len; i++) { | |||||
| wmManipulatorProperty *mpr_prop = &mpr_prop_array[i]; | |||||
| if (WM_manipulator_target_property_is_valid(mpr_prop)) { | |||||
| if (mpr_prop->prop) { | |||||
| WM_msg_subscribe_rna( | |||||
| mbus, &mpr_prop->ptr, mpr_prop->prop, | |||||
| &(const wmMsgSubscribeValue){ | |||||
| .owner = ar, | |||||
| .user_data = ar, | |||||
| .notify = ED_region_do_msg_notify_tag_redraw, | |||||
| }); | |||||
| WM_msg_subscribe_rna( | |||||
| mbus, &mpr_prop->ptr, mpr_prop->prop, | |||||
| &(const wmMsgSubscribeValue){ | |||||
| .owner = ar, | |||||
| .user_data = mpr->parent_mgroup->parent_mmap, | |||||
| .notify = wm_manipulator_do_msg_notify_tag_refresh, | |||||
| }); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /** \} */ | |||||