Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-20 02:40:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-20 02:40:03 +0400
commit0e66576f02afebdb4016249a9d7013ee5c1f0c36 (patch)
tree2a4818e8f5a257f15a2815d7d580d5f9218577f1
parent617d3cb85237c5178b09fefedcd75313653b52ce (diff)
replace RNA function string lookups with direct assignments, currently the lookup returns the same pointer every time. some of these functions - panel/operator poll for eg, are called many times per redraw so while not a bottleneck its unnecessary.
-rw-r--r--source/blender/makesrna/intern/rna_animation.c12
-rw-r--r--source/blender/makesrna/intern/rna_render.c4
-rw-r--r--source/blender/makesrna/intern/rna_ui.c24
-rw-r--r--source/blender/makesrna/intern/rna_wm.c28
4 files changed, 51 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index ebf8990adf3..21e99d312d6 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -80,6 +80,8 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
/* 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;
@@ -87,7 +89,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
int ok;
RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
- func= RNA_struct_find_function(&ptr, "poll");
+ func= &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
RNA_parameter_list_create(&list, &ptr, func);
/* hook up arguments */
@@ -108,12 +110,14 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
/* 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_struct_find_function(&ptr, "iterator");
+ func= &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */
RNA_parameter_list_create(&list, &ptr, func);
/* hook up arguments */
@@ -129,12 +133,14 @@ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks
/* wrapper for generator callback */
static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, PointerRNA *data)
{
+ extern FunctionRNA rna_KeyingSetInfo_generate_func;
+
PointerRNA ptr;
ParameterList list;
FunctionRNA *func;
RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
- func= RNA_struct_find_function(&ptr, "generate");
+ func= &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */
RNA_parameter_list_create(&list, &ptr, func);
/* hook up arguments */
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index f5fab9d2f33..a2e68668856 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -88,12 +88,14 @@ void RE_engines_exit(void)
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_struct_find_function(&ptr, "render");
+ func= &rna_RenderEngine_render_func; /* RNA_struct_find_function(&ptr, "render"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "scene", &scene);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 2c2bc4704bf..2a62a39ef33 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -95,6 +95,8 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re
static int panel_poll(const bContext *C, PanelType *pt)
{
+ extern FunctionRNA rna_Panel_poll_func;
+
PointerRNA ptr;
ParameterList list;
FunctionRNA *func;
@@ -102,7 +104,7 @@ static int panel_poll(const bContext *C, PanelType *pt)
int visible;
RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
- func= RNA_struct_find_function(&ptr, "poll");
+ func= &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -118,12 +120,14 @@ static int panel_poll(const bContext *C, PanelType *pt)
static void panel_draw(const bContext *C, Panel *pnl)
{
+ extern FunctionRNA rna_Panel_draw_func;
+
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");
+ func= &rna_Panel_draw_func;/* RNA_struct_find_function(&ptr, "draw"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -134,12 +138,14 @@ static void panel_draw(const bContext *C, Panel *pnl)
static void panel_draw_header(const bContext *C, Panel *pnl)
{
+ extern FunctionRNA rna_Panel_draw_header_func;
+
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");
+ func= &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -249,12 +255,14 @@ static StructRNA* rna_Panel_refine(PointerRNA *ptr)
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_struct_find_function(&htr, "draw");
+ 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);
@@ -347,6 +355,8 @@ static StructRNA* rna_Header_refine(PointerRNA *htr)
static int menu_poll(const bContext *C, MenuType *pt)
{
+ extern FunctionRNA rna_Menu_poll_func;
+
PointerRNA ptr;
ParameterList list;
FunctionRNA *func;
@@ -354,7 +364,7 @@ static int menu_poll(const bContext *C, MenuType *pt)
int visible;
RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
- func= RNA_struct_find_function(&ptr, "poll");
+ 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);
@@ -370,12 +380,14 @@ static int menu_poll(const bContext *C, MenuType *pt)
static void menu_draw(const bContext *C, Menu *hdr)
{
+ extern FunctionRNA rna_Menu_draw_func;
+
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");
+ 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);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index e9df79acd4a..f8383b1d451 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -762,6 +762,8 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
static int operator_poll(bContext *C, wmOperatorType *ot)
{
+ extern FunctionRNA rna_Operator_poll_func;
+
PointerRNA ptr;
ParameterList list;
FunctionRNA *func;
@@ -769,7 +771,7 @@ static int operator_poll(bContext *C, wmOperatorType *ot)
int visible;
RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
- func= RNA_struct_find_function(&ptr, "poll");
+ func= &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -785,6 +787,8 @@ static int operator_poll(bContext *C, wmOperatorType *ot)
static int operator_execute(bContext *C, wmOperator *op)
{
+ extern FunctionRNA rna_Operator_execute_func;
+
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
@@ -792,7 +796,7 @@ static int operator_execute(bContext *C, wmOperator *op)
int result;
RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr);
- func= RNA_struct_find_function(&opr, "execute");
+ func= &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
RNA_parameter_list_create(&list, &opr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -809,6 +813,8 @@ static int operator_execute(bContext *C, wmOperator *op)
/* same as execute() but no return value */
static int operator_check(bContext *C, wmOperator *op)
{
+ extern FunctionRNA rna_Operator_check_func;
+
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
@@ -816,7 +822,7 @@ static int operator_check(bContext *C, wmOperator *op)
int result;
RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr);
- func= RNA_struct_find_function(&opr, "check");
+ func= &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
RNA_parameter_list_create(&list, &opr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -832,6 +838,8 @@ static int operator_check(bContext *C, wmOperator *op)
static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
+ extern FunctionRNA rna_Operator_invoke_func;
+
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
@@ -839,7 +847,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event)
int result;
RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr);
- func= RNA_struct_find_function(&opr, "invoke");
+ func= &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
RNA_parameter_list_create(&list, &opr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -857,6 +865,8 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* same as invoke */
static int operator_modal(bContext *C, wmOperator *op, wmEvent *event)
{
+ extern FunctionRNA rna_Operator_modal_func;
+
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
@@ -864,7 +874,7 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event)
int result;
RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr);
- func= RNA_struct_find_function(&opr, "modal");
+ func= &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
RNA_parameter_list_create(&list, &opr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -881,12 +891,14 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event)
static void operator_draw(bContext *C, wmOperator *op)
{
+ extern FunctionRNA rna_Operator_draw_func;
+
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr);
- func= RNA_struct_find_function(&opr, "draw");
+ func= &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
RNA_parameter_list_create(&list, &opr, func);
RNA_parameter_set_lookup(&list, "context", &C);
@@ -898,6 +910,8 @@ static void operator_draw(bContext *C, wmOperator *op)
/* same as exec(), but call cancel */
static int operator_cancel(bContext *C, wmOperator *op)
{
+ extern FunctionRNA rna_Operator_cancel_func;
+
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
@@ -905,7 +919,7 @@ static int operator_cancel(bContext *C, wmOperator *op)
int result;
RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr);
- func= RNA_struct_find_function(&opr, "cancel");
+ func= &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
RNA_parameter_list_create(&list, &opr, func);
RNA_parameter_set_lookup(&list, "context", &C);