void sha_clearLocalData(ShmemArray *array, unsigned int elementNumber) { int i; if (elementNumber < array->elementCount) { if (array->elements[elementNumber].localData) { if (array->elements[elementNumber].localDataCleanupCallbacks != NULL) { for (i=wolist_count(array->elements[elementNumber].localDataCleanupCallbacks)-1; i>=0; i--) { sha_clearLocalDataCallback clear_func = (sha_clearLocalDataCallback) wolist_elementAt(array->elements[elementNumber].localDataCleanupCallbacks, i); if (clear_func) clear_func(array, elementNumber); wolist_removeAt(array->elements[elementNumber].localDataCleanupCallbacks, i); } wolist_dealloc(array->elements[elementNumber].localDataCleanupCallbacks); array->elements[elementNumber].localDataCleanupCallbacks = NULL; } sd_perform(array->elements[elementNumber].localData, sha_warnAboutLeftoverLocalData, 0); sd_free(array->elements[elementNumber].localData); array->elements[elementNumber].localData = NULL; } } }
void sh_css_refcount_clear(int32_t id, void (*clear_func)(hrt_vaddress ptr)) { struct sh_css_refcount_entry *entry; uint32_t i; uint32_t count = 0; assert_exit(clear_func != NULL); sh_css_dtrace(SH_DBG_TRACE, "sh_css_refcount_clear(%x)\n", id); for (i = 0; i < myrefcount.size; i++) { entry = &myrefcount.items[i]; if ((entry->data != mmgr_NULL) && (entry->id == id)) { sh_css_dtrace(SH_DBG_TRACE, "sh_css_refcount_clear:" " %x: 0x%x\n", id, entry->data); if (clear_func) { /* clear using provided function */ clear_func(entry->data); } else { sh_css_dtrace(SH_DBG_TRACE, "sh_css_refcount_clear: " "using mmgr_free: no clear_func\n"); mmgr_free(entry->data); } assert_exit(entry->count == 0); entry->data = mmgr_NULL; entry->count = 0; entry->id = 0; count++; } } sh_css_dtrace(SH_DBG_TRACE, "sh_css_refcount_clear(%x): cleared %d\n", id, count); }
/* Initialize the load sequence. */ void init_load () { clear_func(0); load_adr.pc_func = 0; load_adr.pc_addr = 0; load_str = FALSE; load_const = FALSE; }
/* operate on selected objects only if they aren't in weight-paint mode * (so that object-transform clearing won't be applied at same time as bone-clearing) */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) { /* run provided clearing function */ clear_func(ob); ED_autokeyframe_object(C, scene, ob, ks); /* tag for updates */ DAG_id_tag_update(&ob->id, OB_RECALC_OB); } }
void clear_buffer(void) { if(clear_func != NULL) clear_func(); if(buffer == NULL) return; overlapped = 0; memset(buffer, 0, BUFFER_SIZE); current_buffer = buffer; pointer = 0; }
/* generic exec for clear-transform operators */ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, void (*clear_func)(Object *), const char default_ksName[]) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks; /* sanity checks */ if (ELEM(NULL, clear_func, default_ksName)) { BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform func or Keying Set Name"); return OPERATOR_CANCELLED; } /* get KeyingSet to use */ ks = ANIM_get_keyingset_for_autokeying(scene, default_ksName); /* operate on selected objects only if they aren't in weight-paint mode * (so that object-transform clearing won't be applied at same time as bone-clearing) */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) { /* run provided clearing function */ clear_func(ob); ED_autokeyframe_object(C, scene, ob, ks); /* tag for updates */ DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; /* this is needed so children are also updated */ DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; }
void sh_css_refcount_clear(int32_t id, void (*clear_func)(hrt_vaddress ptr)) { struct sh_css_refcount_entry *entry; uint32_t i; uint32_t count = 0; sh_css_dtrace(SH_DBG_TRACE_PRIVATE, "sh_css_refcount_clear(%x)\n", id); for (i = 0; i < myrefcount.size; i++) { entry = &myrefcount.items[i]; if ((entry->data != mmgr_NULL) && (entry->id == id)) { sh_css_dtrace(SH_DBG_TRACE_PRIVATE, "sh_css_refcount_clear: %x: 0x%x refcnt %d\n", id, entry->data, entry->count); if (clear_func) { /* clear using provided function */ /* This function will update the entry */ /* administration (we should not do that) */ clear_func(entry->data); assert(entry->count == 0); } else { sh_css_dtrace(SH_DBG_TRACE_PRIVATE, "sh_css_refcount_clear: " "using default mmgr_free\n"); mmgr_free(entry->data); assert(entry->count == 0); entry->data = mmgr_NULL; entry->size = 0; entry->count = 0; entry->id = 0; } count++; } } sh_css_dtrace(SH_DBG_TRACE_PRIVATE, "sh_css_refcount_clear(%x): cleared %d\n", id, count); }
/* operate on selected objects only if they aren't in weight-paint mode * (so that object-transform clearing won't be applied at same time as bone-clearing) */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) { /* run provided clearing function */ clear_func(ob); /* auto keyframing */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { ListBase dsources = {NULL, NULL}; /* now insert the keyframe(s) using the Keying Set * 1) add datasource override for the Object * 2) insert keyframes * 3) free the extra info */ ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); BLI_freelistN(&dsources); } /* tag for updates */ ob->recalc |= OB_RECALC_OB; } }