/* 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 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; }