Cycles: Make Blender importer more forward compatible

Basically the idea is to make code robust against extending
enum options in the future by falling back to a known safe
default setting when RNA is set to something unknown.

While this approach solves the issues similar to T47377,
but it wouldn't really help when/if any of the RNA values
gets ever deprecated and removed. There'll be no simple
solution to that apart from defining explicit mapping from
RNA value to Cycles one.

Another part which isn't so great actually is that we now
have to have some enum guards and give some explicit values
to the enum items, but we can live with that perhaps.

Reviewers: dingto, juicyfruit, lukasstockner97, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D1785
This commit is contained in:
Sergey Sharybin
2016-02-10 15:09:45 +01:00
parent ec9977855f
commit 28604c46a1
17 changed files with 200 additions and 98 deletions

View File

@@ -40,11 +40,13 @@ public:
/* Specifies an offset for the shutter's time interval. */
enum MotionPosition {
/* Shutter opens at the current frame. */
MOTION_POSITION_START,
MOTION_POSITION_START = 0,
/* Shutter is fully open at the current frame. */
MOTION_POSITION_CENTER,
MOTION_POSITION_CENTER = 1,
/* Shutter closes at the current frame. */
MOTION_POSITION_END,
MOTION_POSITION_END = 2,
MOTION_NUM_POSITIONS,
};
/* Specifies rolling shutter effect. */
@@ -52,7 +54,9 @@ public:
/* No rolling shutter effect. */
ROLLING_SHUTTER_NONE = 0,
/* Sensor is being scanned vertically from top to bottom. */
ROLLING_SHUTTER_TOP,
ROLLING_SHUTTER_TOP = 1,
ROLLING_SHUTTER_NUM_TYPES,
};
/* motion blur */