diff options
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/BCAnimationCurve.h | 3 | ||||
-rw-r--r-- | source/blender/collada/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/collada/DocumentExporter.cpp | 4 | ||||
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 4 | ||||
-rw-r--r-- | source/blender/collada/EffectExporter.cpp | 4 | ||||
-rw-r--r-- | source/blender/collada/Materials.cpp | 1 | ||||
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 8 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 21 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.h | 5 |
9 files changed, 29 insertions, 24 deletions
diff --git a/source/blender/collada/BCAnimationCurve.h b/source/blender/collada/BCAnimationCurve.h index 4651290ea0f..7b523ac53ca 100644 --- a/source/blender/collada/BCAnimationCurve.h +++ b/source/blender/collada/BCAnimationCurve.h @@ -23,8 +23,9 @@ #include "collada_utils.h" #include "BCSampleData.h" -extern "C" { #include "MEM_guardedalloc.h" + +extern "C" { #include "BKE_fcurve.h" #include "BKE_armature.h" #include "BKE_material.h" diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index 40762db759e..a88fd05a18f 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -126,6 +126,9 @@ set(SRC ) set(LIB + ${OPENCOLLADA_LIBRARIES} + ${PCRE_LIBRARIES} + ${XML2_LIBRARIES} ) if(WITH_BUILDINFO) diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 0ebcd6d0919..24a960ab287 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -56,6 +56,8 @@ #include "COLLADASWInstanceNode.h" #include "COLLADASWBaseInputElement.h" +#include "MEM_guardedalloc.h" + extern "C" { #include "DNA_scene_types.h" #include "DNA_object_types.h" @@ -99,8 +101,6 @@ extern char build_commit_time[]; extern char build_hash[]; #endif -#include "MEM_guardedalloc.h" - #include "RNA_access.h" } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 30e41a8d720..f2c52b125a4 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -43,6 +43,8 @@ #include "COLLADASaxFWLLoader.h" #include "COLLADASaxFWLIExtraDataCallbackHandler.h" +#include "MEM_guardedalloc.h" + extern "C" { #include "BLI_listbase.h" #include "BLI_math.h" @@ -68,8 +70,6 @@ extern "C" { #include "RNA_access.h" -#include "MEM_guardedalloc.h" - #include "WM_api.h" #include "WM_types.h" } diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 80f84738f6e..2d69fae035f 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -112,26 +112,22 @@ void EffectsExporter::set_transparency(COLLADASW::EffectProfile &ep, Material *m void EffectsExporter::set_diffuse_color(COLLADASW::EffectProfile &ep, Material *ma) { - // get diffuse color COLLADASW::ColorOrTexture cot = bc_get_base_color(ma); ep.setDiffuse(cot, false, "diffuse"); } void EffectsExporter::set_ambient(COLLADASW::EffectProfile &ep, Material *ma) { - // get diffuse color COLLADASW::ColorOrTexture cot = bc_get_ambient(ma); ep.setAmbient(cot, false, "ambient"); } void EffectsExporter::set_specular(COLLADASW::EffectProfile &ep, Material *ma) { - // get diffuse color COLLADASW::ColorOrTexture cot = bc_get_specular(ma); ep.setSpecular(cot, false, "specular"); } void EffectsExporter::set_reflective(COLLADASW::EffectProfile &ep, Material *ma) { - // get diffuse color COLLADASW::ColorOrTexture cot = bc_get_reflective(ma); ep.setReflective(cot, false, "reflective"); } diff --git a/source/blender/collada/Materials.cpp b/source/blender/collada/Materials.cpp index 3b2c68ef95e..06f54884668 100644 --- a/source/blender/collada/Materials.cpp +++ b/source/blender/collada/Materials.cpp @@ -202,6 +202,7 @@ void MaterialNode::set_alpha(COLLADAFW::EffectCommon::OpaqueMode mode, bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Alpha"); ((bNodeSocketValueFloat *)socket->default_value)->value = alpha; + material->a = alpha; } else if (cot.isTexture()) { int locy = -300 * (node_map.size() - 2); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 64031e10d77..8ed30a0dc81 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -31,6 +31,8 @@ #include "COLLADAFWMeshVertexData.h" #include "COLLADAFWPolygons.h" +#include "MEM_guardedalloc.h" + extern "C" { #include "BKE_customdata.h" #include "BKE_displist.h" @@ -44,8 +46,6 @@ extern "C" { #include "BLI_math.h" #include "BLI_string.h" #include "BLI_edgehash.h" - -#include "MEM_guardedalloc.h" } #include "ArmatureImporter.h" @@ -1014,12 +1014,12 @@ void MeshImporter::optimize_material_assignements() ++it) { Object *ob = (*it); Mesh *me = (Mesh *)ob->data; - if (me->id.us == 1) { + if (ID_REAL_USERS(&me->id) == 1) { bc_copy_materials_to_data(ob, me); bc_remove_materials_from_object(ob, me); bc_remove_mark(ob); } - else if (me->id.us > 1) { + else if (ID_REAL_USERS(&me->id) > 1) { bool can_move = true; std::vector<Object *> mesh_users = get_all_users_of(me); if (mesh_users.size() > 1) { diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index b688840cb09..63dad6b7ac0 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -27,6 +27,9 @@ #include <set> #include <string> + +#include "MEM_guardedalloc.h" + extern "C" { #include "DNA_modifier_types.h" #include "DNA_customdata_types.h" @@ -62,8 +65,6 @@ extern "C" { #include "ED_node.h" #include "ED_object.h" -#include "MEM_guardedalloc.h" - #include "WM_api.h" /* XXX hrm, see if we can do without this */ #include "WM_types.h" @@ -1321,10 +1322,11 @@ void bc_add_default_shader(bContext *C, Material *ma) COLLADASW::ColorOrTexture bc_get_base_color(Material *ma) { - Color default_color = {0.8, 0.8, 0.8, 1.0}; + /* for alpha see bc_get_alpha() */ + Color default_color = {ma->r, ma->g, ma->b, 1.0}; bNode *shader = bc_get_master_shader(ma); if (ma->use_nodes && shader) { - return bc_get_cot_from_shader(shader, "Base Color", default_color); + return bc_get_cot_from_shader(shader, "Base Color", default_color, false); } else { return bc_get_cot(default_color); @@ -1414,16 +1416,17 @@ double bc_get_float_from_shader(bNode *shader, double &val, std::string nodeid) COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader, std::string nodeid, - Color &default_color) + Color &default_color, + bool with_alpha) { bNodeSocket *socket = nodeFindSocket(shader, SOCK_IN, nodeid.c_str()); if (socket) { bNodeSocketValueRGBA *dcol = (bNodeSocketValueRGBA *)socket->default_value; float *col = dcol->value; - return bc_get_cot(col); + return bc_get_cot(col, with_alpha); } else { - return bc_get_cot(default_color); /* default black */ + return bc_get_cot(default_color, with_alpha); } } @@ -1447,9 +1450,9 @@ COLLADASW::ColorOrTexture bc_get_cot(float r, float g, float b, float a) return cot; } -COLLADASW::ColorOrTexture bc_get_cot(Color col) +COLLADASW::ColorOrTexture bc_get_cot(Color col, bool with_alpha) { - COLLADASW::Color color(col[0], col[1], col[2], col[3]); + COLLADASW::Color color(col[0], col[1], col[2], (with_alpha) ? col[3] : 1.0); COLLADASW::ColorOrTexture cot(color); return cot; } diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index c0425e59d1a..b313fcd6e66 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -397,9 +397,10 @@ double bc_get_shininess(Material *ma); double bc_get_float_from_shader(bNode *shader, double &ior, std::string nodeid); COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader, std::string nodeid, - Color &default_color); + Color &default_color, + bool with_alpha = true); COLLADASW::ColorOrTexture bc_get_cot(float r, float g, float b, float a); -COLLADASW::ColorOrTexture bc_get_cot(Color col); +COLLADASW::ColorOrTexture bc_get_cot(Color col, bool with_alpha = true); #endif |