Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/physics/physics_fluid.c
| Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | static bool fluid_validatepaths(FluidJob *job, ReportList *reports) | ||||
| char temp_dir[FILE_MAX]; | char temp_dir[FILE_MAX]; | ||||
| temp_dir[0] = '\0'; | temp_dir[0] = '\0'; | ||||
| bool is_relative = false; | bool is_relative = false; | ||||
| const char *relbase = modifier_path_relbase(job->bmain, job->ob); | const char *relbase = modifier_path_relbase(job->bmain, job->ob); | ||||
| /* We do not accept empty paths, they can end in random places silently, see T51176. */ | /* We do not accept empty paths, they can end in random places silently, see T51176. */ | ||||
| if (mds->cache_directory[0] == '\0') { | if (mds->cache_directory[0] == '\0') { | ||||
| modifier_path_init( | char cache_name[64]; | ||||
| mds->cache_directory, sizeof(mds->cache_directory), FLUID_DOMAIN_DIR_DEFAULT); | BKE_fluid_cache_new_name_for_current_session(sizeof(cache_name), cache_name); | ||||
| modifier_path_init(mds->cache_directory, sizeof(mds->cache_directory), cache_name); | |||||
| BKE_reportf(reports, | BKE_reportf(reports, | ||||
| RPT_WARNING, | RPT_WARNING, | ||||
| "Fluid: Empty cache path, reset to default '%s'", | "Fluid: Empty cache path, reset to default '%s'", | ||||
| mds->cache_directory); | mds->cache_directory); | ||||
| } | } | ||||
| BLI_strncpy(temp_dir, mds->cache_directory, FILE_MAXDIR); | BLI_strncpy(temp_dir, mds->cache_directory, FILE_MAXDIR); | ||||
| is_relative = BLI_path_abs(temp_dir, relbase); | is_relative = BLI_path_abs(temp_dir, relbase); | ||||
| /* Ensure whole path exists */ | /* Ensure whole path exists */ | ||||
| const bool dir_exists = BLI_dir_create_recursive(temp_dir); | const bool dir_exists = BLI_dir_create_recursive(temp_dir); | ||||
| /* We change path to some presumably valid default value, but do not allow bake process to | /* We change path to some presumably valid default value, but do not allow bake process to | ||||
| * continue, this gives user chance to set manually another path. */ | * continue, this gives user chance to set manually another path. */ | ||||
| if (!dir_exists) { | if (!dir_exists) { | ||||
| modifier_path_init( | char cache_name[64]; | ||||
| mds->cache_directory, sizeof(mds->cache_directory), FLUID_DOMAIN_DIR_DEFAULT); | BKE_fluid_cache_new_name_for_current_session(sizeof(cache_name), cache_name); | ||||
| modifier_path_init(mds->cache_directory, sizeof(mds->cache_directory), cache_name); | |||||
| BKE_reportf(reports, | BKE_reportf(reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "Fluid: Could not create cache directory '%s', reset to default '%s'", | "Fluid: Could not create cache directory '%s', reset to default '%s'", | ||||
| temp_dir, | temp_dir, | ||||
| mds->cache_directory); | mds->cache_directory); | ||||
| /* Ensure whole path exists and is writable. */ | /* Ensure whole path exists and is writable. */ | ||||
| ▲ Show 20 Lines • Show All 643 Lines • Show Last 20 Lines | |||||