[Bf-blender-cvs] [07f76baa863] workspaces: App Templates: optionally use app-template path for workspaces
Campbell Barton
noreply at git.blender.org
Tue Apr 25 08:50:49 CEST 2017
Commit: 07f76baa8632207ed9cddc0ebd4de55fc6890c93
Author: Campbell Barton
Date: Tue Apr 25 16:53:28 2017 +1000
Branches: workspaces
https://developer.blender.org/rB07f76baa8632207ed9cddc0ebd4de55fc6890c93
App Templates: optionally use app-template path for workspaces
Also make WM_OT_save_workspace_file follow WM_OT_save_userpref logic
more closely.
===================================================================
M source/blender/editors/screen/workspace_edit.c
M source/blender/windowmanager/intern/wm_files.c
===================================================================
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index f208bf92eb9..d96be3a28cd 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -315,7 +315,8 @@ static void WORKSPACE_OT_workspace_delete(wmOperatorType *ot)
static void workspace_config_file_path_from_folder_id(
const Main *bmain, int folder_id, char *r_path)
{
- const char *cfgdir = BKE_appdir_folder_id(folder_id, NULL);
+ const char *app_template = U.app_template[0] ? U.app_template : NULL;
+ const char * const cfgdir = BKE_appdir_folder_id(folder_id, app_template);
if (cfgdir) {
BLI_make_file_string(bmain->name, r_path, cfgdir, BLENDER_WORKSPACES_FILE);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index db21d9b99e9..00e83da7e3f 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1517,22 +1517,23 @@ static int wm_workspace_configuration_file_write_exec(bContext *C, wmOperator *o
{
Main *bmain = CTX_data_main(C);
char filepath[FILE_MAX];
- const char *configdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL);
- if (configdir) {
- BLI_path_join(filepath, sizeof(filepath), configdir, BLENDER_WORKSPACES_FILE, NULL);
- printf("trying to save workspace configuration file at %s ", filepath);
+ const char *app_template = U.app_template[0] ? U.app_template : NULL;
+ const char * const cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, app_template);
+ if (cfgdir == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Unable to create workspace configuration file path");
+ return OPERATOR_CANCELLED;
+ }
- if (BKE_blendfile_workspace_config_write(bmain, filepath, op->reports) != 0) {
- printf("ok\n");
- return OPERATOR_FINISHED;
- }
- else {
- printf("fail\n");
- }
+ BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_WORKSPACES_FILE, NULL);
+ printf("trying to save workspace configuration file at %s ", filepath);
+
+ if (BKE_blendfile_workspace_config_write(bmain, filepath, op->reports) != 0) {
+ printf("ok\n");
+ return OPERATOR_FINISHED;
}
else {
- BKE_report(op->reports, RPT_ERROR, "Unable to create workspace configuration file path");
+ printf("fail\n");
}
return OPERATOR_CANCELLED;
More information about the Bf-blender-cvs
mailing list