fix [#28880] relative paths don't work with Change Path/Files
[blender.git] / source / blender / editors / space_sequencer / sequencer_edit.c
index bd93a1270f6393d35fcdd30aec28749bfe22d632..da785430d435903aa61f43c5679063938d55d0f3 100644 (file)
@@ -2961,9 +2961,11 @@ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
 
 static int sequencer_change_path_exec(bContext *C, wmOperator *op)
 {
+       Main *bmain= CTX_data_main(C);
        Scene *scene= CTX_data_scene(C);
        Editing *ed= seq_give_editing(scene, FALSE);
        Sequence *seq= seq_active_get(scene);
+       const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path");
 
        if(seq->type == SEQ_IMAGE) {
                char directory[FILE_MAX];
@@ -2974,6 +2976,12 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
                        return OPERATOR_CANCELLED;
 
                RNA_string_get(op->ptr, "directory", directory);
+               if (is_relative_path) {
+                       /* TODO, shouldnt this already be relative from the filesel?
+                        * (as the 'filepath' is) for now just make relative here,
+                        * but look into changing after 2.60 - campbell */
+                       BLI_path_rel(directory, bmain->name);
+               }
                BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
 
                if(seq->strip->stripdata) {