Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | BLI_INLINE uint void_hash_uint(const void *key) | ||||
| size_t y = (size_t)key >> (sizeof(void *)); | size_t y = (size_t)key >> (sizeof(void *)); | ||||
| return (unsigned int)y; | return (unsigned int)y; | ||||
| } | } | ||||
| static uint wm_msg_rna_gset_hash(const void *key_p) | static uint wm_msg_rna_gset_hash(const void *key_p) | ||||
| { | { | ||||
| const wmMsgSubscribeKey_RNA *key = key_p; | const wmMsgSubscribeKey_RNA *key = key_p; | ||||
| const wmMsgParams_RNA *params = &key->msg.params; | const wmMsgParams_RNA *params = &key->msg.params; | ||||
| // printf("%s\n", RNA_struct_identifier(params->ptr.type)); | // CLOG_VERBOSE(WM_LOG_MSGBUS_HANDLE, 4, "RNA struct identifier=%s", | ||||
| // RNA_struct_identifier(params->ptr.type)); | |||||
| uint k = void_hash_uint(params->ptr.type); | uint k = void_hash_uint(params->ptr.type); | ||||
| k ^= void_hash_uint(params->ptr.data); | k ^= void_hash_uint(params->ptr.data); | ||||
| k ^= void_hash_uint(params->ptr.owner_id); | k ^= void_hash_uint(params->ptr.owner_id); | ||||
| k ^= void_hash_uint(params->prop); | k ^= void_hash_uint(params->prop); | ||||
| return k; | return k; | ||||
| } | } | ||||
| static bool wm_msg_rna_gset_cmp(const void *key_a_p, const void *key_b_p) | static bool wm_msg_rna_gset_cmp(const void *key_a_p, const void *key_b_p) | ||||
| { | { | ||||
| Show All 13 Lines | for (wmMsgSubscribeValueLink *msg_lnk = key->head.values.first; msg_lnk; | ||||
| wm_msg_subscribe_value_free(&key->head, msg_lnk); | wm_msg_subscribe_value_free(&key->head, msg_lnk); | ||||
| } | } | ||||
| if (key->msg.params.data_path != NULL) { | if (key->msg.params.data_path != NULL) { | ||||
| MEM_freeN(key->msg.params.data_path); | MEM_freeN(key->msg.params.data_path); | ||||
| } | } | ||||
| MEM_freeN(key); | MEM_freeN(key); | ||||
| } | } | ||||
| static void wm_msg_rna_repr(FILE *stream, const wmMsgSubscribeKey *msg_key) | static char *wm_msg_rna_repr(const wmMsgSubscribeKey *msg_key) | ||||
| { | { | ||||
| DynStr *repr = BLI_dynstr_new(); | |||||
| const wmMsgSubscribeKey_RNA *m = (wmMsgSubscribeKey_RNA *)msg_key; | const wmMsgSubscribeKey_RNA *m = (wmMsgSubscribeKey_RNA *)msg_key; | ||||
| const char *none = "<none>"; | const char *none = "<none>"; | ||||
| fprintf(stream, | BLI_dynstr_appendf( | ||||
| repr, | |||||
| "<wmMsg_RNA %p, " | "<wmMsg_RNA %p, " | ||||
| "id='%s', " | "id='%s', " | ||||
| "%s.%s values_len=%d\n", | "%s.%s values_len=%d\n", | ||||
| m, | m, | ||||
| m->msg.head.id, | m->msg.head.id, | ||||
| m->msg.params.ptr.type ? RNA_struct_identifier(m->msg.params.ptr.type) : none, | m->msg.params.ptr.type ? RNA_struct_identifier(m->msg.params.ptr.type) : none, | ||||
| m->msg.params.prop ? RNA_property_identifier((PropertyRNA *)m->msg.params.prop) : none, | m->msg.params.prop ? RNA_property_identifier((PropertyRNA *)m->msg.params.prop) : none, | ||||
| BLI_listbase_count(&m->head.values)); | BLI_listbase_count(&m->head.values)); | ||||
| char *cstring = BLI_dynstr_get_cstring(repr); | |||||
| BLI_dynstr_free(repr); | |||||
| return cstring; | |||||
| } | } | ||||
| static void wm_msg_rna_update_by_id(struct wmMsgBus *mbus, ID *id_src, ID *id_dst) | static void wm_msg_rna_update_by_id(struct wmMsgBus *mbus, ID *id_src, ID *id_dst) | ||||
| { | { | ||||
| GSet *gs = mbus->messages_gset[WM_MSG_TYPE_RNA]; | GSet *gs = mbus->messages_gset[WM_MSG_TYPE_RNA]; | ||||
| GSetIterator gs_iter; | GSetIterator gs_iter; | ||||
| BLI_gsetIterator_init(&gs_iter, gs); | BLI_gsetIterator_init(&gs_iter, gs); | ||||
| while (BLI_gsetIterator_done(&gs_iter) == false) { | while (BLI_gsetIterator_done(&gs_iter) == false) { | ||||
| ▲ Show 20 Lines • Show All 254 Lines • Show Last 20 Lines | |||||