Cycles: Make Blender importer more forward compatible
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 10 Feb 2016 14:09:45 +0000 (15:09 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 12 Feb 2016 14:27:33 +0000 (15:27 +0100)
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

17 files changed:
intern/cycles/blender/blender_camera.cpp
intern/cycles/blender/blender_curves.cpp
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_shader.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_util.h
intern/cycles/device/device_cuda.cpp
intern/cycles/kernel/kernel_compat_cpu.h
intern/cycles/kernel/kernel_types.h
intern/cycles/render/camera.h
intern/cycles/render/curves.h
intern/cycles/render/film.h
intern/cycles/render/integrator.h
intern/cycles/render/mesh.h
intern/cycles/render/scene.h
intern/cycles/render/shader.h
intern/cycles/util/util_types.h

index 6928fe471a302943072d3fa8df9adce5e0c0a3b9..cdbee52bfa9d0cbdac96607ca1ee598bc84c0d60 100644 (file)
@@ -158,21 +158,10 @@ static void blender_camera_from_object(BlenderCamera *bcam,
                                break;
                }
 
-               switch(get_enum(ccamera, "panorama_type")) {
-                       case 1:
-                               bcam->panorama_type = PANORAMA_FISHEYE_EQUIDISTANT;
-                               break;
-                       case 2:
-                               bcam->panorama_type = PANORAMA_FISHEYE_EQUISOLID;
-                               break;
-                       case 3:
-                               bcam->panorama_type = PANORAMA_MIRRORBALL;
-                               break;
-                       case 0:
-                       default:
-                               bcam->panorama_type = PANORAMA_EQUIRECTANGULAR;
-                               break;
-               }       
+               bcam->panorama_type = (PanoramaType)get_enum(ccamera,
+                                                            "panorama_type",
+                                                            PANORAMA_NUM_TYPES,
+                                                            PANORAMA_EQUIRECTANGULAR);
 
                bcam->fisheye_fov = RNA_float_get(&ccamera, "fisheye_fov");
                bcam->fisheye_lens = RNA_float_get(&ccamera, "fisheye_lens");
@@ -460,32 +449,16 @@ void BlenderSync::sync_camera(BL::RenderSettings& b_render,
        curvemapping_to_array(b_shutter_curve, bcam.shutter_curve, RAMP_TABLE_SIZE);
 
        PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
-       switch(get_enum(cscene, "motion_blur_position")) {
-               case 0:
-                       bcam.motion_position = Camera::MOTION_POSITION_START;
-                       break;
-               case 1:
-                       bcam.motion_position = Camera::MOTION_POSITION_CENTER;
-                       break;
-               case 2:
-                       bcam.motion_position = Camera::MOTION_POSITION_END;
-                       break;
-               default:
-                       bcam.motion_position = Camera::MOTION_POSITION_CENTER;
-                       break;
-       }
-
-       switch(get_enum(cscene, "rolling_shutter_type")) {
-               case 0:
-                       bcam.rolling_shutter_type = Camera::ROLLING_SHUTTER_NONE;
-                       break;
-               case 1:
-                       bcam.rolling_shutter_type = Camera::ROLLING_SHUTTER_TOP;
-                       break;
-               default:
-                       bcam.rolling_shutter_type = Camera::ROLLING_SHUTTER_NONE;
-                       break;
-       }
+       bcam.motion_position =
+               (Camera::MotionPosition)get_enum(cscene,
+                                                "motion_blur_position",
+                                                Camera::MOTION_NUM_POSITIONS,
+                                                Camera::MOTION_POSITION_CENTER);
+       bcam.rolling_shutter_type =
+               (Camera::RollingShutterType)get_enum(cscene,
+                                                    "rolling_shutter_type",
+                                                    Camera::ROLLING_SHUTTER_NUM_TYPES,
+                                                    Camera::ROLLING_SHUTTER_NONE);
        bcam.rolling_shutter_duration = RNA_float_get(&cscene, "rolling_shutter_duration");
 
        /* border */
index a5c0b22c4d0db97ed1d32dca1a36a06ed53d2787..0178bfbe8d913b55e596324f12135fe22f7ace70 100644 (file)
@@ -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");
index 4483f82ce07e6c2033b0978197d72bc3697194e2..9eb4626eb3c20c33f57c1334b9203903cd0e480f 100644 (file)
@@ -827,7 +827,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
 
        /* displacement method */
        if(cmesh.data) {
-               const int method = get_enum(cmesh, "displacement_method");
+               const int method = get_enum(cmesh,
+                                           "displacement_method",
+                                           Mesh::DISPLACE_NUM_METHODS,
+                                           Mesh::DISPLACE_BUMP);
 
                if(method == 0 || !experimental)
                        mesh->displacement_method = Mesh::DISPLACE_BUMP;
index b82e7dd47b77fd71cec081571c0cbd0519c0791b..3e490ed75849571c004151a67b4369dfb6fb9162 100644 (file)
@@ -51,6 +51,50 @@ void BlenderSync::find_shader(BL::ID& id,
        }
 }
 
+/* RNA translation utilities */
+
+static VolumeSampling get_volume_sampling(PointerRNA& ptr)
+{
+       return (VolumeSampling)get_enum(ptr,
+                                       "volume_sampling",
+                                       VOLUME_NUM_SAMPLING,
+                                       VOLUME_SAMPLING_DISTANCE);
+}
+
+static VolumeInterpolation get_volume_interpolation(PointerRNA& ptr)
+{
+       return (VolumeInterpolation)get_enum(ptr,
+                                            "volume_interpolation",
+                                            VOLUME_NUM_INTERPOLATION,
+                                            VOLUME_INTERPOLATION_LINEAR);
+}
+
+static int validate_enum_value(int value, int num_values, int default_value)
+{
+       if(value >= num_values) {
+               return default_value;
+       }
+       return value;
+}
+
+template<typename NodeType>
+static InterpolationType get_image_interpolation(NodeType b_node)
+{
+       int value = b_node.interpolation();
+       return (InterpolationType)validate_enum_value(value,
+                                                     INTERPOLATION_NUM_TYPES,
+                                                     INTERPOLATION_LINEAR);
+}
+
+template<typename NodeType>
+static ExtensionType get_image_extension(NodeType b_node)
+{
+       int value = b_node.extension();
+       return (ExtensionType)validate_enum_value(value,
+                                                 EXTENSION_NUM_TYPES,
+                                                 EXTENSION_REPEAT);
+}
+
 /* Graph */
 
 static BL::NodeSocket get_node_output(BL::Node& b_node, const string& name)
@@ -653,14 +697,14 @@ static ShaderNode *add_node(Scene *scene,
                                scene->image_manager->tag_reload_image(
                                        image->filename,
                                        image->builtin_data,
-                                       (InterpolationType)b_image_node.interpolation(),
-                                       (ExtensionType)b_image_node.extension());
+                                       get_image_interpolation(b_image_node),
+                                       get_image_extension(b_image_node));
                        }
                }
                image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
                image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
