[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29931] branches/soc-2010-jwilkins: * The filter function submitted to template_ID can override dot prefix hiding of names by returning true for such a name .
Jason Wilkins
Jason.A.Wilkins at gmail.com
Sun Jul 4 15:17:19 CEST 2010
Revision: 29931
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29931
Author: jwilkins
Date: 2010-07-04 15:17:19 +0200 (Sun, 04 Jul 2010)
Log Message:
-----------
* The filter function submitted to template_ID can override dot prefix hiding of names by returning true for such a name. This will be used to allow hiding of image icons in other menus while still showing them in the brush icon roll out.
* I have everything set up to only show names that begin with .imageicon., however I have not hooked it up in the UI because I believe that the open function for icons should automatically rename the image id blocks by prefixing them with .imageicon. and doing so will require a lot more work.
For that reason I'm going to leave this as is for now, also there may be a better solution.
Modified Paths:
--------------
branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-jwilkins/source/blender/editors/interface/interface_templates.c
branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_image.c
Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-07-04 12:26:46 UTC (rev 29930)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-07-04 13:17:19 UTC (rev 29931)
@@ -516,7 +516,7 @@
if not context.sculpt_object:
row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes)
else:
- col.template_ID_preview(settings, "brush", new="brush.add", filter="is_sculpt_brush", rows=4, cols=4)
+ col.template_ID_preview(settings, "brush", new="brush.add", filter="is_sculpt_brush", rows=3, cols=8)
# Particle Mode #
@@ -783,7 +783,7 @@
col = layout.column()
- col.template_ID_preview(brush, "texture", new="texture.new", rows=2, cols=4)
+ col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
if context.sculpt_object:
#XXX duplicated from properties_texture.py
@@ -1017,7 +1017,8 @@
col.separator()
col.label(text="Icon:")
- col.template_ID_preview(brush, "image_icon", open="image.open", rows=3, cols=4)
+ //col.template_ID_preview(brush, "image_icon", open="image.open", filter="is_image_icon", rows=3, cols=8)
+ col.template_ID_preview(brush, "image_icon", open="image.open", rows=3, cols=8)
col.separator()
split = self.layout.split()
Modified: branches/soc-2010-jwilkins/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/interface/interface_templates.c 2010-07-04 12:26:46 UTC (rev 29930)
+++ branches/soc-2010-jwilkins/source/blender/editors/interface/interface_templates.c 2010-07-04 13:17:19 UTC (rev 29931)
@@ -169,12 +169,11 @@
/* ID listbase */
for(id= lb->first; id; id= id->next) {
if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
+ int filter_yes;
- /* hide dot-datablocks */
- if(U.uiflag & USER_HIDE_DOT)
- if ((id->name[2]=='.') && (str[0] != '.'))
- continue;
+ filter_yes= 0;
+ /* use filter */
if (template->filterop[0] != 0) {
PointerRNA ptr;
ReportList reports;
@@ -200,12 +199,20 @@
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 ((id->name[2]=='.') && (str[0] != '.'))
+ continue;
+
if(BLI_strcasestr(id->name+2, str)) {
iconid= ui_id_icon_get((bContext*)C, id, 1);
Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_image.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_image.c 2010-07-04 12:26:46 UTC (rev 29930)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_image.c 2010-07-04 13:17:19 UTC (rev 29931)
@@ -213,6 +213,12 @@
return depth;
}
+static int rna_Image_is_image_icon(Image *me, bContext *C)
+{
+ const char prefix[] = ".imageicon.";
+ return strncmp(me->id.name+2, prefix, sizeof(prefix)-1) == 0;
+}
+
#else
static void rna_def_imageuser(BlenderRNA *brna)
@@ -292,6 +298,9 @@
{IMA_STD_FIELD, "ODD", 0, "Lower First", "Lower field first"},
{0, NULL, 0, NULL, NULL}};
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
srna= RNA_def_struct(brna, "Image", "ID");
RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image");
RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
@@ -333,6 +342,14 @@
RNA_def_property_ui_text(prop, "Field Order", "Order of video fields. Select which lines are displayed first");
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
+ /* functions */
+ func= RNA_def_function(srna, "is_image_icon", "rna_Image_is_image_icon");
+ RNA_def_function_ui_description(func, "Returns true if Image name is prefixed with .imageicon.");
+ parm= RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_boolean(func, "ret", 0, "", "");
+ RNA_def_function_return(func, parm);
+
/* booleans */
prop= RNA_def_property(srna, "fields", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS);
More information about the Bf-blender-cvs
mailing list