[Bf-blender-cvs] [8d3129c] asset-experiments: Merge branch 'id-remap' into asset-experiments

Bastien Montagne noreply at git.blender.org
Sun Dec 27 13:14:40 CET 2015


Commit: 8d3129cba201c323dd9327cca99b67dd10cf5adf
Author: Bastien Montagne
Date:   Sun Dec 27 13:09:42 2015 +0100
Branches: asset-experiments
https://developer.blender.org/rB8d3129cba201c323dd9327cca99b67dd10cf5adf

Merge branch 'id-remap' into asset-experiments

Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/windowmanager/intern/wm_operators.c

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



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

diff --cc source/blender/blenkernel/intern/library.c
index 6bf4bf1,ca3da6a..c716137
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -2044,8 -2050,7 +2050,8 @@@ void id_clear_lib_data(Main *bmain, ID 
  	id_fake_user_clear(id);
  
  	id->lib = NULL;
 +	MEM_SAFE_FREE(id->uuid);  /* Local ID have no more use for asset-related data. */
- 	id->flag = LIB_LOCAL;
+ 	id->tag |= LIB_TAG_LOCAL;
  	new_id(which_libbase(bmain, GS(id->name)), id, NULL);
  
  	/* internal bNodeTree blocks inside ID types below
diff --cc source/blender/windowmanager/intern/wm_operator_props.c
index 0000000,c74bb46..33c8c94
mode 000000,100644..100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@@ -1,0 -1,282 +1,300 @@@
+ /*
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version. 
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * The Original Code is Copyright (C) 2007 Blender Foundation.
+  * All rights reserved.
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+ 
+ /** \file blender/windowmanager/intern/wm_operator_props.c
+  *  \ingroup wm
+  *
+  * Generic re-usable property definitions and accessors for operators to share.
+  * (`WM_operator_properties_*` functions).
+  */
+ 
+ #include "DNA_space_types.h"
+ 
+ #include "BLI_rect.h"
+ #include "BLI_math_base.h"
+ 
+ #include "UI_resources.h"
+ 
+ #include "RNA_access.h"
+ #include "RNA_define.h"
+ #include "RNA_enum_types.h"
+ 
+ #include "WM_api.h"
+ #include "WM_types.h"
+ 
+ /* default properties for fileselect */
+ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display, short sort)
+ {
+ 	PropertyRNA *prop;
+ 
+ 	static EnumPropertyItem file_display_items[] = {
+ 		{FILE_DEFAULTDISPLAY, "DEFAULT", 0, "Default", "Automatically determine display type for files"},
+ 		{FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
+ 		{FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
+ 		{FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
+ 		{0, NULL, 0, NULL, NULL}
+ 	};
+ 
+ 	if (flag & WM_FILESEL_FILEPATH)
+ 		RNA_def_string_file_path(ot->srna, "filepath", NULL, FILE_MAX, "File Path", "Path to file");
+ 
 -	if (flag & WM_FILESEL_DIRECTORY)
++	/* Enforce directory in file cases, needed with asset engines. */
++	if (flag & (WM_FILESEL_DIRECTORY | WM_FILESEL_FILEPATH | WM_FILESEL_FILENAME | WM_FILESEL_FILES))
+ 		RNA_def_string_dir_path(ot->srna, "directory", NULL, FILE_MAX, "Directory", "Directory of the file");
+ 
+ 	if (flag & WM_FILESEL_FILENAME)
+ 		RNA_def_string_file_name(ot->srna, "filename", NULL, FILE_MAX, "File Name", "Name of the file");
+ 
+ 	if (flag & WM_FILESEL_FILES)
+ 		RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
+ 
++	if (flag & (WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_FILES)) {
++		prop = RNA_def_string(ot->srna, "asset_engine", NULL, BKE_ST_MAXNAME, "Asset Engine",
++		                      "Identifier of relevant asset engine (if any)");
++		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
++		if (flag & (WM_FILESEL_FILEPATH | WM_FILESEL_FILENAME)) {
++			prop = RNA_def_int_vector(ot->srna, "asset_uuid", 4, NULL, INT_MIN, INT_MAX,
++			                          "Asset UUID", "Identifier of this item in current asset engine", INT_MIN, INT_MAX);
++			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
++			prop = RNA_def_int_vector(ot->srna, "variant_uuid", 4, NULL, INT_MIN, INT_MAX,
++			                          "Variant UUID", "Identifier of this item's variant in current asset engine", INT_MIN, INT_MAX);
++			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
++			prop = RNA_def_int_vector(ot->srna, "revision_uuid", 4, NULL, INT_MIN, INT_MAX,
++			                          "Revision UUID", "Identifier of this item's revision in current asset engine", INT_MIN, INT_MAX);
++			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
++		}
++	}
++
+ 	if (action == FILE_SAVE) {
+ 		/* note, this is only used to check if we should highlight the filename area red when the
+ 		 * filepath is an existing file. */
+ 		prop = RNA_def_boolean(ot->srna, "check_existing", true, "Check Existing",
+ 		                       "Check and warn on overwriting existing files");
+ 		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	}
+ 
+ 	prop = RNA_def_boolean(ot->srna, "filter_blender", (filter & FILE_TYPE_BLENDER) != 0, "Filter .blend files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_backup", (filter & FILE_TYPE_BLENDER_BACKUP) != 0, "Filter .blend files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_image", (filter & FILE_TYPE_IMAGE) != 0, "Filter image files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_movie", (filter & FILE_TYPE_MOVIE) != 0, "Filter movie files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_python", (filter & FILE_TYPE_PYSCRIPT) != 0, "Filter python files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_font", (filter & FILE_TYPE_FTFONT) != 0, "Filter font files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_sound", (filter & FILE_TYPE_SOUND) != 0, "Filter sound files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_text", (filter & FILE_TYPE_TEXT) != 0, "Filter text files", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	prop = RNA_def_boolean(ot->srna, "filter_btx", (filter & FILE_TYPE_BTX) != 0, "Filter btx files", "");
+ 	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_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", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 
+ 	prop = RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL,
+ 	                   "File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file",
+ 	                   FILE_LOADLIB, FILE_SPECIAL);
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 
+ 	if (flag & WM_FILESEL_RELPATH)
+ 		RNA_def_boolean(ot->srna, "relative_path", true, "Relative Path", "Select the file relative to the blend file");
+ 
+ 	if ((filter & FILE_TYPE_IMAGE) || (filter & FILE_TYPE_MOVIE)) {
+ 		prop = RNA_def_boolean(ot->srna, "show_multiview", 0, "Enable Multi-View", "");
+ 		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 		prop = RNA_def_boolean(ot->srna, "use_multiview", 0, "Use Multi-View", "");
+ 		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 	}
+ 
+ 	prop = RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 
+ 	prop = RNA_def_enum(ot->srna, "sort_method", rna_enum_file_sort_items, sort, "File sorting mode", "");
+ 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ 
+ }
+ 
+ static void wm_operator_properties_select_action_ex(wmOperatorType *ot, int default_action,
+                                                     const EnumPropertyItem *select_actions)
+ {
+ 	RNA_def_enum(ot->srna, "action", select_actions, default_action, "Action", "Selection action to execute");
+ }
+ 
+ void WM_operator_properties_select_action(wmOperatorType *ot, int default_action)
+ {
+ 	static EnumPropertyItem select_actions[] = {
+ 		{SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
+ 		{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
+ 		{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
+ 		{SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
+ 		{0, NULL, 0, NULL, NULL}
+ 	};
+ 
+ 	wm_operator_properties_select_action_ex(ot, default_action, select_actions);
+ }
+ 
+ /**
+  * only SELECT/DESELECT
+  */
+ void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default_action)
+ {
+ 	static EnumPropertyItem select_actions[] = {
+ 		{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
+ 		{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
+ 		{0, NULL, 0, NULL, NULL}
+ 	};
+ 
+ 	wm_operator_properties_select_action_ex(ot, default_action, select_actions);
+ }
+ 
+ /**
+  * Use for all select random operators.
+  * Adds properties: percent, seed, action.
+  */
+ void WM_operator_properties_select_random(wmOperatorType *ot)
+ {
+ 	RNA_def_float_percentage(
+ 	        ot->srna, "percent", 50.f, 0.0f, 100.0f,
+ 	        "Percent", "Percentage of objects to select randomly", 0.f, 100.0f);
+ 	RNA_def_int(
+ 	    

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list