static void uilist_draw_item(uiList *ui_list, bContext *C, uiLayout *layout, PointerRNA *dataptr, PointerRNA *itemptr, int icon, PointerRNA *active_dataptr, const char *active_propname, int index, int flt_flag) { extern FunctionRNA rna_UIList_draw_item_func; PointerRNA ul_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr); func = &rna_UIList_draw_item_func; /* RNA_struct_find_function(&ul_ptr, "draw_item"); */ RNA_parameter_list_create(&list, &ul_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "layout", &layout); RNA_parameter_set_lookup(&list, "data", dataptr); RNA_parameter_set_lookup(&list, "item", itemptr); RNA_parameter_set_lookup(&list, "icon", &icon); RNA_parameter_set_lookup(&list, "active_data", active_dataptr); RNA_parameter_set_lookup(&list, "active_property", &active_propname); RNA_parameter_set_lookup(&list, "index", &index); RNA_parameter_set_lookup(&list, "flt_flag", &flt_flag); ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list); RNA_parameter_list_free(&list); }
static void engine_bake(RenderEngine *engine, struct Scene *scene, struct Object *object, const int pass_type, const int pass_filter, const int object_id, const struct BakePixel *pixel_array, const int num_pixels, const int depth, void *result) { extern FunctionRNA rna_RenderEngine_bake_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); func = &rna_RenderEngine_bake_func; RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "scene", &scene); RNA_parameter_set_lookup(&list, "object", &object); RNA_parameter_set_lookup(&list, "pass_type", &pass_type); RNA_parameter_set_lookup(&list, "pass_filter", &pass_filter); RNA_parameter_set_lookup(&list, "object_id", &object_id); RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array); RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels); RNA_parameter_set_lookup(&list, "depth", &depth); RNA_parameter_set_lookup(&list, "result", &result); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); }
/* wrapper for poll callback */ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) { extern FunctionRNA rna_KeyingSetInfo_poll_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; void *ret; int ok; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); func = &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); { /* hook up arguments */ RNA_parameter_set_lookup(&list, "ksi", &ksi); RNA_parameter_set_lookup(&list, "context", &C); /* execute the function */ ksi->ext.call(C, &ptr, func, &list); /* read the result */ RNA_parameter_get_lookup(&list, "ok", &ret); ok = *(int *)ret; } RNA_parameter_list_free(&list); return ok; }
static void menu_draw(const bContext *C, Menu *hdr) { PointerRNA mtr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr); func= RNA_struct_find_function(&mtr, "draw"); RNA_parameter_list_create(&list, &mtr, func); RNA_parameter_set_lookup(&list, "context", &C); hdr->type->ext.call((bContext *)C, &mtr, func, &list); RNA_parameter_list_free(&list); }
static void panel_draw_header(const bContext *C, Panel *pnl) { PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); func= RNA_struct_find_function(&ptr, "draw_header"); RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); pnl->type->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_list_free(&list); }
static void engine_view_update(RenderEngine *engine, const struct bContext *context) { extern FunctionRNA rna_RenderEngine_view_update_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); func= &rna_RenderEngine_view_update_func; RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &context); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); }
static void engine_render(RenderEngine *engine, struct Scene *scene) { extern FunctionRNA rna_RenderEngine_render_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); func= &rna_RenderEngine_render_func; RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "scene", &scene); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); }
static void menu_draw(const bContext *C, Menu *menu) { extern FunctionRNA rna_Menu_draw_func; PointerRNA mtr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, menu->type->ext.srna, menu, &mtr); func = &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */ RNA_parameter_list_create(&list, &mtr, func); RNA_parameter_set_lookup(&list, "context", &C); menu->type->ext.call((bContext *)C, &mtr, func, &list); RNA_parameter_list_free(&list); }
static void header_draw(const bContext *C, Header *hdr) { extern FunctionRNA rna_Header_draw_func; PointerRNA htr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr); func = &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */ RNA_parameter_list_create(&list, &htr, func); RNA_parameter_set_lookup(&list, "context", &C); hdr->type->ext.call((bContext *)C, &htr, func, &list); RNA_parameter_list_free(&list); }
static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node) { extern FunctionRNA rna_RenderEngine_update_script_node_func; PointerRNA ptr, nodeptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); RNA_pointer_create((ID *)ntree, &RNA_Node, node, &nodeptr); func = &rna_RenderEngine_update_script_node_func; RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "node", &nodeptr); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); }
static void uilist_draw_filter(uiList *ui_list, bContext *C, uiLayout *layout) { extern FunctionRNA rna_UIList_draw_filter_func; PointerRNA ul_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr); func = &rna_UIList_draw_filter_func; /* RNA_struct_find_function(&ul_ptr, "draw_filter"); */ RNA_parameter_list_create(&list, &ul_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "layout", &layout); ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list); RNA_parameter_list_free(&list); }
/* wrapper for iterator callback */ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks) { extern FunctionRNA rna_KeyingSetInfo_iterator_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); func = &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ RNA_parameter_set_lookup(&list, "ksi", &ksi); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "ks", &ks); /* execute the function */ ksi->ext.call(C, &ptr, func, &list); RNA_parameter_list_free(&list); }
static int panel_poll(const bContext *C, PanelType *pt) { PointerRNA ptr; ParameterList list; FunctionRNA *func; void *ret; int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ func= RNA_struct_find_function(&ptr, "poll"); RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); pt->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); visible= *(int*)ret; RNA_parameter_list_free(&list); return visible; }
static bool menu_poll(const bContext *C, MenuType *pt) { extern FunctionRNA rna_Menu_poll_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; void *ret; bool visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ func = &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); pt->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); visible = *(bool *)ret; RNA_parameter_list_free(&list); return visible; }
static void uilist_filter_items(uiList *ui_list, bContext *C, PointerRNA *dataptr, const char *propname) { extern FunctionRNA rna_UIList_filter_items_func; PointerRNA ul_ptr; ParameterList list; FunctionRNA *func; PropertyRNA *parm; uiListDyn *flt_data = ui_list->dyn_data; int *filter_flags, *filter_neworder; void *ret1, *ret2; int ret_len; int len = flt_data->items_len = RNA_collection_length(dataptr, propname); RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr); func = &rna_UIList_filter_items_func; /* RNA_struct_find_function(&ul_ptr, "filter_items"); */ RNA_parameter_list_create(&list, &ul_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "data", dataptr); RNA_parameter_set_lookup(&list, "property", &propname); ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list); parm = RNA_function_find_parameter(NULL, func, "filter_flags"); ret_len = RNA_parameter_dynamic_length_get(&list, parm); if (ret_len != len && ret_len != 0) { printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n", __func__, RNA_parameter_dynamic_length_get(&list, parm), "filter_flags", len); /* Note: we cannot return here, we would let flt_data in inconsistent state... see T38356. */ filter_flags = NULL; } else { RNA_parameter_get(&list, parm, &ret1); filter_flags = (int *)ret1; } parm = RNA_function_find_parameter(NULL, func, "filter_neworder"); ret_len = RNA_parameter_dynamic_length_get(&list, parm); if (ret_len != len && ret_len != 0) { printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n", __func__, RNA_parameter_dynamic_length_get(&list, parm), "filter_neworder", len); /* Note: we cannot return here, we would let flt_data in inconsistent state... see T38356. */ filter_neworder = NULL; } else { RNA_parameter_get(&list, parm, &ret2); filter_neworder = (int *)ret2; } /* We have to do some final checks and transforms... */ { int i, filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE; if (filter_flags) { flt_data->items_filter_flags = MEM_mallocN(sizeof(int) * len, __func__); memcpy(flt_data->items_filter_flags, filter_flags, sizeof(int) * len); if (filter_neworder) { /* For sake of simplicity, py filtering is expected to filter all items, but we actually only want * reordering data for shown items! */ int items_shown, shown_idx; int t_idx, t_ni, prev_ni; flt_data->items_shown = 0; for (i = 0, shown_idx = 0; i < len; i++) { if ((filter_flags[i] & UILST_FLT_ITEM) ^ filter_exclude) { filter_neworder[shown_idx++] = filter_neworder[i]; } } items_shown = flt_data->items_shown = shown_idx; flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * items_shown, __func__); /* And now, bring back new indices into the [0, items_shown[ range! * XXX This is O(N²)... :/ */ for (shown_idx = 0, prev_ni = -1; shown_idx < items_shown; shown_idx++) { for (i = 0, t_ni = len, t_idx = -1; i < items_shown; i++) { int ni = filter_neworder[i]; if (ni > prev_ni && ni < t_ni) { t_idx = i; t_ni = ni; } } if (t_idx >= 0) { prev_ni = t_ni; flt_data->items_filter_neworder[t_idx] = shown_idx; } } } else { /* we still have to set flt_data->items_shown... */ flt_data->items_shown = 0; for (i = 0; i < len; i++) { if ((filter_flags[i] & UILST_FLT_ITEM) ^ filter_exclude) { flt_data->items_shown++; } } } } else { flt_data->items_shown = len; if (filter_neworder) { flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * len, __func__); memcpy(flt_data->items_filter_neworder, filter_neworder, sizeof(int) * len); } } } RNA_parameter_list_free(&list); }