-               image->interpolation = (InterpolationType)b_image_node.interpolation();
-               image->extension = (ExtensionType)b_image_node.extension();
+               image->interpolation = get_image_interpolation(b_image_node);
+               image->extension = get_image_extension(b_image_node);
                image->projection_blend = b_image_node.projection_blend();
                BL::TexMapping b_texture_mapping(b_image_node.texture_mapping());
                get_tex_mapping(&image->tex_mapping, b_texture_mapping);
@@ -696,14 +740,15 @@ static ShaderNode *add_node(Scene *scene,
 
                        /* TODO(sergey): Does not work properly when we change builtin type. */
                        if(b_image.is_updated()) {
-                               scene->image_manager->tag_reload_image(env->filename,
-                                                                      env->builtin_data,
-                                                                      (InterpolationType)b_env_node.interpolation(),
-                                                                      EXTENSION_REPEAT);
+                               scene->image_manager->tag_reload_image(
+                                       env->filename,
+                                       env->builtin_data,
+                                       get_image_interpolation(b_env_node),
+                                       EXTENSION_REPEAT);
                        }
                }
                env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
-               env->interpolation = (InterpolationType)b_env_node.interpolation();
+               env->interpolation = get_image_interpolation(b_env_node);
                env->projection = EnvironmentTextureNode::projection_enum[(int)b_env_node.projection()];
                BL::TexMapping b_texture_mapping(b_env_node.texture_mapping());
                get_tex_mapping(&env->tex_mapping, b_texture_mapping);
