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>2011-10-12 04:15:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-12 04:15:19 +0400
commit15bf56c696b976a4f74b4b0cae4371ea8008e231 (patch)
treef64818549f44e853db32aaf2fcab699ee86136b0 /source/blender
parent4bfee0a1cf33f7b74f937ab991967f2047b80b9c (diff)
changes to relative path option
- initialize the relative_path option in ED_fileselect_get_params(), saves initializing within every operators own init functions, some even trying to initialize a non existing property. - don't set the operator default from the user preferece, operator property defaults should be static else python scripts for eg can get different defaults depending on user settings, this also wont get updated when user-defaults are edited so generally confusing & not good practice.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/curve/editfont.c5
-rw-r--r--source/blender/editors/object/object_modifier.c3
-rw-r--r--source/blender/editors/render/render_shading.c3
-rw-r--r--source/blender/editors/sound/sound_ops.c6
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c2
-rw-r--r--source/blender/editors/space_file/filesel.c6
-rw-r--r--source/blender/editors/space_image/image_ops.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c15
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c5
9 files changed, 11 insertions, 41 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 19892d2c1ee..1f2ef79e091 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1707,10 +1707,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
}
path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
+
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index ebbc4137628..20ca50581bf 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1163,9 +1163,6 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
if(CustomData_external_test(&me->fdata, CD_MDISPS))
return OPERATOR_CANCELLED;
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return multires_external_save_exec(C, op);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 72cc4ec2afa..faf0baa1aca 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -712,9 +712,6 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
{
//Scene *scene= CTX_data_scene(C);
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return envmap_save_exec(C, op);
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index d03c2b19300..50dda49bead 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -164,9 +164,6 @@ static int open_exec(bContext *UNUSED(C), wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -264,9 +261,6 @@ static int mixdown_exec(bContext *C, wmOperator *op)
static int mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return mixdown_exec(C, op);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 99e5c6d693e..75b3eb950a5 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -201,6 +201,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_string_set(op->ptr, path_prop, str);
MEM_freeN(str);
+ /* normally ED_fileselect_get_params would handle this but we need to because of stupid
+ * user-prefs exception - campbell */
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(!RNA_property_is_set(op->ptr, "relative_path")) {
/* annoying exception!, if were dealign with the user prefs, default relative to be off */
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index e3571886cf4..6cc42b2a751 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -125,6 +125,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
const short is_filepath= (RNA_struct_find_property(op->ptr, "filepath") != NULL);
const short is_filename= (RNA_struct_find_property(op->ptr, "filename") != NULL);
const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL);
+ const short is_relative_path= (RNA_struct_find_property(op->ptr, "relative_path") != NULL);
BLI_strncpy(params->title, op->type->name, sizeof(params->title));
@@ -228,6 +229,11 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->display= FILE_SHORTDISPLAY;
}
+ if (is_relative_path) {
+ if (!RNA_property_is_set(op->ptr, "relative_path")) {
+ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
+ }
+ }
}
else {
/* default values, if no operator */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 33c3ae45a58..725b5f5c02d 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -843,10 +843,6 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
if(ima)
path= ima->name;
-
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -1167,9 +1163,6 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
Scene *scene= CTX_data_scene(C);
SaveImageOptions simopts;
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath"))
return save_as_exec(C, op);
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index b390b7dbdb5..1c4b0130897 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -380,9 +380,6 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent
sequencer_generic_invoke_xy__internal(C, op, event, 0);
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -434,10 +431,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent
}
sequencer_generic_invoke_xy__internal(C, op, event, 0);
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
+
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -543,9 +537,6 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent
}
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -721,10 +712,6 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
if (is_type_set && type==SEQ_PLUGIN) {
-
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
/* only plugins need the file selector */
return WM_operator_filesel(C, op, event);
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index eda85f112df..07bab06e52f 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -860,7 +860,7 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
RNA_def_property_flag(prop, PROP_HIDDEN);
if(flag & WM_FILESEL_RELPATH)
- RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file");
+ RNA_def_boolean(ot->srna, "relative_path", TRUE, "Relative Path", "Select the file relative to the blend file");
}
void WM_operator_properties_select_all(wmOperatorType *ot)
@@ -1618,9 +1618,6 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
if(RNA_property_is_set(op->ptr, "filepath")) {
return WM_operator_call(C, op);
}