diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-09 12:49:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-09 12:49:27 +0300 |
commit | a5b4b0f21c1ae8c96e4fea9abdcfac2fab1cf300 (patch) | |
tree | 0658d8bdfb8ec03652aa04f82ee8a4d243ec6370 /intern/cycles/blender/blender_object.cpp | |
parent | d68f698cf0321477c0734474150eb4bc43c4e85f (diff) | |
parent | abcda06934aba054de8540b66b13c2bbc5f8f515 (diff) |
Merge branch '28' into custom-manipulatorscustom-manipulators
Diffstat (limited to 'intern/cycles/blender/blender_object.cpp')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 991b834dcfa..a25ae278058 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -63,8 +63,26 @@ bool BlenderSync::object_is_mesh(BL::Object& b_ob) { BL::ID b_ob_data = b_ob.data(); - return (b_ob_data && (b_ob_data.is_a(&RNA_Mesh) || - b_ob_data.is_a(&RNA_Curve) || b_ob_data.is_a(&RNA_MetaBall))); + if(!b_ob_data) { + return false; + } + + if(b_ob.type() == BL::Object::type_CURVE) { + /* Skip exporting curves without faces, overhead can be + * significant if there are many for path animation. */ + BL::Curve b_curve(b_ob.data()); + + return (b_curve.bevel_object() || + b_curve.extrude() != 0.0f || + b_curve.bevel_depth() != 0.0f || + b_curve.dimensions() == BL::Curve::dimensions_2D || + b_ob.modifiers.length()); + } + else { + return (b_ob_data.is_a(&RNA_Mesh) || + b_ob_data.is_a(&RNA_Curve) || + b_ob_data.is_a(&RNA_MetaBall)); + } } bool BlenderSync::object_is_light(BL::Object& b_ob) @@ -286,6 +304,29 @@ Object *BlenderSync::sync_object(BL::Depsgraph::duplis_iterator& b_dupli_iter, return NULL; } + /* Visibility flags for both parent and child. */ + bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0; + uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY; + + if(b_parent.ptr.data != b_ob.ptr.data) { + visibility &= object_ray_visibility(b_parent); + } + + /* Make holdout objects on excluded layer invisible for non-camera rays. */ + if(use_holdout && (layer_flag & render_layer.exclude_layer)) { + visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA); + } + + /* Hide objects not on render layer from camera rays. */ + if(!(layer_flag & render_layer.layer)) { + visibility &= ~PATH_RAY_CAMERA; + } + + /* Don't export completely invisible objects. */ + if(visibility == 0) { + return NULL; + } + /* key to lookup object */ ObjectKey key(b_parent, persistent_id, b_ob_instance); Object *object; @@ -326,8 +367,6 @@ Object *BlenderSync::sync_object(BL::Depsgraph::duplis_iterator& b_dupli_iter, if(object_map.sync(&object, b_ob, b_parent, key)) object_updated = true; - bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0; - /* mesh sync */ object->mesh = sync_mesh(b_ob, b_ob_instance, object_updated, hide_tris); @@ -340,22 +379,6 @@ Object *BlenderSync::sync_object(BL::Depsgraph::duplis_iterator& b_dupli_iter, object_updated = true; } - /* visibility flags for both parent and child */ - uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY; - if(b_parent.ptr.data != b_ob.ptr.data) { - visibility &= object_ray_visibility(b_parent); - } - - /* make holdout objects on excluded layer invisible for non-camera rays */ - if(use_holdout && (layer_flag & render_layer.exclude_layer)) { - visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA); - } - - /* hide objects not on render layer from camera rays */ - if(!(layer_flag & render_layer.layer)) { - visibility &= ~PATH_RAY_CAMERA; - } - if(visibility != object->visibility) { object->visibility = visibility; object_updated = true; @@ -519,6 +542,10 @@ void BlenderSync::sync_objects(float motion_time) ++b_dupli_iter) { BL::Object b_ob = b_dupli_iter->object(); + if(!b_ob.is_visible()) { + continue; + } + progress.set_sync_status("Synchronizing object", b_ob.name()); /* load per-object culling data */ |