- added a flag argument to WM_operator_properties_filesel() currently only used for relative path option.

- added relative option to saving external multires data
- renamed multires external functiosn to have save / pack as suffix.
- added TODO's for file select operators that should support relative paths but dont.

- also disable openmp on linux cross compile, mingw currently isnt linking -lgomp
This commit is contained in:
Campbell Barton 2010-06-09 14:04:34 +00:00
parent 0ef2431220
commit 6cc6f8495f
18 changed files with 56 additions and 55 deletions

@ -153,7 +153,7 @@ BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32 glu32' BF_OPENGL_LIB = 'opengl32 glu32'
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'] BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a']
WITH_BF_OPENMP = True WITH_BF_OPENMP = False
BF_OPENMP = LIBDIR + '/gcc/gomp' BF_OPENMP = LIBDIR + '/gcc/gomp'
BF_OPENMP_INC = '${BF_OPENMP}/include' BF_OPENMP_INC = '${BF_OPENMP}/include'
BF_OPENMP_LIBPATH = '${BF_OPENMP}/lib' BF_OPENMP_LIBPATH = '${BF_OPENMP}/lib'

@ -452,12 +452,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = layout.column() col = layout.column()
row = col.row() row = col.row()
if md.external: if md.external:
row.operator("object.multires_pack_external", text="Pack External") row.operator("object.multires_external_pack", text="Pack External")
row.label() row.label()
row = col.row() row = col.row()
row.prop(md, "filepath", text="") row.prop(md, "filepath", text="")
else: else:
row.operator("object.multires_save_external", text="Save External...") row.operator("object.multires_external_save", text="Save External...")
row.label() row.label()
def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui): def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):

@ -417,7 +417,7 @@ void FONT_OT_file_paste(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, 0);
} }
/******************* paste buffer operator ********************/ /******************* paste buffer operator ********************/
@ -1639,7 +1639,7 @@ void FONT_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, 0);
} }
/******************* delete operator *********************/ /******************* delete operator *********************/

@ -157,8 +157,8 @@ void OBJECT_OT_modifier_copy(struct wmOperatorType *ot);
void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot); void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot);
void OBJECT_OT_multires_reshape(struct wmOperatorType *ot); void OBJECT_OT_multires_reshape(struct wmOperatorType *ot);
void OBJECT_OT_multires_higher_levels_delete(struct wmOperatorType *ot); void OBJECT_OT_multires_higher_levels_delete(struct wmOperatorType *ot);
void OBJECT_OT_multires_save_external(struct wmOperatorType *ot); void OBJECT_OT_multires_external_save(struct wmOperatorType *ot);
void OBJECT_OT_multires_pack_external(struct wmOperatorType *ot); void OBJECT_OT_multires_external_pack(struct wmOperatorType *ot);
void OBJECT_OT_meshdeform_bind(struct wmOperatorType *ot); void OBJECT_OT_meshdeform_bind(struct wmOperatorType *ot);
void OBJECT_OT_explode_refresh(struct wmOperatorType *ot); void OBJECT_OT_explode_refresh(struct wmOperatorType *ot);

