fix [#32855] Obj im and export and the file path and name

file selector now uses previously used settings for operators rather then over riding them with the currently open blend file.
This commit is contained in:
Campbell Barton 2012-10-24 04:29:35 +00:00
parent cbc734dd79
commit db250a48f6
3 changed files with 34 additions and 4 deletions

@ -94,6 +94,9 @@ FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile)
return sfile->params;
}
/**
* \note RNA_struct_property_is_set_ex is used here because we wan't
* the previously used settings to be used here rather then overriding them */
short ED_fileselect_set_params(SpaceFile *sfile)
{
FileSelectParams *params;
@ -124,7 +127,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
else
params->type = FILE_SPECIAL;
if (is_filepath && RNA_struct_property_is_set(op->ptr, "filepath")) {
if (is_filepath && RNA_struct_property_is_set_ex(op->ptr, "filepath", FALSE)) {
char name[FILE_MAX];
RNA_string_get(op->ptr, "filepath", name);
if (params->type == FILE_LOADLIB) {
@ -136,12 +139,12 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
}
else {
if (is_directory && RNA_struct_property_is_set(op->ptr, "directory")) {
if (is_directory && RNA_struct_property_is_set_ex(op->ptr, "directory", FALSE)) {
RNA_string_get(op->ptr, "directory", params->dir);
sfile->params->file[0] = '\0';
}
if (is_filename && RNA_struct_property_is_set(op->ptr, "filename")) {
if (is_filename && RNA_struct_property_is_set_ex(op->ptr, "filename", FALSE)) {
RNA_string_get(op->ptr, "filename", params->file);
}
}
@ -228,7 +231,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
if (is_relative_path) {
if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
if (!RNA_struct_property_is_set_ex(op->ptr, "relative_path", FALSE)) {
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
}
}

@ -960,7 +960,9 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name);
}
/* check if the idproperty exists, for operators */
int RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, int use_ghost);
int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop);
int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int use_ghost);
int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier);
int RNA_property_is_idprop(PropertyRNA *prop);

@ -4524,6 +4524,17 @@ int RNA_collection_length(PointerRNA *ptr, const char *name)
}
}
int RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, int use_ghost)
{
if (prop->flag & PROP_IDPROPERTY) {
IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
return ((idprop != NULL) && (use_ghost == FALSE || !(idprop->flag & IDP_FLAG_GHOST)));
}
else {
return 1;
}
}
int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
{
if (prop->flag & PROP_IDPROPERTY) {
@ -4535,6 +4546,20 @@ int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
}
}
int RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, int use_ghost)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
if (prop) {
return RNA_property_is_set_ex(ptr, prop, use_ghost);
}
else {
/* python raises an error */
/* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */
return 0;
}
}
int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);