@@ -824,8 +869,7 @@ static ShaderNode *add_node(Scene *scene,
                point_density->filename = b_point_density_node.name();
                point_density->space =
                        PointDensityTextureNode::space_enum[(int)b_point_density_node.space()];
-               point_density->interpolation =
-                       (InterpolationType)b_point_density_node.interpolation();
+               point_density->interpolation = get_image_interpolation(b_point_density_node);
                point_density->builtin_data = b_point_density_node.ptr.data;
 
                /* 1 - render settings, 0 - vewport settings. */
@@ -1200,8 +1244,8 @@ void BlenderSync::sync_materials(bool update_all)
                        shader->use_mis = get_boolean(cmat, "sample_as_light");
                        shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow");
                        shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume");
-                       shader->volume_sampling_method = (VolumeSampling)get_enum(cmat, "volume_sampling");
-                       shader->volume_interpolation_method = (VolumeInterpolation)get_enum(cmat, "volume_interpolation");
+                       shader->volume_sampling_method = get_volume_sampling(cmat);
+                       shader->volume_interpolation_method = get_volume_interpolation(cmat);
 
                        shader->set_graph(graph);
                        shader->tag_update(scene);
@@ -1231,8 +1275,8 @@ void BlenderSync::sync_world(bool update_all)
                        /* volume */
                        PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
                        shader->heterogeneous_volume = !get_boolean(cworld, "homogeneous_volume");
-                       shader->volume_sampling_method = (VolumeSampling)get_enum(cworld, "volume_sampling");
-                       shader->volume_interpolation_method = (VolumeInterpolation)get_enum(cworld, "volume_interpolation");
+                       shader->volume_sampling_method = get_volume_sampling(cworld);
+                       shader->volume_interpolation_method = get_volume_interpolation(cworld);
                }
                else if(b_world) {
                        ShaderNode *closure, *out;
index 7901d4b8be196ea00f659167fe7e2768d1fefeee..a3cccc62eb4f14fe5e197898771ba7d59277d860 100644 (file)
@@ -220,7 +220,11 @@ void BlenderSync::sync_integrator()
        if(get_boolean(cscene, "use_animated_seed"))
                integrator->seed = hash_int_2d(b_scene.frame_current(), get_int(cscene, "seed"));
 
-       integrator->sampling_pattern = (SamplingPattern)get_enum(cscene, "sampling_pattern");
+       integrator->sampling_pattern = (SamplingPattern)get_enum(
+               cscene,
+               "sampling_pattern",
+               SAMPLING_NUM_PATTERNS,
+               SAMPLING_PATTERN_SOBOL);
 
        integrator->layer_flag = render_layer.layer;
 
@@ -237,7 +241,10 @@ void BlenderSync::sync_integrator()
        }
 #endif
 
-       integrator->method = (Integrator::Method)get_enum(cscene, "progressive");
+       integrator->method = (Integrator::Method)get_enum(cscene,
+                                                         "progressive",
+                                                         Integrator::NUM_METHODS,
+                                                         Integrator::PATH);
 
        integrator->sample_all_lights_direct = get_boolean(cscene, "sample_all_lights_direct");
        integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect");
@@ -287,7 +294,10 @@ 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, "pixel_filter_type");
+       film->filter_type = (FilterType)get_enum(cscene,
+                                                "pixel_filter_type",
+                                                FILTER_NUM_TYPES,
+                                                FILTER_BLACKMAN_HARRIS);
        film->filter_width = (film->filter_type == FILTER_BOX)? 1.0f: get_float(cscene, "filter_width");
 
        if(b_scene.world()) {
@@ -440,7 +450,11 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
        if(background)
                params.bvh_type = SceneParams::BVH_STATIC;
        else
-               params.bvh_type = (SceneParams::BVHType)get_enum(cscene, "debug_bvh_type");
+               params.bvh_type = (SceneParams::BVHType)get_enum(
+                       cscene,
+                       "debug_bvh_type",
+                       SceneParams::BVH_NUM_TYPES,
+                       SceneParams::BVH_STATIC);
 
        params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
 
index 06176b2d28994a5eecd16281097d127bde55ecb9..cefc01bfa91dd833527736a1daba80eff39e7503 100644 (file)
@@ -357,9 +357,24 @@ static inline void set_int(PointerRNA& ptr, const char *name, int value)
        RNA_int_set(&ptr, name, value);
 }
 
