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:
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r--source/blender/editors/interface/interface_templates.c73
1 files changed, 13 insertions, 60 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 773e9ddc2d4..169ef4e7675 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -30,18 +30,15 @@
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
-#include "DNA_windowmanager_types.h"
#include "BLI_string.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_icons.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
#include "BKE_report.h"
#include "ED_screen.h"
@@ -144,8 +141,6 @@ typedef struct TemplateID {
ListBase *idlb;
int prv_rows, prv_cols;
-
- char filterop[64];
} TemplateID;
/* Search browse menu, assign */
@@ -175,47 +170,17 @@ 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 (template->filterop[0] != 0) {
+ if(RNA_property_type(template->prop)==PROP_POINTER) {
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);
- }
+ if(RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
+ continue;
}
/* 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;
@@ -386,7 +351,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;
@@ -530,7 +495,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;
@@ -549,11 +514,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)
@@ -567,25 +527,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 ***************************/
@@ -670,12 +630,8 @@ void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char
#include "DNA_object_force.h"
#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
#include "BKE_modifier.h"
-#include "BKE_object.h"
#include "BKE_particle.h"
-#include "BKE_report.h"
#include "ED_util.h"
@@ -1189,7 +1145,6 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr, int compact)
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#define B_MATPRV 1
@@ -1289,7 +1244,6 @@ void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent, MTex *slot)
/********************** ColorRamp Template **************************/
-#include "BKE_texture.h"
typedef struct RNAUpdateCb {
PointerRNA ptr;
@@ -1585,7 +1539,6 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, in
/********************* CurveMapping Template ************************/
-#include "BKE_colortools.h"
static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
{