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/render/curves.h | |
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/render/curves.h')
-rw-r--r-- | intern/cycles/render/curves.h | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/intern/cycles/render/curves.h b/intern/cycles/render/curves.h index 22ab5d05f8a..3d9b4e1f347 100644 --- a/intern/cycles/render/curves.h +++ b/intern/cycles/render/curves.h @@ -29,28 +29,32 @@ class Scene; void curvebounds(float *lower, float *upper, float3 *p, int dim); -typedef enum curve_primitives { - CURVE_TRIANGLES, - CURVE_LINE_SEGMENTS, - CURVE_SEGMENTS, - CURVE_RIBBONS -} curve_primitives; - -typedef enum curve_shape { - CURVE_RIBBON, - CURVE_THICK -} curve_shape; - -typedef enum curve_triangles { +typedef enum CurvePrimitiveType { + CURVE_TRIANGLES = 0, + CURVE_LINE_SEGMENTS = 1, + CURVE_SEGMENTS = 2, + CURVE_RIBBONS = 3, + + CURVE_NUM_PRIMITIVE_TYPES, +} CurvePrimitiveType; + +typedef enum CurveShapeType { + CURVE_RIBBON = 0, + CURVE_THICK = 1, + + CURVE_NUM_SHAPE_TYPES, +} CurveShapeType; + +typedef enum CurveTriangleMethod { CURVE_CAMERA_TRIANGLES, CURVE_TESSELATED_TRIANGLES -} curve_triangles; +} CurveTriangleMethod; -typedef enum curve_lines { +typedef enum CurveLineMethod { CURVE_ACCURATE, CURVE_CORRECTED, CURVE_UNCORRECTED -} curve_lines; +} CurveLineMethod; class ParticleCurveData { @@ -83,10 +87,10 @@ public: class CurveSystemManager { public: - int primitive; - int curve_shape; - int line_method; - int triangle_method; + CurvePrimitiveType primitive; + CurveShapeType curve_shape; + CurveLineMethod line_method; + CurveTriangleMethod triangle_method; int resolution; int subdivisions; |