diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-04 16:18:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-04 16:18:07 +0400 |
commit | 1f77f7b05af24d3117d76d8c2ec43dbee031ab6a (patch) | |
tree | c3262b326313bb4c1cdf0dc6894204e4eaf3bdd9 /source/blender/editors/interface/interface_templates.c | |
parent | 2f8f86e4f6afe8ecdff5c57bdbcc1c0d9b18301e (diff) |
Brush/Paint internal changes
- remove brush array for each Paint struct, just use a single brush pointer.
- removed rna function based template filtering.
- filter brushes using a flag on the brush and the pointer poll function.
- set the brushes using a new operator WM_OT_context_set_id().
TODO
- remake startup.blend, currently brush groupings are lost.
- rewrite WM_OT_context_set_id() to use rna introspection.
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 65 |
1 files changed, 10 insertions, 55 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index ec57c813e20..e2c033bd68d 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -142,8 +142,6 @@ typedef struct TemplateID { ListBase *idlb; int prv_rows, prv_cols; - - char filterop[64]; } TemplateID; /* Search browse menu, assign */ @@ -173,9 +171,6 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea /* ID listbase */ for(id= lb->first; id; id= id->next) { if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) { - int filter_yes; - - filter_yes= 0; /* use filter */ if(RNA_property_type(template->prop)==PROP_POINTER) { @@ -185,43 +180,8 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea continue; } - if (template->filterop[0] != 0) { - /* XXX, remove this, use pointer filtering */ - PointerRNA ptr; - ReportList reports; - FunctionRNA *func; - ParameterList parms; - - RNA_id_pointer_create(id, &ptr); - - BKE_reports_init(&reports, RPT_PRINT); - - func= RNA_struct_find_function(&ptr, template->filterop); - - if (func) { - RNA_parameter_list_create(&parms, &ptr, func); - - RNA_parameter_set_lookup(&parms, "context", &C); - - if (RNA_function_call((bContext *)C, &reports, &ptr, func, &parms) == 0) { - int* ret; - RNA_parameter_get_lookup(&parms, "ret", (void **)&ret); - - if (!(*ret)) { - RNA_parameter_list_free(&parms); - continue; - } - else { - filter_yes= 1; - } - } - - RNA_parameter_list_free(&parms); - } - } - /* hide dot-datablocks, but only if filter does not force it visible */ - if(!filter_yes && U.uiflag & USER_HIDE_DOT) + if(U.uiflag & USER_HIDE_DOT) if ((id->name[2]=='.') && (str[0] != '.')) continue; @@ -392,7 +352,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } } -static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop, char *filterop) +static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop) { uiBut *but; uiBlock *block; @@ -536,7 +496,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiBlockEndAlign(block); } -static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char* filterop, int flag, int prv_rows, int prv_cols) +static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int flag, int prv_rows, int prv_cols) { TemplateID *template; PropertyRNA *prop; @@ -555,11 +515,6 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char template->prv_rows = prv_rows; template->prv_cols = prv_cols; - if (filterop) - BLI_strncpy(template->filterop, filterop, sizeof(template->filterop)); - else - template->filterop[0] = 0; - if(newop) flag |= UI_ID_ADD_NEW; if(openop) @@ -573,25 +528,25 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char */ if(template->idlb) { uiLayoutRow(layout, 1); - template_ID(C, layout, template, type, flag, newop, openop, unlinkop, filterop); + template_ID(C, layout, template, type, flag, newop, openop, unlinkop); } MEM_freeN(template); } -void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop) +void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop) { - ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0); + ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0); } -void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop) +void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop) { - ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0); + ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0); } -void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop, int rows, int cols) +void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols) { - ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols); + ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols); } /************************ ID Chooser Template ***************************/ |