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>2009-07-17 06:31:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-17 06:31:28 +0400
commit70f6255433fcb1f5551199ef7a285a9ab80a3318 (patch)
tree1471a4451ee14d5b29ed37e2dc86300b01180698 /source/blender/makesrna/intern/rna_ui.c
parentc6c853d88a9c5ff12b7a56e4bdaca1757f160997 (diff)
bpy rna
Calling rna functions with invalid keywords, too many keywords and too many args would fail silently - now raise an error with invalid keywords and a list of valid ones, raise an error when too many args are given. - calling rna functions would alloc a ParameterList each time, changed to use a stack variable (2 pointers and an int). - store the number of parameters ParameterList - python exception types were wrong in many cases, (using attribute error rather then type error) - fixes to small errors in python UI scripts.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui.c')
-rw-r--r--source/blender/makesrna/intern/rna_ui.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index b10ca6c5e83..217f1ea00a8 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -76,7 +76,7 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re
static int panel_poll(const bContext *C, PanelType *pt)
{
PointerRNA ptr;
- ParameterList *list;
+ ParameterList list;
FunctionRNA *func;
void *ret;
int visible;
@@ -84,14 +84,14 @@ static int panel_poll(const bContext *C, PanelType *pt)
RNA_pointer_create(NULL, pt->py_srna, NULL, &ptr); /* dummy */
func= RNA_struct_find_function(&ptr, "poll");
- list= RNA_parameter_list_create(&ptr, func);
- RNA_parameter_set_lookup(list, "context", &C);
- pt->py_call(&ptr, func, list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pt->py_call(&ptr, func, &list);
- RNA_parameter_get_lookup(list, "visible", &ret);
+ RNA_parameter_get_lookup(&list, "visible", &ret);
visible= *(int*)ret;
- RNA_parameter_list_free(list);
+ RNA_parameter_list_free(&list);
return visible;
}
@@ -99,33 +99,33 @@ static int panel_poll(const bContext *C, PanelType *pt)
static void panel_draw(const bContext *C, Panel *pnl)
{
PointerRNA ptr;
- ParameterList *list;
+ ParameterList list;
FunctionRNA *func;
RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->py_srna, pnl, &ptr);
func= RNA_struct_find_function(&ptr, "draw");
- list= RNA_parameter_list_create(&ptr, func);
- RNA_parameter_set_lookup(list, "context", &C);
- pnl->type->py_call(&ptr, func, list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pnl->type->py_call(&ptr, func, &list);
- RNA_parameter_list_free(list);
+ RNA_parameter_list_free(&list);
}
static void panel_draw_header(const bContext *C, Panel *pnl)
{
PointerRNA ptr;
- ParameterList *list;
+ ParameterList list;
FunctionRNA *func;
RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->py_srna, pnl, &ptr);
func= RNA_struct_find_function(&ptr, "draw_header");
- list= RNA_parameter_list_create(&ptr, func);
- RNA_parameter_set_lookup(list, "context", &C);
- pnl->type->py_call(&ptr, func, list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pnl->type->py_call(&ptr, func, &list);
- RNA_parameter_list_free(list);
+ RNA_parameter_list_free(&list);
}
static void rna_Panel_unregister(const bContext *C, StructRNA *type)
@@ -210,17 +210,17 @@ static StructRNA* rna_Panel_refine(struct PointerRNA *ptr)
static void header_draw(const bContext *C, Header *hdr)
{
PointerRNA htr;
- ParameterList *list;
+ ParameterList list;
FunctionRNA *func;
RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->py_srna, hdr, &htr);
func= RNA_struct_find_function(&htr, "draw");
- list= RNA_parameter_list_create(&htr, func);
- RNA_parameter_set_lookup(list, "context", &C);
- hdr->type->py_call(&htr, func, list);
+ RNA_parameter_list_create(&list, &htr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ hdr->type->py_call(&htr, func, &list);
- RNA_parameter_list_free(list);
+ RNA_parameter_list_free(&list);
}
static void rna_Header_unregister(const bContext *C, StructRNA *type)
@@ -301,7 +301,7 @@ static StructRNA* rna_Header_refine(struct PointerRNA *htr)
static int menu_poll(const bContext *C, MenuType *pt)
{
PointerRNA ptr;
- ParameterList *list;
+ ParameterList list;
FunctionRNA *func;
void *ret;
int visible;
@@ -309,14 +309,14 @@ static int menu_poll(const bContext *C, MenuType *pt)
RNA_pointer_create(NULL, pt->py_srna, NULL, &ptr); /* dummy */
func= RNA_struct_find_function(&ptr, "poll");
- list= RNA_parameter_list_create(&ptr, func);
- RNA_parameter_set_lookup(list, "context", &C);
- pt->py_call(&ptr, func, list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pt->py_call(&ptr, func, &list);
- RNA_parameter_get_lookup(list, "visible", &ret);
+ RNA_parameter_get_lookup(&list, "visible", &ret);
visible= *(int*)ret;
- RNA_parameter_list_free(list);
+ RNA_parameter_list_free(&list);
return visible;
}
@@ -324,17 +324,17 @@ static int menu_poll(const bContext *C, MenuType *pt)
static void menu_draw(const bContext *C, Menu *hdr)
{
PointerRNA mtr;
- ParameterList *list;
+ ParameterList list;
FunctionRNA *func;
RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->py_srna, hdr, &mtr);
func= RNA_struct_find_function(&mtr, "draw");
- list= RNA_parameter_list_create(&mtr, func);
- RNA_parameter_set_lookup(list, "context", &C);
- hdr->type->py_call(&mtr, func, list);
+ RNA_parameter_list_create(&list, &mtr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ hdr->type->py_call(&mtr, func, &list);
- RNA_parameter_list_free(list);
+ RNA_parameter_list_free(&list);
}
static void rna_Menu_unregister(const bContext *C, StructRNA *type)