-static inline int get_enum(PointerRNA& ptr, const char *name)
-{
-       return RNA_enum_get(&ptr, name);
+/* Get a RNA enum value with sanity check: if the RNA value is above num_values
+ * the function will return a fallback default value.
+ *
+ * NOTE: This function assumes that RNA enum values are a continuous sequence
+ * from 0 to num_values-1. Be careful to use it with enums where some values are
+ * deprecated!
+ */
+static inline int get_enum(PointerRNA& ptr,
+                           const char *name,
+                           int num_values = -1,
+                           int default_value = -1)
+{
+       int value = RNA_enum_get(&ptr, name);
+       if(num_values != -1 && value >= num_values) {
+               assert(default_value != -1);
+               value = default_value;
+       }
+       return value;
 }
 
 static inline string get_enum_identifier(PointerRNA& ptr, const char *name)
index 8bef6c9b40c78b108e75b17c2939c1fb39e9989f..3e3cd7515c70d9d16d129b06320c9b844d4095e4 100644 (file)
@@ -579,6 +579,8 @@ public:
                                        cuda_assert(cuTexRefSetAddressMode(texref, 0, CU_TR_ADDRESS_MODE_BORDER));
                                        cuda_assert(cuTexRefSetAddressMode(texref, 1, CU_TR_ADDRESS_MODE_BORDER));
                                        break;
+                               default:
+                                       assert(0);
                        }
                        cuda_assert(cuTexRefSetFormat(texref, format, mem.data_elements));
 
index baa67f63ab3b81c66694bb06d0cb2da03c6c19c3..df7d39532aa17dd4e0f2834c20edebd95efedd23 100644 (file)
@@ -152,6 +152,8 @@ template<typename T> struct texture_image  {
                                        ix = wrap_clamp(ix, width);
                                        iy = wrap_clamp(iy, height);
                                        break;
+                               default:
+                                       kernel_assert(0);
                        }
                        return read(data[ix + iy*width]);
                }
@@ -179,6 +181,8 @@ template<typename T> struct texture_image  {
                                        ix = wrap_clamp(ix, width);
                                        iy = wrap_clamp(iy, height);
                                        break;
+                               default:
+                                       kernel_assert(0);
                        }
 
                        float4 r = (1.0f - ty)*(1.0f - tx)*read(data[ix + iy*width]);
@@ -225,6 +229,8 @@ template<typename T> struct texture_image  {
                                        ix = wrap_clamp(ix, width);
                                        iy = wrap_clamp(iy, height);
                                        break;
+                               default:
+                                       kernel_assert(0);
                        }
 
                        const int xc[4] = {pix, ix, nix, nnix};
@@ -290,6 +296,8 @@ template<typename T> struct texture_image  {
                                        iy = wrap_clamp(iy, height);
                                        iz = wrap_clamp(iz, depth);
                                        break;
+                               default:
+                                       kernel_assert(0);
                        }
 
                        return read(data[ix + iy*width + iz*width*height]);
@@ -325,6 +333,8 @@ template<typename T> struct texture_image  {
                                        iy = wrap_clamp(iy, height);
                                        iz = wrap_clamp(iz, depth);
                                        break;
+                               default:
+                                       kernel_assert(0);
                        }
 
                        float4 r;
@@ -390,6 +400,8 @@ template<typename T> struct texture_image  {
                                        iy = wrap_clamp(iy, height);
                                        iz = wrap_clamp(iz, depth);
                                        break;
+                               default:
+                                       kernel_assert(0);
                        }
 
                        const int xc[4] = {pix, ix, nix, nnix};
