Cycles: fix a few more msvc issues with empty scenes and ustring setting.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 3 Oct 2011 17:42:24 +0000 (17:42 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 3 Oct 2011 17:42:24 +0000 (17:42 +0000)
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_shader.cpp
intern/cycles/bvh/bvh_build.cpp

index 6e99b380c295a984815151150c037304385d6055..0dc0b91be797592734e5cdcf364f2bfae2fdb45c 100644 (file)
@@ -110,11 +110,11 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
                BL::Mesh::vertex_colors_iterator l;
 
                for(b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
-                       if(!mesh_need_attribute(scene, mesh, ustring(l->name())))
+                       if(!mesh_need_attribute(scene, mesh, ustring(l->name().c_str())))
                                continue;
 
                        Attribute *attr = mesh->attributes.add(
-                               ustring(l->name()), TypeDesc::TypeColor, Attribute::CORNER);
+                               ustring(l->name().c_str()), TypeDesc::TypeColor, Attribute::CORNER);
 
                        BL::MeshColorLayer::data_iterator c;
                        float3 *fdata = attr->data_float3();
@@ -142,7 +142,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 
                for(b_mesh.uv_textures.begin(l); l != b_mesh.uv_textures.end(); ++l) {
                        Attribute::Standard std = (l->active_render())? Attribute::STD_UV: Attribute::STD_NONE;
-                       ustring name = ustring(l->name());
+                       ustring name = ustring(l->name().c_str());
 
                        if(!(mesh_need_attribute(scene, mesh, name) || mesh_need_attribute(scene, mesh, std)))
                                continue;
index a4944a378e07f03d66f9472cda55f8edb97b5b58..de41484975d399200834c0a869bc33bb40513a22 100644 (file)
@@ -177,7 +177,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
 
        /* object sync */
        if(object_map.sync(&object, b_ob, b_parent, key)) {
-               object->name = b_ob.name();
+               object->name = b_ob.name().c_str();
                object->tfm = tfm;
                
                object->visibility = object_ray_visibility(b_ob) & visibility;
index 0c962e3c5f0aa14538d042a359790456d8006dce..c7eda0a01607692eb6a9c4945c4a69f628fbe1b3 100644 (file)
@@ -568,7 +568,7 @@ void BlenderSync::sync_materials()
                if(shader_map.sync(&shader, *b_mat)) {
                        ShaderGraph *graph = new ShaderGraph();
 
-                       shader->name = b_mat->name();
+                       shader->name = b_mat->name().c_str();
 
                        /* create nodes */
                        if(b_mat->use_nodes() && b_mat->node_tree()) {
@@ -660,7 +660,7 @@ void BlenderSync::sync_lamps()
 
                        /* create nodes */
                        if(b_lamp->use_nodes() && b_lamp->node_tree()) {
-                               shader->name = b_lamp->name();
+                               shader->name = b_lamp->name().c_str();
 
                                PtrSockMap sock_to_node;
                                BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
index d3e84e11d53807653cb94a7b8003438deedc1514..67cff3f5873b4be6edcbecb87ea39e9cfcf85eaa 100644 (file)
@@ -270,7 +270,8 @@ BVHNode* BVHBuild::create_leaf_node(const NodeSpec& spec)
        /* while there may be multiple triangles in a leaf, for object primitives
         * we want them to be the only one, so we  */
        int ob_num = spec.num - num;
-       BVHNode *oleaf = create_object_leaf_nodes(&references.back() - (ob_num - 1), ob_num);
+       const Reference *ref = (ob_num)? &references.back() - (ob_num - 1): NULL;
+       BVHNode *oleaf = create_object_leaf_nodes(ref, ob_num);
        for(int i = 0; i < ob_num; i++)
                references.pop_back();