Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_templates.c
| Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_interface_icons.h" | #include "UI_interface_icons.h" | ||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| #include "PIL_time.h" | #include "PIL_time.h" | ||||
| #define USE_OP_BASIC_PROP_BUTS_TEST | |||||
| // #define USE_OP_RESET_BUT // we may want to make this optional, disable for now. | // #define USE_OP_RESET_BUT // we may want to make this optional, disable for now. | ||||
| /* defines for templateID/TemplateSearch */ | /* defines for templateID/TemplateSearch */ | ||||
| #define TEMPLATE_SEARCH_TEXTBUT_WIDTH (UI_UNIT_X * 6) | #define TEMPLATE_SEARCH_TEXTBUT_WIDTH (UI_UNIT_X * 6) | ||||
| #define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y | #define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y | ||||
| void UI_template_fix_linking(void) | void UI_template_fix_linking(void) | ||||
| ▲ Show 20 Lines • Show All 3,610 Lines • ▼ Show 20 Lines | if (op->type->ui) { | ||||
| op->layout = layout; | op->layout = layout; | ||||
| op->type->ui((bContext *)C, op); | op->type->ui((bContext *)C, op); | ||||
| op->layout = NULL; | op->layout = NULL; | ||||
| /* UI_LAYOUT_OP_SHOW_EMPTY ignored */ | /* UI_LAYOUT_OP_SHOW_EMPTY ignored */ | ||||
| } | } | ||||
| else { | else { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| const char *name; | |||||
| PointerRNA ptr; | PointerRNA ptr; | ||||
| int empty; | int empty; | ||||
| RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); | RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); | ||||
| /* main draw call */ | /* main draw call */ | ||||
| #ifdef USE_OP_BASIC_PROP_BUTS_TEST | |||||
| RNA_STRUCT_BEGIN(&ptr, prop) | |||||
| { | |||||
| if (RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED) { | |||||
| continue; | |||||
| } | |||||
| if (RNA_property_flag(prop) & PROP_HIDDEN || (check_prop && check_prop(&ptr, prop) == 0)) { | |||||
| continue; | |||||
| } | |||||
| name = RNA_property_ui_name(prop); | |||||
| uiItemFullR(layout, &ptr, prop, -1, 0, 0, name, ICON_NONE); | |||||
| empty = false; | |||||
| } | |||||
| RNA_STRUCT_END; | |||||
| UNUSED_VARS(label_align); /* Ignore for testing */ | |||||
mont29: Think this could be done much simpler/nicer by defining our own `check_prop`… if we could find… | |||||
SeverinAuthorUnsubmitted Not Done Inline ActionsFor the top-bar that shouldn't be an issue. What I did there was wrapping this function (uiTemplateOperatorPropertyButs) into one that also considers op-macros, adds the "More..." button, etc. So we can totally pass a custom check_prop to filter out advanced props. Severin: For the top-bar that shouldn't be an issue. What I did there was wrapping this function… | |||||
| #else | |||||
| empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0; | empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0; | ||||
| #endif | |||||
| if (empty && (flag & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) { | if (empty && (flag & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) { | ||||
| uiItemL(layout, IFACE_("No Properties"), ICON_NONE); | uiItemL(layout, IFACE_("No Properties"), ICON_NONE); | ||||
| } | } | ||||
| } | } | ||||
| #ifdef USE_OP_RESET_BUT | #ifdef USE_OP_RESET_BUT | ||||
| /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled | /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled | ||||
| ▲ Show 20 Lines • Show All 647 Lines • Show Last 20 Lines | |||||
Think this could be done much simpler/nicer by defining our own check_prop… if we could find a way to pass original check_prop to new one…
Nothing mandatory/blocking, more like a nice TODO to make things cleaner.