Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-03 04:04:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-03 04:04:02 +0400
commit726628518d9c7d30cf5b367992395d74c5cc65af (patch)
tree2a347b2e7a9823383c0b93b09457b7266a3e00f9 /source/blender/windowmanager/intern/wm_files.c
parentb2b4f2c033c9e1df15aae6265390d519f55375d2 (diff)
WM: expose file loading operator property init functions
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index a3aa76dfd3a..0d481bd49dc 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1151,3 +1151,39 @@ void wm_autosave_read(bContext *C, ReportList *reports)
WM_file_read(C, filename, reports);
}
+
+/** \name Initialize WM_OT_open_xxx properties
+ *
+ * Check if load_ui was set by the caller.
+ * Fall back to user preference when file flags not specified.
+ *
+ * \{ */
+
+void wm_open_init_load_ui(wmOperator *op, bool use_prefs)
+{
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "load_ui");
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ bool value = use_prefs ?
+ ((U.flag & USER_FILENOUI) == 0) :
+ ((G.fileflags & G_FILE_NO_UI) == 0);
+
+ RNA_property_boolean_set(op->ptr, prop, value);
+ }
+}
+
+void wm_open_init_use_scripts(wmOperator *op, bool use_prefs)
+{
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_scripts");
+ if (!RNA_property_is_set(op->ptr, prop)) {
+ /* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if
+ * the flag has been disabled from the command line, then opening
+ * from the menu wont enable this setting. */
+ bool value = use_prefs ?
+ ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) :
+ ((G.f & G_SCRIPT_AUTOEXEC) != 0);
+
+ RNA_property_boolean_set(op->ptr, prop, value);
+ }
+}
+
+/** \} */