[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56477] trunk/blender/source/blender: adjustment to own commit r56463.
Campbell Barton
ideasman42 at gmail.com
Thu May 2 23:27:20 CEST 2013
Revision: 56477
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56477
Author: campbellbarton
Date: 2013-05-02 21:27:19 +0000 (Thu, 02 May 2013)
Log Message:
-----------
adjustment to own commit r56463.
when strings use 'PROP_NEVER_NULL' we still want them to show an unlink button.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56463
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface_layout.c
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/makesrna/RNA_access.h
trunk/blender/source/blender/makesrna/intern/rna_access.c
Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c 2013-05-02 19:51:32 UTC (rev 56476)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c 2013-05-02 21:27:19 UTC (rev 56477)
@@ -1411,11 +1411,7 @@
/* turn button into search button */
if (searchprop) {
- if (RNA_property_flag(prop) & (PROP_NEVER_UNLINK | PROP_NEVER_NULL))
- but->type = SEARCH_MENU;
- else
- but->type = SEARCH_MENU_UNLINK;
-
+ but->type = RNA_property_is_unlink(prop) ? SEARCH_MENU_UNLINK : SEARCH_MENU;
but->hardmax = MAX2(but->hardmax, 256.0f);
but->rnasearchpoin = *searchptr;
but->rnasearchprop = searchprop;
Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c 2013-05-02 19:51:32 UTC (rev 56476)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c 2013-05-02 21:27:19 UTC (rev 56477)
@@ -577,9 +577,7 @@
}
/* delete button */
- if (id && (flag & UI_ID_DELETE) &&
- (RNA_property_flag(template->prop) & (PROP_NEVER_UNLINK | PROP_NEVER_NULL)) == 0)
- {
+ if (id && (flag & UI_ID_DELETE) && RNA_property_is_unlink(template->prop)) {
if (unlinkop) {
but = uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* so we can access the template from operators, font unlinking needs this */
Modified: trunk/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_access.h 2013-05-02 19:51:32 UTC (rev 56476)
+++ trunk/blender/source/blender/makesrna/RNA_access.h 2013-05-02 21:27:19 UTC (rev 56477)
@@ -1026,6 +1026,7 @@
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost);
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier);
bool RNA_property_is_idprop(PropertyRNA *prop);
+bool RNA_property_is_unlink(PropertyRNA *prop);
void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier);
/* python compatible string representation of this property, (must be freed!) */
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2013-05-02 19:51:32 UTC (rev 56476)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2013-05-02 21:27:19 UTC (rev 56477)
@@ -4924,6 +4924,18 @@
return (prop->magic != RNA_MAGIC);
}
+/* mainly for the UI */
+bool RNA_property_is_unlink(PropertyRNA *prop)
+{
+ const int flag = RNA_property_flag(prop);
+ if (RNA_property_type(prop) == PROP_STRING) {
+ return (flag & PROP_NEVER_UNLINK) == 0;
+ }
+ else {
+ return (flag & (PROP_NEVER_UNLINK | PROP_NEVER_NULL)) == 0;
+ }
+}
+
/* string representation of a property, python
* compatible but can be used for display too,
* context may be NULL */
More information about the Bf-blender-cvs
mailing list