Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2017-08-11 10:33:39 +10:00
commit d1328feeb1
22 changed files with 162 additions and 162 deletions

View File

@ -67,7 +67,6 @@ class AddPresetSampling(AddPresetBase, Operator):
"cycles.mesh_light_samples",
"cycles.subsurface_samples",
"cycles.volume_samples",
"cycles.use_square_samples",
"cycles.progressive",
"cycles.seed",
"cycles.sample_clamp_direct",

View File

@ -172,12 +172,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default='PATH',
)
cls.use_square_samples = BoolProperty(
name="Square Samples",
description="Square sampling values for easier artist control",
default=False,
)
cls.samples = IntProperty(
name="Samples",
description="Number of samples to render for each pixel",
@ -199,13 +193,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
name="AA Samples",
description="Number of antialiasing samples to render for each pixel",
min=1, max=2097151,
default=4,
default=128,
)
cls.preview_aa_samples = IntProperty(
name="AA Samples",
description="Number of antialiasing samples to render in the viewport, unlimited if 0",
min=0, max=2097151,
default=4,
default=32,
)
cls.diffuse_samples = IntProperty(
name="Diffuse Samples",
@ -302,7 +296,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Adaptively blur glossy shaders after blurry bounces, "
"to reduce noise at the cost of accuracy",
min=0.0, max=10.0,
default=0.0,
default=1.0,
)
cls.max_bounces = IntProperty(
@ -447,7 +441,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
"higher values will be scaled down to avoid too "
"much noise and slow convergence at the cost of accuracy",
min=0.0, max=1e8,
default=0.0,
default=10.0,
)
cls.debug_tile_size = IntProperty(

View File

@ -101,8 +101,6 @@ def draw_samples_info(layout, context):
# Calculate sample values
if integrator == 'PATH':
aa = cscene.samples
if cscene.use_square_samples:
aa = aa * aa
else:
aa = cscene.aa_samples
d = cscene.diffuse_samples
@ -113,19 +111,9 @@ def draw_samples_info(layout, context):
sss = cscene.subsurface_samples
vol = cscene.volume_samples
if cscene.use_square_samples:
aa = aa * aa
d = d * d
g = g * g
t = t * t
ao = ao * ao
ml = ml * ml
sss = sss * sss
vol = vol * vol
# Draw interface
# Do not draw for progressive, when Square Samples are disabled
if use_branched_path(context) or (cscene.use_square_samples and integrator == 'PATH'):
if use_branched_path(context):
col = layout.column(align=True)
col.scale_y = 0.6
col.label("Total Samples:")
@ -158,7 +146,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
row = layout.row()
sub = row.row()
sub.prop(cscene, "progressive", text="")
row.prop(cscene, "use_square_samples")
sub.label()
split = layout.split()

View File

@ -302,3 +302,36 @@ def do_versions(self):
cscene = scene.cycles
if not cscene.is_property_set("light_sampling_threshold"):
cscene.light_sampling_threshold = 0.0
if bpy.data.version <= (2, 79, 0):
for scene in bpy.data.scenes:
cscene = scene.cycles
# Default changes
if not cscene.is_property_set("aa_samples"):
cscene.aa_samples = 4
if not cscene.is_property_set("preview_aa_samples"):
cscene.preview_aa_samples = 4
if not cscene.is_property_set("blur_glossy"):
cscene.blur_glossy = 0.0
if not cscene.is_property_set("sample_clamp_indirect"):
cscene.sample_clamp_indirect = 0.0
# Remove and apply square samples
use_square_samples = cscene.get("use_square_samples", False)
if use_square_samples:
del cscene["use_square_samples"]
cscene.samples *= cscene.samples
cscene.preview_samples *= cscene.preview_samples
cscene.aa_samples *= cscene.aa_samples
cscene.preview_aa_samples *= cscene.preview_aa_samples
cscene.diffuse_samples *= cscene.diffuse_samples
cscene.glossy_samples *= cscene.glossy_samples
cscene.transmission_samples *= cscene.transmission_samples
cscene.ao_samples *= cscene.ao_samples
cscene.mesh_light_samples *= cscene.mesh_light_samples
cscene.subsurface_samples *= cscene.subsurface_samples
cscene.volume_samples *= cscene.volume_samples
for layer in scene.render.layers:
layer.samples *= layer.samples

View File

@ -163,16 +163,11 @@ void BlenderSync::sync_light(BL::Object& b_parent,
light->shader = used_shaders[0];
/* shadow */
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
light->cast_shadow = get_boolean(clamp, "cast_shadow");
light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
int samples = get_int(clamp, "samples");
if(get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
else
light->samples = samples;
light->samples = get_int(clamp, "samples");
light->max_bounces = get_int(clamp, "max_bounces");
@ -200,7 +195,6 @@ void BlenderSync::sync_background_light(bool use_portal)
BL::World b_world = b_scene.world();
if(b_world) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
bool sample_as_light = get_boolean(cworld, "sample_as_light");
@ -219,11 +213,7 @@ void BlenderSync::sync_background_light(bool use_portal)
light->use_mis = sample_as_light;
light->max_bounces = get_int(cworld, "max_bounces");
int samples = get_int(cworld, "samples");
if(get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
else
light->samples = samples;
light->samples = get_int(cworld, "samples");
light->tag_update(scene);
light_map.set_recalc(b_world);

View File

@ -294,32 +294,13 @@ void BlenderSync::sync_integrator()
integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect");
integrator->light_sampling_threshold = get_float(cscene, "light_sampling_threshold");
int diffuse_samples = get_int(cscene, "diffuse_samples");
int glossy_samples = get_int(cscene, "glossy_samples");
int transmission_samples = get_int(cscene, "transmission_samples");
int ao_samples = get_int(cscene, "ao_samples");
int mesh_light_samples = get_int(cscene, "mesh_light_samples");
int subsurface_samples = get_int(cscene, "subsurface_samples");
int volume_samples = get_int(cscene, "volume_samples");
if(get_boolean(cscene, "use_square_samples")) {
integrator->diffuse_samples = diffuse_samples * diffuse_samples;
integrator->glossy_samples = glossy_samples * glossy_samples;
integrator->transmission_samples = transmission_samples * transmission_samples;
integrator->ao_samples = ao_samples * ao_samples;
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
integrator->volume_samples = volume_samples * volume_samples;
}
else {
integrator->diffuse_samples = diffuse_samples;
integrator->glossy_samples = glossy_samples;
integrator->transmission_samples = transmission_samples;
integrator->ao_samples = ao_samples;
integrator->mesh_light_samples = mesh_light_samples;
integrator->subsurface_samples = subsurface_samples;
integrator->volume_samples = volume_samples;
}
integrator->diffuse_samples = get_int(cscene, "diffuse_samples");
integrator->glossy_samples = get_int(cscene, "glossy_samples");
integrator->transmission_samples = get_int(cscene, "transmission_samples");
integrator->ao_samples = get_int(cscene, "ao_samples");
integrator->mesh_light_samples = get_int(cscene, "mesh_light_samples");
integrator->subsurface_samples = get_int(cscene, "subsurface_samples");
integrator->volume_samples = get_int(cscene, "volume_samples");
if(b_scene.render().use_simplify()) {
if(preview) {
@ -419,11 +400,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer)
render_layer.bound_samples = (use_layer_samples == 1);
if(use_layer_samples != 2) {
int samples = b_rlay->samples();
if(get_boolean(cscene, "use_square_samples"))
render_layer.samples = samples * samples;
else
render_layer.samples = samples;
render_layer.samples = b_rlay->samples();
}
}
@ -738,14 +715,6 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
int preview_samples = get_int(cscene, "preview_samples");
int preview_aa_samples = get_int(cscene, "preview_aa_samples");
if(get_boolean(cscene, "use_square_samples")) {
aa_samples = aa_samples * aa_samples;
preview_aa_samples = preview_aa_samples * preview_aa_samples;
samples = samples * samples;
preview_samples = preview_samples * preview_samples;
}
if(get_enum(cscene, "progressive") == 0) {
if(background) {
params.samples = aa_samples;

View File

@ -176,8 +176,7 @@ ccl_device_inline float4 operator/=(float4& a, float f)
ccl_device_inline int4 operator<(const float4& a, const float4& b)
{
#ifdef __KERNEL_SSE__
/* TODO(sergey): avoid cvt. */
return int4(_mm_cvtps_epi32(_mm_cmplt_ps(a.m128, b.m128)));
return int4(_mm_castps_si128(_mm_cmplt_ps(a.m128, b.m128)));
#else
return make_int4(a.x < b.x, a.y < b.y, a.z < b.z, a.w < b.w);
#endif
@ -186,8 +185,7 @@ ccl_device_inline int4 operator<(const float4& a, const float4& b)
ccl_device_inline int4 operator>=(const float4& a, const float4& b)
{
#ifdef __KERNEL_SSE__
/* TODO(sergey): avoid cvt. */
return int4(_mm_cvtps_epi32(_mm_cmpge_ps(a.m128, b.m128)));
return int4(_mm_castps_si128(_mm_cmpge_ps(a.m128, b.m128)));
#else
return make_int4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w);
#endif
@ -196,8 +194,7 @@ ccl_device_inline int4 operator>=(const float4& a, const float4& b)
ccl_device_inline int4 operator<=(const float4& a, const float4& b)
{
#ifdef __KERNEL_SSE__
/* TODO(sergey): avoid cvt. */
return int4(_mm_cvtps_epi32(_mm_cmple_ps(a.m128, b.m128)));
return int4(_mm_castps_si128(_mm_cmple_ps(a.m128, b.m128)));
#else
return make_int4(a.x <= b.x, a.y <= b.y, a.z <= b.z, a.w <= b.w);
#endif

View File

@ -106,7 +106,8 @@ const char *BKE_appdir_folder_default(void)
static char *blender_version_decimal(const int ver)
{
static char version_str[5];
sprintf(version_str, "%d.%02d", ver / 100, ver % 100);
BLI_assert(ver < 1000);
BLI_snprintf(version_str, sizeof(version_str),"%d.%02d", ver / 100, ver % 100);
return version_str;
}
@ -212,8 +213,10 @@ static bool get_path_local(
/* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */
#ifdef __APPLE__
/* due new codesign situation in OSX > 10.9.5 we must move the blender_version dir with contents to Resources */
static char osx_resourses[FILE_MAX];
sprintf(osx_resourses, "%s../Resources", bprogdir);
char osx_resourses[FILE_MAX];
BLI_snprintf(osx_resourses, sizeof(osx_resourses), "%s../Resources", bprogdir);
/* Remove the '/../' added above. */
BLI_cleanup_path(NULL, osx_resourses);
return test_path(targetpath, targetpath_len, osx_resourses, blender_version_decimal(ver), relfolder);
#else
return test_path(targetpath, targetpath_len, bprogdir, blender_version_decimal(ver), relfolder);
@ -591,6 +594,9 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
else {
BLI_path_program_search(fullname, maxlen, name);
}
/* Remove "/./" and "/../" so string comparisons can be used on the path. */
BLI_cleanup_path(NULL, fullname);
#if defined(DEBUG)
if (!STREQ(name, fullname)) {
printf("guessing '%s' == '%s'\n", name, fullname);

View File

@ -656,7 +656,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
}
/* Update ID refcount, remap pointers to self in new ID. */
struct IDCopyLibManagementData data = {.id_src=id, .flag=flag};
struct IDCopyLibManagementData data = {.id_src = id, .flag = flag};
BKE_library_foreach_ID_link(bmain, *r_newid, id_copy_libmanagement_cb, &data, IDWALK_NOP);
/* Do not make new copy local in case we are copying outside of main...

View File

@ -337,14 +337,14 @@ void BKE_object_free_derived_caches(Object *ob)
Mesh *me = ob->data;
if (me && me->bb) {
atomic_fetch_and_or_uint32((uint*)&me->bb->flag, BOUNDBOX_DIRTY);
atomic_fetch_and_or_uint32((uint *)&me->bb->flag, BOUNDBOX_DIRTY);
}
}
else if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
Curve *cu = ob->data;
if (cu && cu->bb) {
atomic_fetch_and_or_uint32((uint*)&cu->bb->flag, BOUNDBOX_DIRTY);
atomic_fetch_and_or_uint32((uint *)&cu->bb->flag, BOUNDBOX_DIRTY);
}
}

View File

@ -312,7 +312,7 @@ AutoTrackContext *BKE_autotrack_context_new(MovieClip *clip,
int num_total_tracks = BLI_listbase_count(tracksbase);
context->tracks =
MEM_callocN(sizeof(MovieTrackingTrack*) * num_total_tracks,
MEM_callocN(sizeof(MovieTrackingTrack *) * num_total_tracks,
"auto track pointers");
context->image_accessor =

View File

@ -481,7 +481,8 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
return vfd;
}
static void *vfontdata_copy_characters_value_cb(const void *src) {
static void *vfontdata_copy_characters_value_cb(const void *src)
{
return BLI_vfontchar_copy(src, 0);
}

View File

@ -61,4 +61,6 @@ endif()
blender_add_lib(bf_blentranslation "${SRC}" "${INC}" "${INC_SYS}")
add_subdirectory(msgfmt)
if(WITH_INTERNATIONAL)
add_subdirectory(msgfmt)
endif()

View File

@ -452,7 +452,8 @@ static int make(const char *input_file_name, const char *output_file_name)
return EXIT_SUCCESS;
}
int main(int argc, char **argv) {
int main(int argc, char **argv)
{
if (argc != 3) {
printf("Usage: %s <input.po> <output.mo>\n", argv[0]);
return EXIT_FAILURE;

View File

@ -6793,8 +6793,8 @@ static bool ui_but_menu(bContext *C, uiBut *but)
/* set the prop and pointer data for python access to the hovered ui element; TODO, index could be supported as well*/
PointerRNA temp_ptr;
RNA_pointer_create(NULL, &RNA_Property, but->rnaprop, &temp_ptr);
uiLayoutSetContextPointer(layout,"button_prop", &temp_ptr);
uiLayoutSetContextPointer(layout,"button_pointer", ptr);
uiLayoutSetContextPointer(layout, "button_prop", &temp_ptr);
uiLayoutSetContextPointer(layout, "button_pointer", ptr);
/* second slower test, saved people finding keyframe items in menus when its not possible */
if (is_anim)
@ -7013,8 +7013,9 @@ static bool ui_but_menu(bContext *C, uiBut *but)
}
/* Set the operator pointer for python access */
if (but->opptr)
uiLayoutSetContextPointer(layout,"button_operator", but->opptr);
if (but->opptr) {
uiLayoutSetContextPointer(layout, "button_operator", but->opptr);
}
uiItemS(layout);
}

View File

@ -172,8 +172,8 @@ static void iter_snap_objects(
for (Base *base = sctx->scene_layer->object_bases.first; base != NULL; base = base->next) {
if ((BASE_VISIBLE_NEW(base)) && (base->flag_legacy & (BA_HAS_RECALC_OB | BA_HAS_RECALC_DATA)) == 0 &&
!((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
(snap_select == SNAP_NOT_ACTIVE && base == base_act)))
!((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
(snap_select == SNAP_NOT_ACTIVE && base == base_act)))
{
bool use_obedit;
Object *obj = base->object;
@ -409,7 +409,7 @@ static bool raycastDerivedMesh(
if (bb) {
/* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
if (!isect_ray_aabb_v3_simple(
ray_start_local, ray_normal_local, bb->vec[0], bb->vec[6], &len_diff, NULL))
ray_start_local, ray_normal_local, bb->vec[0], bb->vec[6], &len_diff, NULL))
{
return retval;
}
@ -478,8 +478,7 @@ static bool raycastDerivedMesh(
if (len_diff == 0.0f) { /* do_ray_start_correction */
/* We *need* a reasonably valid len_diff in this case.
* Get the distance to bvhtree root */
if (!isect_ray_bvhroot_v3(treedata->tree, ray_start_local, ray_normal_local, &len_diff))
{
if (!isect_ray_bvhroot_v3(treedata->tree, ray_start_local, ray_normal_local, &len_diff)) {
return retval;
}
}
@ -521,8 +520,8 @@ static bool raycastDerivedMesh(
BVHTreeRayHit hit = {.index = -1, .dist = local_depth};
if (BLI_bvhtree_ray_cast(
treedata->tree, ray_start_local, ray_normal_local, 0.0f,
&hit, treedata->raycast_callback, treedata) != -1)
treedata->tree, ray_start_local, ray_normal_local, 0.0f,
&hit, treedata->raycast_callback, treedata) != -1)
{
hit.dist += len_diff;
hit.dist /= local_scale;
@ -635,8 +634,7 @@ static bool raycastEditMesh(
if (sctx->use_v3d && !((RegionView3D *)sctx->v3d_data.ar->regiondata)->is_persp) { /* do_ray_start_correction */
/* We *need* a reasonably valid len_diff in this case.
* Get the distance to bvhtree root */
if (!isect_ray_bvhroot_v3(treedata->tree, ray_start_local, ray_normal_local, &len_diff))
{
if (!isect_ray_bvhroot_v3(treedata->tree, ray_start_local, ray_normal_local, &len_diff)) {
return retval;
}
/* You need to make sure that ray_start is really far away,

View File

@ -146,7 +146,7 @@ bool MOD_meshcache_read_pc2_index(FILE *fp,
return false;
}
if (fseek(fp, sizeof(float) * 3 * index * pc2_head.verts_tot , SEEK_CUR) != 0) {
if (fseek(fp, sizeof(float) * 3 * index * pc2_head.verts_tot, SEEK_CUR) != 0) {
*err_str = "Failed to seek frame";
return false;
}

View File

@ -457,7 +457,7 @@ void wm_file_read_report(bContext *C)
* Logic shared between #WM_file_read & #wm_homefile_read,
* updates to make after reading a file.
*/
static void wm_file_read_post(bContext *C, bool is_startup_file)
static void wm_file_read_post(bContext *C, const bool is_startup_file, const bool use_userdef)
{
bool addons_loaded = false;
wmWindowManager *wm = CTX_wm_manager(C);
@ -476,13 +476,14 @@ static void wm_file_read_post(bContext *C, bool is_startup_file)
if (is_startup_file) {
/* possible python hasn't been initialized */
if (CTX_py_init_get(C)) {
/* Only run when we have a template path found. */
if (BKE_appdir_app_template_any()) {
BPY_execute_string(C, "__import__('bl_app_template_utils').reset()");
if (use_userdef) {
/* Only run when we have a template path found. */
if (BKE_appdir_app_template_any()) {
BPY_execute_string(C, "__import__('bl_app_template_utils').reset()");
}
/* sync addons, these may have changed from the defaults */
BPY_execute_string(C, "__import__('addon_utils').reset_all()");
}
/* sync addons, these may have changed from the defaults */
BPY_execute_string(C, "__import__('addon_utils').reset_all()");
BPY_python_reset(C);
addons_loaded = true;
}
@ -596,7 +597,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
}
}
wm_file_read_post(C, false);
wm_file_read_post(C, false, false);
success = true;
}
@ -644,13 +645,15 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
*
* \param use_factory_settings: Ignore on-disk startup file, use bundled ``datatoc_startup_blend`` instead.
* Used for "Restore Factory Settings".
* \param use_userdef: Load factory settings as well as startup file.
* Disabled for "File New" we don't want to reload preferences.
* \param filepath_startup_override: Optional path pointing to an alternative blend file (may be NULL).
* \param app_template_override: Template to use instead of the template defined in user-preferences.
* When not-null, this is written into the user preferences.
*/
int wm_homefile_read(
bContext *C, ReportList *reports,
bool use_factory_settings, bool use_empty_data,
bool use_factory_settings, bool use_empty_data, bool use_userdef,
const char *filepath_startup_override, const char *app_template_override)
{
ListBase wmbase;
@ -674,7 +677,7 @@ int wm_homefile_read(
* And in this case versioning code is to be run.
*/
bool read_userdef_from_memory = false;
eBLOReadSkip skip_flags = 0;
eBLOReadSkip skip_flags = use_userdef ? 0 : BLO_READ_SKIP_USERDEF;
/* options exclude eachother */
BLI_assert((use_factory_settings && filepath_startup_override) == 0);
@ -701,7 +704,9 @@ int wm_homefile_read(
if (!use_factory_settings) {
if (cfgdir) {
BLI_path_join(filepath_startup, sizeof(filepath_startup), cfgdir, BLENDER_STARTUP_FILE, NULL);
BLI_path_join(filepath_userdef, sizeof(filepath_startup), cfgdir, BLENDER_USERPREF_FILE, NULL);
if (use_userdef) {
BLI_path_join(filepath_userdef, sizeof(filepath_startup), cfgdir, BLENDER_USERPREF_FILE, NULL);
}
}
else {
use_factory_settings = true;
@ -713,14 +718,16 @@ int wm_homefile_read(
}
/* load preferences before startup.blend */
if (!use_factory_settings && BLI_exists(filepath_userdef)) {
UserDef *userdef = BKE_blendfile_userdef_read(filepath_userdef, NULL);
if (userdef != NULL) {
BKE_blender_userdef_set_data(userdef);
MEM_freeN(userdef);
if (use_userdef) {
if (!use_factory_settings && BLI_exists(filepath_userdef)) {
UserDef *userdef = BKE_blendfile_userdef_read(filepath_userdef, NULL);
if (userdef != NULL) {
BKE_blender_userdef_set_data(userdef);
MEM_freeN(userdef);
skip_flags |= BLO_READ_SKIP_USERDEF;
printf("Read prefs: %s\n", filepath_userdef);
skip_flags |= BLO_READ_SKIP_USERDEF;
printf("Read prefs: %s\n", filepath_userdef);
}
}
}
@ -780,8 +787,12 @@ int wm_homefile_read(
success = BKE_blendfile_read_from_memory(
C, datatoc_startup_blend, datatoc_startup_blend_size,
NULL, skip_flags, true);
if (success && !(skip_flags & BLO_READ_SKIP_USERDEF)) {
read_userdef_from_memory = true;
if (success) {
if (use_userdef) {
if ((skip_flags & BLO_READ_SKIP_USERDEF) == 0) {
read_userdef_from_memory = true;
}
}
}
if (BLI_listbase_is_empty(&wmbase)) {
wm_clear_default_size(C);
@ -809,21 +820,23 @@ int wm_homefile_read(
BLI_path_join(temp_path, sizeof(temp_path), app_template_system, BLENDER_USERPREF_FILE, NULL);
}
UserDef *userdef_template = NULL;
/* just avoids missing file warning */
if (BLI_exists(temp_path)) {
userdef_template = BKE_blendfile_userdef_read(temp_path, NULL);
}
if (userdef_template == NULL) {
/* we need to have preferences load to overwrite preferences from previous template */
userdef_template = BKE_blendfile_userdef_read_from_memory(
datatoc_startup_blend, datatoc_startup_blend_size, NULL);
read_userdef_from_memory = true;
}
if (userdef_template) {
BKE_blender_userdef_set_app_template(userdef_template);
BKE_blender_userdef_free_data(userdef_template);
MEM_freeN(userdef_template);
if (use_userdef) {
UserDef *userdef_template = NULL;
/* just avoids missing file warning */
if (BLI_exists(temp_path)) {
userdef_template = BKE_blendfile_userdef_read(temp_path, NULL);
}
if (userdef_template == NULL) {
/* we need to have preferences load to overwrite preferences from previous template */
userdef_template = BKE_blendfile_userdef_read_from_memory(
datatoc_startup_blend, datatoc_startup_blend_size, NULL);
read_userdef_from_memory = true;
}
if (userdef_template) {
BKE_blender_userdef_set_app_template(userdef_template);
BKE_blender_userdef_free_data(userdef_template);
MEM_freeN(userdef_template);
}
}
}
@ -834,9 +847,11 @@ int wm_homefile_read(
/* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise
* can remove this eventually, only in a 2.53 and older, now its not written */
G.fileflags &= ~G_FILE_RELATIVE_REMAP;
/* check userdef before open window, keymaps etc */
wm_init_userdef(CTX_data_main(C), read_userdef_from_memory);
if (use_userdef) {
/* check userdef before open window, keymaps etc */
wm_init_userdef(CTX_data_main(C), read_userdef_from_memory);
}
/* match the read WM with current WM */
wm_window_match_do(C, &wmbase);
@ -844,9 +859,11 @@ int wm_homefile_read(
G.main->name[0] = '\0';
/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
if (!G.background) {
GPU_default_lights();
if (use_userdef) {
/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
if (!G.background) {
GPU_default_lights();
}
}
/* start with save preference untitled.blend */
@ -854,7 +871,7 @@ int wm_homefile_read(
/* disable auto-play in startup.blend... */
G.fileflags &= ~G_FILE_AUTOPLAY;
wm_file_read_post(C, true);
wm_file_read_post(C, true, use_userdef);
return true;
}
@ -1576,6 +1593,7 @@ void WM_OT_read_history(wmOperatorType *ot)
static int wm_homefile_read_exec(bContext *C, wmOperator *op)
{
const bool use_factory_settings = (STREQ(op->type->idname, "WM_OT_read_factory_settings"));
bool use_userdef = false;
char filepath_buf[FILE_MAX];
const char *filepath = NULL;
@ -1599,6 +1617,8 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
else {
/* always load UI for factory settings (prefs will re-init) */
G.fileflags &= ~G_FILE_NO_UI;
/* Always load preferences with factory settings. */
use_userdef = true;
}
char app_template_buf[sizeof(U.app_template)];
@ -1610,17 +1630,15 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
if (prop_app_template && RNA_property_is_set(op->ptr, prop_app_template)) {
RNA_property_string_get(op->ptr, prop_app_template, app_template_buf);
app_template = app_template_buf;
}
else if (!use_factory_settings) {
/* TODO: dont reset prefs on 'New File' */
BLI_strncpy(app_template_buf, U.app_template, sizeof(app_template_buf));
app_template = app_template_buf;
/* Always load preferences when switching templates. */
use_userdef = true;
}
else {
app_template = NULL;
}
if (wm_homefile_read(C, op->reports, use_factory_settings, use_empty_data, filepath, app_template)) {
if (wm_homefile_read(C, op->reports, use_factory_settings, use_empty_data, use_userdef, filepath, app_template)) {
if (use_splash) {
WM_init_splash(C);
}

View File

@ -197,7 +197,7 @@ void WM_init(bContext *C, int argc, const char **argv)
wm_init_reports(C);
/* get the default database, plus a wm */
wm_homefile_read(C, NULL, G.factory_startup, false, NULL, NULL);
wm_homefile_read(C, NULL, G.factory_startup, false, true, NULL, NULL);
BLT_lang_set(NULL);

View File

@ -37,7 +37,7 @@ struct wmOperatorType;
void wm_history_file_read(void);
int wm_homefile_read(
struct bContext *C, struct ReportList *reports,
bool use_factory_settings, bool use_empty_data,
bool use_factory_settings, bool use_empty_data, bool use_userdef,
const char *filepath_startup_override, const char *app_template_override);
void wm_file_read_report(bContext *C);

View File

@ -534,6 +534,7 @@ if(WITH_CYCLES)
if(WITH_OPENGL_TESTS)
add_cycles_render_test(opengl)
endif()
add_cycles_render_test(denoise)
add_cycles_render_test(displacement)
add_cycles_render_test(image_data_types)
add_cycles_render_test(image_mapping)

View File

@ -222,6 +222,14 @@ class Report:
def verify_output(report, filepath):
ref_img, new_img, diff_img = test_get_images(filepath)
# copy new image
if os.path.exists(new_img):
os.remove(new_img)
if os.path.exists(TEMP_FILE):
shutil.copy(TEMP_FILE, new_img)
if not os.path.exists(ref_img):
return False
@ -256,12 +264,6 @@ def verify_output(report, filepath):
if VERBOSE:
print_message(e.output.decode("utf-8"))
# copy new image
if os.path.exists(new_img):
os.remove(new_img)
if os.path.exists(TEMP_FILE):
shutil.copy(TEMP_FILE, new_img)
return not failed