[Bf-blender-cvs] [57c2443] alembic_basic_io: Add a filter for Alembic files in the file selector.

Kévin Dietrich noreply at git.blender.org
Tue Jun 14 16:58:55 CEST 2016


Commit: 57c244325705066a2af39b9766c0995670d52a65
Author: Kévin Dietrich
Date:   Tue Jun 14 16:47:32 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB57c244325705066a2af39b9766c0995670d52a65

Add a filter for Alembic files in the file selector.

===================================================================

M	source/blender/editors/io/io_alembic.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/windowmanager/intern/wm_operator_props.c

===================================================================

diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index cf9d04f..d754ee8 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -235,7 +235,8 @@ void WM_OT_alembic_export(wmOperatorType *ot)
 	ot->poll = WM_operator_winactive;
 	ot->ui = wm_alembic_export_draw;
 
-	WM_operator_properties_filesel(ot, 0, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH,
+	WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_ALEMBIC,
+	                               FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH,
 	                               FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
 	RNA_def_int(ot->srna, "start", 1, INT_MIN, INT_MAX,
@@ -441,7 +442,8 @@ void WM_OT_alembic_import(wmOperatorType *ot)
 	ot->poll = WM_operator_winactive;
 	ot->ui = wm_alembic_import_draw;
 
-	WM_operator_properties_filesel(ot, 0, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH,
+	WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_ALEMBIC,
+	                               FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH,
 	                               FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
 	RNA_def_float(ot->srna, "scale", 1.0f, 0.0f, 1000.0f, "Scale", "", 0.0f, 1000.0f);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 8e1f781..cf9361c 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -920,6 +920,8 @@ static int filelist_geticon_ex(
 		return ICON_FILE_BLANK;
 	else if (typeflag & FILE_TYPE_COLLADA)
 		return ICON_FILE_BLANK;
+	else if (typeflag & FILE_TYPE_ALEMBIC)
+		return ICON_FILE_BLANK;
 	else if (typeflag & FILE_TYPE_TEXT)
 		return ICON_FILE_TEXT;
 	else if (typeflag & FILE_TYPE_BLENDERLIB) {
@@ -1951,6 +1953,9 @@ static int path_extension_type(const char *path)
 	else if (BLI_testextensie(path, ".dae")) {
 		return FILE_TYPE_COLLADA;
 	}
+	else if (BLI_testextensie(path, ".abc")) {
+		return FILE_TYPE_ALEMBIC;
+	}
 	else if (BLI_testextensie_array(path, imb_ext_image) ||
 	         (G.have_quicktime && BLI_testextensie_array(path, imb_ext_image_qt)))
 	{
@@ -2003,6 +2008,8 @@ int ED_file_extension_icon(const char *path)
 			return ICON_FILE_BLANK;
 		case FILE_TYPE_COLLADA:
 			return ICON_FILE_BLANK;
+		case FILE_TYPE_ALEMBIC:
+			return ICON_FILE_BLANK;
 		case FILE_TYPE_TEXT:
 			return ICON_FILE_TEXT;
 		default:
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index bf90a4e..7035dd0 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -185,6 +185,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 			params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_BTX : 0;
 		if ((prop = RNA_struct_find_property(op->ptr, "filter_collada")))
 			params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_COLLADA : 0;
+		if ((prop = RNA_struct_find_property(op->ptr, "filter_alembic")))
+			params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_ALEMBIC : 0;
 		if ((prop = RNA_struct_find_property(op->ptr, "filter_glob"))) {
 			/* Protection against pyscripts not setting proper size limit... */
 			char *tmp = RNA_property_string_get_alloc(
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 46b7d71..4d93074 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -736,6 +736,7 @@ typedef enum eFileSel_File_Types {
 	FILE_TYPE_COLLADA           = (1 << 13),
 	FILE_TYPE_OPERATOR          = (1 << 14), /* from filter_glob operator property */
 	FILE_TYPE_APPLICATIONBUNDLE = (1 << 15),
+	FILE_TYPE_ALEMBIC           = (1 << 16),
 
 	FILE_TYPE_DIR               = (1 << 30),  /* An FS directory (i.e. S_ISDIR on its path is true). */
 	FILE_TYPE_BLENDERLIB        = (1 << 31),
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index 7ec2aea..18836f3 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -97,6 +97,8 @@ void WM_operator_properties_filesel(
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	prop = RNA_def_boolean(ot->srna, "filter_collada", (filter & FILE_TYPE_COLLADA) != 0, "Filter COLLADA files", "");
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_alembic", (filter & FILE_TYPE_ALEMBIC) != 0, "Filter Alembic files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	prop = RNA_def_boolean(ot->srna, "filter_folder", (filter & FILE_TYPE_FOLDER) != 0, "Filter folders", "");
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	prop = RNA_def_boolean(ot->srna, "filter_blenlib", (filter & FILE_TYPE_BLENDERLIB) != 0, "Filter Blender IDs", "");




More information about the Bf-blender-cvs mailing list