[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26933] trunk/blender/source/blender/ collada: Merge -c 26897, 26932 from COLLADA branch into trunk.
Arystanbek Dyussenov
arystan.d at gmail.com
Mon Feb 15 17:18:22 CET 2010
Revision: 26933
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26933
Author: kazanbas
Date: 2010-02-15 17:18:21 +0100 (Mon, 15 Feb 2010)
Log Message:
-----------
Merge -c 26897,26932 from COLLADA branch into trunk.
Modified Paths:
--------------
trunk/blender/source/blender/collada/DocumentExporter.cpp
trunk/blender/source/blender/collada/DocumentImporter.cpp
Modified: trunk/blender/source/blender/collada/DocumentExporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/DocumentExporter.cpp 2010-02-15 15:32:04 UTC (rev 26932)
+++ trunk/blender/source/blender/collada/DocumentExporter.cpp 2010-02-15 16:18:21 UTC (rev 26933)
@@ -173,9 +173,9 @@
static std::string translate_id(const std::string &id)
{
std::string id_translated = id;
- for (int i=0; i < id_translated.size(); i++)
+ for (unsigned int i=0; i < id_translated.size(); i++)
{
- id_translated[i] = translate_map[id_translated[i]];
+ id_translated[i] = translate_map[(unsigned int)id_translated[i]];
}
return id_translated;
}
@@ -471,7 +471,7 @@
int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
for (i = 0; i < num_layers; i++) {
- char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
+ // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
COLLADASW::Input input3(COLLADASW::TEXCOORD,
makeUrl(makeTexcoordSourceId(geom_id, i)),
2, // offset always 2, this is only until we have optimized UV sets
@@ -582,7 +582,7 @@
// each <source> will get id like meshName + "map-channel-1"
for (int a = 0; a < num_layers; a++) {
MTFace *tface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
- char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
+ // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
COLLADASW::FloatSourceF source(mSW);
std::string layer_id = makeTexcoordSourceId(geom_id, a);
@@ -751,7 +751,7 @@
float rot[3], loc[3], scale[3];
if (ob->parent) {
- float C[4][4], D[4][4], tmat[4][4], imat[4][4], mat[4][4];
+ float C[4][4], tmat[4][4], imat[4][4], mat[4][4];
// factor out scale from obmat
@@ -985,8 +985,6 @@
void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
{
- bPose *pose = ob_arm->pose;
-
bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
float mat[4][4];
@@ -1067,11 +1065,10 @@
COLLADASW::JointsElement joints(mSW);
COLLADASW::InputList &input = joints.getInputList();
- int offset = 0;
input.push_back(COLLADASW::Input(COLLADASW::JOINT, // constant declared in COLLADASWInputList.h
- COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id)));
- input.push_back(COLLADASW::Input(COLLADASW::BINDMATRIX,
- COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id)));
+ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id)));
+ input.push_back(COLLADASW::Input(COLLADASW::BINDMATRIX,
+ COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id)));
joints.add();
}
@@ -1964,7 +1961,7 @@
// write x, y, z curves separately if it is rotation
float *c = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames");
for (int i = 0; i < 3; i++) {
- for (int j = 0; j < fra.size(); j++)
+ for (unsigned int j = 0; j < fra.size(); j++)
c[j] = v[j * 3 + i];
dae_bone_animation(fra, c, transform_type, i, id_name(ob_arm), bone->name);
@@ -2115,6 +2112,8 @@
return INTANGENT_SOURCE_ID_SUFFIX;
case Sampler::OUT_TANGENT:
return OUTTANGENT_SOURCE_ID_SUFFIX;
+ default:
+ break;
}
return "";
}
@@ -2146,6 +2145,8 @@
param.push_back("X");
param.push_back("Y");
break;
+ default:
+ break;
}
}
@@ -2170,6 +2171,9 @@
// XXX
*length = 2;
break;
+ default:
+ *length = 0;
+ break;
}
}
@@ -2193,9 +2197,9 @@
source.prepareToAppendValues();
- for (int i = 0; i < fcu->totvert; i++) {
+ for (unsigned int i = 0; i < fcu->totvert; i++) {
float values[3]; // be careful!
- int length;
+ int length = 0;
get_source_values(&fcu->bezt[i], semantic, is_rotation, values, &length);
for (int j = 0; j < length; j++)
@@ -2353,7 +2357,7 @@
char *name = extract_transform_name(fcu->rna_path);
if (!strcmp(name, tm_name)) {
- for (int i = 0; i < fcu->totvert; i++) {
+ for (unsigned int i = 0; i < fcu->totvert; i++) {
float f = fcu->bezt[i].vec[1][0];
if (std::find(fra.begin(), fra.end(), f) == fra.end())
fra.push_back(f);
Modified: trunk/blender/source/blender/collada/DocumentImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/DocumentImporter.cpp 2010-02-15 15:32:04 UTC (rev 26932)
+++ trunk/blender/source/blender/collada/DocumentImporter.cpp 2010-02-15 16:18:21 UTC (rev 26933)
@@ -99,11 +99,13 @@
#include <float.h>
// #define COLLADA_DEBUG
-#define ARMATURE_TEST
+// creates empties for each imported bone on layer 2, for debugging
+// #define ARMATURE_TEST
+
char *CustomData_get_layer_name(const struct CustomData *data, int type, int n);
-const char *primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
+static const char *primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
{
using namespace COLLADAFW;
@@ -129,7 +131,8 @@
}
return "UNKNOWN";
}
-const char *geomTypeToStr(COLLADAFW::Geometry::GeometryType type)
+
+static const char *geomTypeToStr(COLLADAFW::Geometry::GeometryType type)
{
switch (type) {
case COLLADAFW::Geometry::GEO_TYPE_MESH:
@@ -146,7 +149,7 @@
// works for COLLADAFW::Node, COLLADAFW::Geometry
template<class T>
-const char *get_dae_name(T *node)
+static const char *get_dae_name(T *node)
{
const std::string& name = node->getName();
return name.size() ? name.c_str() : node->getOriginalId().c_str();
@@ -154,13 +157,13 @@
// use this for retrieving bone names, since these must be unique
template<class T>
-const char *get_joint_name(T *node)
+static const char *get_joint_name(T *node)
{
const std::string& id = node->getOriginalId();
return id.size() ? id.c_str() : node->getName().c_str();
}
-float get_float_value(const COLLADAFW::FloatOrDoubleArray& array, int index)
+static float get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index)
{
if (index >= array.getValuesCount())
return 0.0f;
@@ -197,7 +200,7 @@
unit_m4(mat);
- for (int i = 0; i < node->getTransformations().getCount(); i++) {
+ for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {
COLLADAFW::Transformation *tm = node->getTransformations()[i];
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
@@ -406,7 +409,7 @@
// cannot transfer data for FloatOrDoubleArray, copy values manually
const COLLADAFW::FloatOrDoubleArray& weight = skin->getWeights();
- for (int i = 0; i < weight.getValuesCount(); i++)
+ for (unsigned int i = 0; i < weight.getValuesCount(); i++)
weights.push_back(get_float_value(weight, i));
unit_converter->dae_matrix_to_mat4(bind_shape_matrix, skin->getBindShapeMatrix());
@@ -438,7 +441,7 @@
controller_uid = co->getUniqueId();
const COLLADAFW::UniqueIdArray& joint_uids = co->getJoints();
- for (int i = 0; i < joint_uids.getCount(); i++) {
+ for (unsigned int i = 0; i < joint_uids.getCount(); i++) {
joint_data[i].joint_uid = joint_uids[i];
// // store armature pointer
@@ -489,7 +492,7 @@
}
COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (int i = 0; i < children.getCount(); i++) {
+ for (unsigned int i = 0; i < children.getCount(); i++) {
if (this->uses_joint(children[i]))
return true;
}
@@ -543,9 +546,9 @@
// get def group by index with BLI_findlink
- for (int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) {
+ for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) {
- int limit = weight + joints_per_vertex[vertex];
+ unsigned int limit = weight + joints_per_vertex[vertex];
for ( ; weight < limit; weight++) {
int joint = joint_indices[weight], joint_weight = weight_indices[weight];
@@ -677,7 +680,7 @@
}
COLLADAFW::NodePointerArray& children = node->getChildNodes();
- for (int i = 0; i < children.getCount(); i++) {
+ for (unsigned int i = 0; i < children.getCount(); i++) {
create_bone(skin, children[i], bone, children.getCount(), mat, arm);
}
@@ -953,7 +956,7 @@
// store join inv bind matrix to use it later in armature construction
const COLLADAFW::Matrix4Array& inv_bind_mats = data->getInverseBindMatrices();
- for (int i = 0; i < data->getJointsCount(); i++) {
+ for (unsigned int i = 0; i < data->getJointsCount(); i++) {
skin.add_joint(inv_bind_mats[i]);
}
@@ -1243,11 +1246,10 @@
bool is_nice_mesh(COLLADAFW::Mesh *mesh)
{
COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
- int i;
const char *name = get_dae_name(mesh);
- for (i = 0; i < prim_arr.getCount(); i++) {
+ for (unsigned i = 0; i < prim_arr.getCount(); i++) {
COLLADAFW::MeshPrimitive *mp = prim_arr[i];
COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType();
@@ -1260,7 +1262,7 @@
COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray();
- for(int j = 0; j < vca.getCount(); j++){
+ for(unsigned int j = 0; j < vca.getCount(); j++){
int count = vca[j];
if (count < 3) {
fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
@@ -1351,7 +1353,7 @@
int count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me)
{
COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
- int i, j;
+ unsigned int i;
int tottri = 0;
for (i = 0; i < prim_arr.getCount(); i++) {
@@ -1367,7 +1369,7 @@
COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
- for (j = 0; j < prim_totface; j++) {
+ for (unsigned int j = 0; j < prim_totface; j++) {
int vcount = vcounta[j];
if (vcount > 4) {
@@ -1387,14 +1389,14 @@
// TODO: import uv set names
void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris)
{
- int i;
+ unsigned int i;
// allocate faces
me->totface = mesh->getFacesCount() + new_tris;
me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
// allocate UV layers
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list