bool BlenderSync::object_is_mesh(BL::Object& b_ob) { BL::ID b_ob_data = b_ob.data(); 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)); } }
CCL_NAMESPACE_BEGIN /* Utilities */ bool BlenderSync::BKE_object_is_modified(BL::Object& b_ob) { /* test if we can instance or if the object is modified */ if(b_ob.type() == BL::Object::type_META) { /* multi-user and dupli metaballs are fused, can't instance */ return true; } else if(ccl::BKE_object_is_modified(b_ob, b_scene, preview)) { /* modifiers */ return true; } else { /* object level material links */ BL::Object::material_slots_iterator slot; for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) if(slot->link() == BL::MaterialSlot::link_OBJECT) return true; } return false; }
static bool object_render_hide(BL::Object b_ob, bool top_level, bool parent_hide, bool& hide_triangles) { /* check if we should render or hide particle emitter */ BL::Object::particle_systems_iterator b_psys; bool hair_present = false; bool show_emitter = false; bool hide_emitter = false; bool hide_as_dupli_parent = false; bool hide_as_dupli_child_original = false; for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) { if((b_psys->settings().render_type() == BL::ParticleSettings::render_type_PATH) && (b_psys->settings().type()==BL::ParticleSettings::type_HAIR)) hair_present = true; if(b_psys->settings().use_render_emitter()) show_emitter = true; else hide_emitter = true; } if(show_emitter) hide_emitter = false; /* duplicators hidden by default, except dupliframes which duplicate self */ if(b_ob.is_duplicator()) if(top_level || b_ob.dupli_type() != BL::Object::dupli_type_FRAMES) hide_as_dupli_parent = true; /* hide original object for duplis */ BL::Object parent = b_ob.parent(); if(parent && object_render_hide_original(b_ob.type(), parent.dupli_type())) if(parent_hide) hide_as_dupli_child_original = true; hide_triangles = hide_emitter; if(show_emitter) { return false; } else if(hair_present) { return hide_as_dupli_child_original; } else { return (hide_as_dupli_parent || hide_as_dupli_child_original); } }
static bool object_render_hide_duplis(BL::Object b_ob) { BL::Object parent = b_ob.parent(); return (parent && object_render_hide_original(b_ob.type(), parent.dupli_type())); }