diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-10 17:09:45 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-12 17:27:33 +0300 |
commit | 28604c46a137c1288cc7a494b36ed72e44a0ab8b (patch) | |
tree | 3ce7de49d1604cdec2ce420a117ae1ab59df2404 /intern/cycles/blender/blender_curves.cpp | |
parent | ec9977855f9264ecf6af5b4c8e6d10324a02028e (diff) |
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
Diffstat (limited to 'intern/cycles/blender/blender_curves.cpp')
-rw-r--r-- | intern/cycles/blender/blender_curves.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index a5c0b22c4d0..0178bfbe8d9 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -795,8 +795,16 @@ void BlenderSync::sync_curve_settings() curve_system_manager->minimum_width = get_float(csscene, "minimum_width"); curve_system_manager->maximum_width = get_float(csscene, "maximum_width"); - curve_system_manager->primitive = get_enum(csscene, "primitive"); - curve_system_manager->curve_shape = get_enum(csscene, "shape"); + curve_system_manager->primitive = + (CurvePrimitiveType)get_enum(csscene, + "primitive", + CURVE_NUM_PRIMITIVE_TYPES, + CURVE_LINE_SEGMENTS); + curve_system_manager->curve_shape = + (CurveShapeType)get_enum(csscene, + "shape", + CURVE_NUM_SHAPE_TYPES, + CURVE_THICK); curve_system_manager->resolution = get_int(csscene, "resolution"); curve_system_manager->subdivisions = get_int(csscene, "subdivisions"); curve_system_manager->use_backfacing = !get_boolean(csscene, "cull_backfacing"); |