@ -1009,11 +1009,12 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
/****************** multires save external operator *********************/ /****************** multires save external operator *********************/
static int multires_save_external_exec(bContext *C, wmOperator *op) static int multires_external_save_exec(bContext *C, wmOperator *op)
{ {
Object *ob = ED_object_active_context(C); Object *ob = ED_object_active_context(C);
Mesh *me= (ob)? ob->data: op->customdata; Mesh *me= (ob)? ob->data: op->customdata;
char path[FILE_MAX]; char path[FILE_MAX];
int relative= RNA_boolean_get(op->ptr, "relative_path");
if(!me) if(!me)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
@ -1023,7 +1024,8 @@ static int multires_save_external_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "path", path); RNA_string_get(op->ptr, "path", path);
/* BLI_path_rel(path, G.sce); */ /* TODO, relative path operator option */ if(relative)
BLI_path_rel(path, G.sce);
CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path); CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path);
CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0); CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0);
@ -1031,7 +1033,7 @@ static int multires_save_external_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
static int multires_save_external_invoke(bContext *C, wmOperator *op, wmEvent *event) static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *event)
{ {
Object *ob = ED_object_active_context(C); Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd; MultiresModifierData *mmd;
@ -1049,8 +1051,11 @@ static int multires_save_external_invoke(bContext *C, wmOperator *op, wmEvent *e
if(CustomData_external_test(&me->fdata, CD_MDISPS)) if(CustomData_external_test(&me->fdata, CD_MDISPS))
return OPERATOR_CANCELLED; 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, "path")) if(RNA_property_is_set(op->ptr, "path"))
return multires_save_external_exec(C, op); return multires_external_save_exec(C, op);
op->customdata= me; op->customdata= me;
@ -1062,27 +1067,27 @@ static int multires_save_external_invoke(bContext *C, wmOperator *op, wmEvent *e
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
void OBJECT_OT_multires_save_external(wmOperatorType *ot) void OBJECT_OT_multires_external_save(wmOperatorType *ot)
{ {
ot->name= "Multires Save External"; ot->name= "Multires Save External";
ot->description= "Save displacements to an external file"; ot->description= "Save displacements to an external file";
ot->idname= "OBJECT_OT_multires_save_external"; ot->idname= "OBJECT_OT_multires_external_save";
// XXX modifier no longer in context after file browser .. ot->poll= multires_poll; // XXX modifier no longer in context after file browser .. ot->poll= multires_poll;
ot->exec= multires_save_external_exec; ot->exec= multires_external_save_exec;
ot->invoke= multires_save_external_invoke; ot->invoke= multires_external_save_invoke;
ot->poll= multires_poll; ot->poll= multires_poll;
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH);
edit_modifier_properties(ot); edit_modifier_properties(ot);
} }
/****************** multires pack operator *********************/ /****************** multires pack operator *********************/
static int multires_pack_external_exec(bContext *C, wmOperator *op) static int multires_external_pack_exec(bContext *C, wmOperator *op)
{ {
Object *ob = ED_object_active_context(C); Object *ob = ED_object_active_context(C);
Mesh *me= ob->data; Mesh *me= ob->data;
@ -1096,14 +1101,14 @@ static int multires_pack_external_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
void OBJECT_OT_multires_pack_external(wmOperatorType *ot) void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
{ {
ot->name= "Multires Pack External"; ot->name= "Multires Pack External";
ot->description= "Pack displacements from an external file"; ot->description= "Pack displacements from an external file";
ot->idname= "OBJECT_OT_multires_pack_external"; ot->idname= "OBJECT_OT_multires_external_pack";
ot->poll= multires_poll; ot->poll= multires_poll;
ot->exec= multires_pack_external_exec; ot->exec= multires_external_pack_exec;
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;

@ -138,8 +138,8 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_multires_subdivide); WM_operatortype_append(OBJECT_OT_multires_subdivide);
WM_operatortype_append(OBJECT_OT_multires_reshape); WM_operatortype_append(OBJECT_OT_multires_reshape);
WM_operatortype_append(OBJECT_OT_multires_higher_levels_delete); WM_operatortype_append(OBJECT_OT_multires_higher_levels_delete);
WM_operatortype_append(OBJECT_OT_multires_save_external); WM_operatortype_append(OBJECT_OT_multires_external_save);
WM_operatortype_append(OBJECT_OT_multires_pack_external); WM_operatortype_append(OBJECT_OT_multires_external_pack);
WM_operatortype_append(OBJECT_OT_meshdeform_bind); WM_operatortype_append(OBJECT_OT_meshdeform_bind);
WM_operatortype_append(OBJECT_OT_explode_refresh); WM_operatortype_append(OBJECT_OT_explode_refresh);

@ -913,9 +913,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
/* properties */ /* properties */
//RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); //RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH);
RNA_def_boolean(ot->srna, "relative_path", 0, "Relative Path", "Save image with relative path to current .blend file");
} }
static int envmap_clear_exec(bContext *C, wmOperator *op) static int envmap_clear_exec(bContext *C, wmOperator *op)

@ -171,7 +171,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
ot->flag= 0; ot->flag= 0;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, 0);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", ""); RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
} }

@ -150,9 +150,8 @@ void SOUND_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
RNA_def_boolean(ot->srna, "relative_path", FALSE, "Relative Path", "Load image with relative path to current .blend file");
} }
/* ******************************************************* */ /* ******************************************************* */

@ -147,6 +147,6 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
ot->cancel= file_browse_cancel; ot->cancel= file_browse_cancel;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, 0);
} }

@ -1117,7 +1117,7 @@ void GRAPH_OT_sound_bake (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, 0);
RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00); RNA_def_float(ot->srna, "low", 0.0f, 0.0, 100000.0, "Lowest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00); RNA_def_float(ot->srna, "high", 100000.0, 0.0, 100000.0, "Highest frequency", "", 0.1, 1000.00);
RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1); RNA_def_float(ot->srna, "attack", 0.005, 0.0, 2.0, "Attack time", "", 0.01, 0.1);

@ -754,9 +754,7 @@ void IMAGE_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, FILE_RELPATH);
RNA_def_boolean(ot->srna, "relative_path", 0, "Relative Path", "Load image with relative path to current .blend file");
} }
/******************** replace image operator ********************/ /******************** replace image operator ********************/
@ -809,7 +807,7 @@ void IMAGE_OT_replace(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
} }
/******************** save image as operator ********************/ /******************** save image as operator ********************/
@ -997,9 +995,8 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
/* properties */ /* properties */
RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, FILE_RELPATH);
RNA_def_boolean(ot->srna, "relative_path", 0, "Relative Path", "Save image with relative path to current .blend file");
RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender"); RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
} }