index 42d40e1daee7f23a9ad8f1cbece71d4049ed57c5..bdd17c66c0f1fef54a5a9fde8fab48f7980bef32 100644 (file)
@@ -264,7 +264,9 @@ enum PathTraceDimension {
 
 enum SamplingPattern {
        SAMPLING_PATTERN_SOBOL = 0,
-       SAMPLING_PATTERN_CMJ = 1
+       SAMPLING_PATTERN_CMJ = 1,
+
+       SAMPLING_NUM_PATTERNS,
 };
 
 /* these flags values correspond to raytypes in osl.cpp, so keep them in sync!
@@ -482,10 +484,12 @@ enum CameraType {
 /* Panorama Type */
 
 enum PanoramaType {
-       PANORAMA_EQUIRECTANGULAR,
-       PANORAMA_MIRRORBALL,
-       PANORAMA_FISHEYE_EQUIDISTANT,
-       PANORAMA_FISHEYE_EQUISOLID
+       PANORAMA_EQUIRECTANGULAR = 0,
+       PANORAMA_FISHEYE_EQUIDISTANT = 1,
+       PANORAMA_FISHEYE_EQUISOLID = 2,
+       PANORAMA_MIRRORBALL = 3,
+
+       PANORAMA_NUM_TYPES,
 };
 
 /* Differential */
index d4a66b660720ec061360e58198ee0291593c93df..6771ecc8f23ba739cebead949e95dfec094b1d1b 100644 (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 */
index 22ab5d05f8aa7d8987ccf40896431da837a8e93e..3d9b4e1f347d8360d5d04c57f79b2305df4d00cd 100644 (file)
@@ -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;
 
index 0fde9287969834109a903955bb25872595fc9582..966e00a8d1fa4a2ac469a7c1ef128cc9bfaa6ec4 100644 (file)
@@ -31,7 +31,9 @@ class Scene;
 typedef enum FilterType {
        FILTER_BOX,
        FILTER_GAUSSIAN,
-       FILTER_BLACKMAN_HARRIS
+       FILTER_BLACKMAN_HARRIS,
+
+       FILTER_NUM_TYPES,
 } FilterType;
 
 class Pass {
index fd2ad14488dd3daae8242086b9b0198b70f2bff9..bb4e9c7056f1fc223284a97b7279e4c37687a7e1 100644 (file)
@@ -66,7 +66,9 @@ public:
 
        enum Method {
                BRANCHED_PATH = 0,
-               PATH = 1
+               PATH = 1,
+
+               NUM_METHODS,
        };
        
        Method method;
index 76c186a3febf3b6e6fea1661e7b816b2f7ba9458..13528bfa7bb3811f924e123cecbecb9be9f7ea0f 100644 (file)
@@ -63,9 +63,11 @@ public:
 
        /* Displacement */
        enum DisplacementMethod {
-               DISPLACE_BUMP,
-               DISPLACE_TRUE,
-               DISPLACE_BOTH
+               DISPLACE_BUMP = 0,
+               DISPLACE_TRUE = 1,
+               DISPLACE_BOTH = 2,
+
+               DISPLACE_NUM_METHODS,
        };
 
        ustring name;
index a1ff6809f67d22f6e662fbe0c60deca8b2efce21..74976c1513c5a1a39f13d25134a7b4305946ca28 100644 (file)
@@ -125,7 +125,12 @@ public:
 class SceneParams {
 public:
        ShadingSystem shadingsystem;
-       enum BVHType { BVH_DYNAMIC, BVH_STATIC } bvh_type;
+       enum BVHType {
+               BVH_DYNAMIC = 0,
+               BVH_STATIC = 1,
+
+               BVH_NUM_TYPES,
+       } bvh_type;
        bool use_bvh_spatial_split;
        bool use_qbvh;
        bool persistent_data;
index 6f4fd0e779790a32d24fc8aa53ef556cf2e6c75d..8b3969de88e7989684e285606313a23872c699aa 100644 (file)
@@ -53,11 +53,15 @@ enum VolumeSampling {
        VOLUME_SAMPLING_DISTANCE = 0,
        VOLUME_SAMPLING_EQUIANGULAR = 1,
        VOLUME_SAMPLING_MULTIPLE_IMPORTANCE = 2,
+
+       VOLUME_NUM_SAMPLING,
 };
 
 enum VolumeInterpolation {
        VOLUME_INTERPOLATION_LINEAR = 0,
        VOLUME_INTERPOLATION_CUBIC = 1,
+
+       VOLUME_NUM_INTERPOLATION,
 };
 
 /* Shader describing the appearance of a Mesh, Light or Background.
index 6f474f873a60b1cd4db4b17cabf94f605319b597..972befa185b103a1212d83711549a1a48a152ae4 100644 (file)
@@ -468,6 +468,8 @@ enum InterpolationType {
        INTERPOLATION_CLOSEST = 1,
        INTERPOLATION_CUBIC = 2,
        INTERPOLATION_SMART = 3,
+
+       INTERPOLATION_NUM_TYPES,
 };
 
 /* Extension types for textures.
@@ -481,6 +483,8 @@ enum ExtensionType {
        EXTENSION_EXTEND = 1,
        /* Clip to image size and set exterior pixels as transparent. */
        EXTENSION_CLIP = 2,
+
+       EXTENSION_NUM_TYPES,
 };
 
 /* macros */