Fix T47377: Newer file crashes at render on official 2.76b version

Really annoying bug, the code was not forward compatible at all and
resulted in crash. And it is really good to keep at least one release
forward compatibility so possible regressions could be verified easily.

The idea now is to use new property name for the pixel filter type,
but keep old property around for a couple of releases, so we have at
least some forward compatibility.

Don't like this situation at all, but seems it's least of the evil
we can choose.

Thanks Brecht for the review!
This commit is contained in:
Sergey Sharybin 2016-02-10 04:00:29 +05:00
parent d6e936254e
commit 5a45ccaf3e
5 changed files with 26 additions and 5 deletions

@ -376,12 +376,24 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=False,
)
# Really annoyingly, we have to keep it around for a few releases,
# otherwise forward compatibility breaks in really bad manner: CRASH!
#
# TODO(sergey): Remove this during 2.8x series of Blender.
cls.filter_type = EnumProperty(
name="Filter Type",
description="Pixel filter type",
items=enum_filter_types,
default='BLACKMAN_HARRIS',
)
cls.pixel_filter_type = EnumProperty(
name="Filter Type",
description="Pixel filter type",
items=enum_filter_types,
default='BLACKMAN_HARRIS',
)
cls.filter_width = FloatProperty(
name="Filter Width",
description="Pixel filter width",

@ -329,8 +329,8 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
col = split.column()
sub = col.column(align=True)
sub.prop(cscene, "filter_type", text="")
if cscene.filter_type != 'BOX':
sub.prop(cscene, "pixel_filter_type", text="")
if cscene.pixel_filter_type != 'BOX':
sub.prop(cscene, "filter_width", text="Width")

@ -235,7 +235,7 @@ def do_versions(self):
# Filter
if not cscene.is_property_set("filter_type"):
cscene.filter_type = 'GAUSSIAN'
cscene.pixel_filter_type = 'GAUSSIAN'
# Tile Order
if not cscene.is_property_set("tile_order"):
@ -270,3 +270,12 @@ def do_versions(self):
# World MIS Resolution
if not cworld.is_property_set("sample_map_resolution"):
cworld.sample_map_resolution = 256
if bpy.data.version <= (2, 76, 10):
for scene in bpy.data.scenes:
cscene = scene.cycles
if cscene.is_property_set("filter_type"):
if not cscene.is_property_set("pixel_filter_type"):
cscene.pixel_filter_type = cscene.filter_type
if cscene.filter_type == 'BLACKMAN_HARRIS':
cscene.filter_type = 'GAUSSIAN'

@ -287,7 +287,7 @@ void BlenderSync::sync_film()
film->use_sample_clamp = (integrator->sample_clamp_direct != 0.0f || integrator->sample_clamp_indirect != 0.0f);
film->exposure = get_float(cscene, "film_exposure");
film->filter_type = (FilterType)get_enum(cscene, "filter_type");
film->filter_type = (FilterType)get_enum(cscene, "pixel_filter_type");
film->filter_width = (film->filter_type == FILTER_BOX)? 1.0f: get_float(cscene, "filter_width");
if(b_scene.world()) {

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 276
#define BLENDER_SUBVERSION 10
#define BLENDER_SUBVERSION 11
/* Several breakages with 270, e.g. constraint deg vs rad */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 6