@ -299,7 +299,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, 0);
} }
/********************* report box operator *********************/ /********************* report box operator *********************/

@ -2304,7 +2304,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign."); RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign.");
} }

@ -336,7 +336,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES);
RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie"); RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
} }
@ -378,7 +378,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILES);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
} }
@ -469,7 +469,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILES); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILES);
} }
@ -617,7 +617,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
/* flags */ /* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME); sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type"); RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f); RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);

@ -295,7 +295,7 @@ void TEXT_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO; ot->flag= OPTYPE_UNDO;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, 0); //XXX TODO, relative_path
RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading"); RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
} }
@ -542,7 +542,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
ot->poll= text_edit_poll; ot->poll= text_edit_poll;
/* properties */ /* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, 0); //XXX TODO, relative_path
} }
/******************* run script operator *********************/ /******************* run script operator *********************/

@ -223,7 +223,7 @@ void WM_operator_properties_sanitize(struct PointerRNA *ptr, int val); /* make
void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring); void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring);
void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot); void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot);
void WM_operator_properties_free(struct PointerRNA *ptr); void WM_operator_properties_free(struct PointerRNA *ptr);
void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action); void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter, short type, short action, short flag);
void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int extend); void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int extend);
void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor); void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
void WM_operator_properties_select_all(struct wmOperatorType *ot); void WM_operator_properties_select_all(struct wmOperatorType *ot);

@ -784,7 +784,7 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event)
} }
/* default properties for fileselect */ /* default properties for fileselect */
void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action) void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag)
{ {
PropertyRNA *prop; PropertyRNA *prop;
@ -822,6 +822,9 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
"File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file", "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); FILE_LOADLIB, FILE_SPECIAL);
RNA_def_property_flag(prop, PROP_HIDDEN); RNA_def_property_flag(prop, PROP_HIDDEN);
if(flag & FILE_RELPATH)
RNA_def_boolean(ot->srna, "relative_path", 0, "Relative Path", "Select the file relative to the blend file");
} }
void WM_operator_properties_select_all(wmOperatorType *ot) { void WM_operator_properties_select_all(wmOperatorType *ot) {
@ -1472,7 +1475,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
ot->exec= wm_open_mainfile_exec; ot->exec= wm_open_mainfile_exec;
ot->poll= WM_operator_winactive; ot->poll= WM_operator_winactive;
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, 0);
RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file"); RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source", "Allow blend file execute scripts automatically, default available from system preferences"); RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source", "Allow blend file execute scripts automatically, default available from system preferences");
@ -1643,13 +1646,12 @@ static void WM_OT_link_append(wmOperatorType *ot)
ot->flag |= OPTYPE_UNDO; ot->flag |= OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, FILE_RELPATH);
RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending"); RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects"); RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer"); RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer");
RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup"); RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup");
RNA_def_boolean(ot->srna, "relative_path", 1, "Relative Paths", "Store the library path as a relative path to current .blend file");
RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", ""); RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
} }
@ -1728,7 +1730,7 @@ static void WM_OT_recover_auto_save(wmOperatorType *ot)
ot->invoke= wm_recover_auto_save_invoke; ot->invoke= wm_recover_auto_save_invoke;
ot->poll= WM_operator_winactive; ot->poll= WM_operator_winactive;
WM_operator_properties_filesel(ot, BLENDERFILE, FILE_BLENDER, FILE_OPENFILE); WM_operator_properties_filesel(ot, BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, 0);
} }
/* *************** save file as **************** */ /* *************** save file as **************** */
@ -1811,7 +1813,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
ot->exec= wm_save_as_mainfile_exec; ot->exec= wm_save_as_mainfile_exec;
ot->poll= WM_operator_winactive; ot->poll= WM_operator_winactive;
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, 0);
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory"); RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory");
} }
@ -1860,7 +1862,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
ot->exec= wm_save_as_mainfile_exec; ot->exec= wm_save_as_mainfile_exec;
ot->poll= NULL; ot->poll= NULL;
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, 0);
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory"); RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory");
} }
@ -1909,7 +1911,7 @@ static void WM_OT_collada_export(wmOperatorType *ot)
ot->exec= wm_collada_export_exec; ot->exec= wm_collada_export_exec;
ot->poll= WM_operator_winactive; ot->poll= WM_operator_winactive;
WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE); WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE, 0);
} }
/* function used for WM_OT_save_mainfile too */ /* function used for WM_OT_save_mainfile too */
@ -1937,7 +1939,7 @@ static void WM_OT_collada_import(wmOperatorType *ot)
ot->exec= wm_collada_import_exec; ot->exec= wm_collada_import_exec;
ot->poll= WM_operator_winactive; ot->poll= WM_operator_winactive;
WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_OPENFILE); WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, 0);
} }
#endif #endif