From b3d41ac144b7a72bc1bcdd3955085a57f7eb3cb3 Mon Sep 17 00:00:00 2001 From: Arystanbek Dyussenov Date: Mon, 15 Feb 2010 16:18:21 +0000 Subject: Merge -c 26897,26932 from COLLADA branch into trunk. --- source/blender/collada/DocumentExporter.cpp | 34 ++-- source/blender/collada/DocumentImporter.cpp | 231 +++++++--------------------- 2 files changed, 75 insertions(+), 190 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 784a32ac3d0..700444cb088 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -173,9 +173,9 @@ const unsigned char translate_map[256] = { 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 @@ public: 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 @@ public: // each 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 @@ protected: 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 @@ private: 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 @@ private: 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 @@ protected: // 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 @@ protected: return INTANGENT_SOURCE_ID_SUFFIX; case Sampler::OUT_TANGENT: return OUTTANGENT_SOURCE_ID_SUFFIX; + default: + break; } return ""; } @@ -2146,6 +2145,8 @@ protected: param.push_back("X"); param.push_back("Y"); break; + default: + break; } } @@ -2170,6 +2171,9 @@ protected: // XXX *length = 2; break; + default: + *length = 0; + break; } } @@ -2193,9 +2197,9 @@ protected: 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 @@ protected: 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); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index cbab0bb3542..33c9a061cda 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -99,11 +99,13 @@ extern "C" #include // #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 @@ const char *primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type) } 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 @@ const char *geomTypeToStr(COLLADAFW::Geometry::GeometryType type) // works for COLLADAFW::Node, COLLADAFW::Geometry template -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 @@ const char *get_dae_name(T *node) // use this for retrieving bone names, since these must be unique template -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 @@ public: 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 @@ private: // 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 @@ private: 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 @@ private: } 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 @@ private: // 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 @@ private: } 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 @@ public: // 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: // 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 - int totuvset = mesh->getUVCoords().getInputInfosArray().getCount(); + unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount(); for (i = 0; i < totuvset; i++) { CustomData_add_layer(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface); @@ -1429,7 +1431,7 @@ private: size_t prim_totface = mp->getFaceCount(); unsigned int *indices = mp->getPositionIndices().getData(); unsigned int *nind = mp->getNormalIndices().getData(); - int j, k; + unsigned int j, k; int type = mp->getPrimitiveType(); int index = 0; @@ -1528,7 +1530,7 @@ private: set_face_indices(mface, tri_indices, false); - for (int l = 0; l < totuvset; l++) { + for (unsigned int l = 0; l < totuvset; l++) { // get mtface by face index and uv set index MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l); set_face_uv(&mtface[face_index], uvs, l, *index_list_array[l], uv_indices); @@ -1537,18 +1539,19 @@ private: test_index_face(mface, &me->fdata, face_index, 3); if (has_normals) { - unsigned int utri[3] = {tri[v], tri[v + 1], tri[v + 2]}; + unsigned int ntri[3] = {nind[tri[v]], nind[tri[v + 1]], nind[tri[v + 2]]}; - if (!flat_face(utri, nor, 3)) + if (!flat_face(ntri, nor, 3)) mface->flag |= ME_SMOOTH; - - nind += 3; } mface++; face_index++; prim.totface++; } + + if (has_normals) + nind += vcount; } index += vcount; @@ -1596,9 +1599,11 @@ private: { float a[3], b[3]; - get_vector(a, nor, *nind++); + get_vector(a, nor, *nind); normalize_v3(a); + nind++; + for (int i = 1; i < count; i++, nind++) { get_vector(b, nor, *nind); normalize_v3(b); @@ -1875,7 +1880,7 @@ private: // COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); float fps = (float)FPS; size_t dim = curve->getOutDimension(); - int i; + unsigned int i; std::vector& fcurves = curve_map[curve->getUniqueId()]; @@ -1924,7 +1929,7 @@ private: //fcu->totvert = curve->getKeyCount(); // create beztriple for each key - for (int j = 0; j < curve->getKeyCount(); j++) { + for (unsigned int j = 0; j < curve->getKeyCount(); j++) { BezTriple bez; memset(&bez, 0, sizeof(BezTriple)); @@ -1958,92 +1963,12 @@ private: void fcurve_deg_to_rad(FCurve *cu) { - for (int i = 0; i < cu->totvert; i++) { + for (unsigned int i = 0; i < cu->totvert; i++) { // TODO convert handles too cu->bezt[i].vec[1][1] *= M_PI / 180.0f; } } -#if 0 - void make_fcurves_from_animation(COLLADAFW::AnimationCurve *curve, - COLLADAFW::FloatOrDoubleArray& input, - COLLADAFW::FloatOrDoubleArray& output, - COLLADAFW::FloatOrDoubleArray& intan, - COLLADAFW::FloatOrDoubleArray& outtan, size_t dim, float fps) - { - int i; - // char *path = "location"; - std::vector& fcurves = curve_map[curve->getUniqueId()]; - - if (dim == 1) { - // create fcurve - FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); - - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); - // fcu->rna_path = BLI_strdupn(path, strlen(path)); - fcu->array_index = 0; - //fcu->totvert = curve->getKeyCount(); - - // create beztriple for each key - for (i = 0; i < curve->getKeyCount(); i++) { - BezTriple bez; - memset(&bez, 0, sizeof(BezTriple)); - // intangent - bez.vec[0][0] = get_float_value(intan, i + i) * fps; - bez.vec[0][1] = get_float_value(intan, i + i + 1); - // input, output - bez.vec[1][0] = get_float_value(input, i) * fps; - bez.vec[1][1] = get_float_value(output, i); - // outtangent - bez.vec[2][0] = get_float_value(outtan, i + i) * fps; - bez.vec[2][1] = get_float_value(outtan, i + i + 1); - - bez.ipo = U.ipo_new; /* use default interpolation mode here... */ - bez.f1 = bez.f2 = bez.f3 = SELECT; - bez.h1 = bez.h2 = HD_AUTO; - insert_bezt_fcurve(fcu, &bez, 0); - calchandles_fcurve(fcu); - } - - fcurves.push_back(fcu); - } - else if(dim == 3) { - for (i = 0; i < dim; i++ ) { - // create fcurve - FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); - - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); - // fcu->rna_path = BLI_strdupn(path, strlen(path)); - fcu->array_index = 0; - //fcu->totvert = curve->getKeyCount(); - - // create beztriple for each key - for (int j = 0; j < curve->getKeyCount(); j++) { - BezTriple bez; - memset(&bez, 0, sizeof(BezTriple)); - // intangent - bez.vec[0][0] = get_float_value(intan, j * 6 + i + i) * fps; - bez.vec[0][1] = get_float_value(intan, j * 6 + i + i + 1); - // input, output - bez.vec[1][0] = get_float_value(input, j) * fps; - bez.vec[1][1] = get_float_value(output, j * 3 + i); - // outtangent - bez.vec[2][0] = get_float_value(outtan, j * 6 + i + i) * fps; - bez.vec[2][1] = get_float_value(outtan, j * 6 + i + i + 1); - - bez.ipo = U.ipo_new; /* use default interpolation mode here... */ - bez.f1 = bez.f2 = bez.f3 = SELECT; - bez.h1 = bez.h2 = HD_AUTO; - insert_bezt_fcurve(fcu, &bez, 0); - calchandles_fcurve(fcu); - } - - fcurves.push_back(fcu); - } - } - } -#endif - void add_fcurves_to_object(Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated) { bAction *act; @@ -2400,18 +2325,11 @@ public: // prerequisites: // animlist_map - map animlist id -> animlist // curve_map - map anim id -> curve(s) -#ifdef ARMATURE_TEST Object *translate_animation(COLLADAFW::Node *node, std::map& object_map, std::map& root_map, COLLADAFW::Transformation::TransformationType tm_type, Object *par_job = NULL) -#else - void translate_animation(COLLADAFW::Node *node, - std::map& object_map, - std::map& root_map, - COLLADAFW::Transformation::TransformationType tm_type) -#endif { bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE; bool is_joint = node->getType() == COLLADAFW::Node::JOINT; @@ -2421,11 +2339,7 @@ public: if (!ob) { fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str()); -#ifdef ARMATURE_TEST return NULL; -#else - return; -#endif } // frames at which to sample @@ -2434,9 +2348,7 @@ public: // for each , , etc. there is a separate Transformation const COLLADAFW::TransformationPointerArray& tms = node->getTransformations(); - std::vector old_curves; - - int i; + unsigned int i; // find frames at which to sample plus convert all keys to radians for (i = 0; i < tms.getCount(); i++) { @@ -2451,7 +2363,7 @@ public: const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); if (bindings.getCount()) { - for (int j = 0; j < bindings.getCount(); j++) { + for (unsigned int j = 0; j < bindings.getCount(); j++) { std::vector& curves = curve_map[bindings[j].animation]; bool xyz = ((type == COLLADAFW::Transformation::TRANSLATE || type == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ); @@ -2464,7 +2376,7 @@ public: if (is_rotation) fcurve_deg_to_rad(fcu); - for (int k = 0; k < fcu->totvert; k++) { + for (unsigned int k = 0; k < fcu->totvert; k++) { float fra = fcu->bezt[k].vec[1][0]; if (std::find(frames.begin(), frames.end(), fra) == frames.end()) frames.push_back(fra); @@ -2472,11 +2384,8 @@ public: } } else { - fprintf(stderr, "expected 1 or 3 curves, got %u\n", curves.size()); + fprintf(stderr, "expected %d curves, got %u\n", xyz ? 3 : 1, curves.size()); } - - for (std::vector::iterator it = curves.begin(); it != curves.end(); it++) - old_curves.push_back(*it); } } } @@ -2498,11 +2407,7 @@ public: Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); if (!bone) { fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); -#ifdef ARMATURE_TEST return NULL; -#else - return; -#endif } unit_m4(rest); @@ -2512,18 +2417,15 @@ public: char rna_path[200]; + Object *job = NULL; + #ifdef ARMATURE_TEST - Object *job = get_joint_object(root, node, par_job); FCurve *job_curves[4]; + job = get_joint_object(root, node, par_job); #endif - if (frames.size() == 0) { -#ifdef ARMATURE_TEST + if (frames.size() == 0) return job; -#else - return; -#endif - } const char *tm_str = NULL; switch (tm_type) { @@ -2537,11 +2439,7 @@ public: tm_str = "location"; break; default: -#ifdef ARMATURE_TEST return job; -#else - return; -#endif } if (is_joint) { @@ -2555,12 +2453,14 @@ public: // new curves FCurve *newcu[4]; - int totcu = is_rotation ? 4 : 3; + unsigned int totcu = is_rotation ? 4 : 3; for (i = 0; i < totcu; i++) { newcu[i] = create_fcurve(i, rna_path); + #ifdef ARMATURE_TEST - job_curves[i] = create_fcurve(i, tm_str); + if (is_joint) + job_curves[i] = create_fcurve(i, tm_str); #endif } @@ -2642,19 +2542,6 @@ public: verify_adt_action((ID*)&ob->id, 1); ListBase *curves = &ob->adt->action->curves; - // no longer needed -#if 0 - // remove old curves - for (std::vector::iterator it = old_curves.begin(); it != old_curves.end(); it++) { - if (is_joint) - action_groups_remove_channel(ob->adt->action, *it); - else - BLI_remlink(curves, *it); - - // std::remove(unused_curves.begin(), unused_curves.end(), *it); - // free_fcurve(*it); - } -#endif // add curves for (i = 0; i < totcu; i++) { @@ -2679,9 +2566,7 @@ public: } } -#ifdef ARMATURE_TEST return job; -#endif } // internal, better make it private @@ -2693,7 +2578,7 @@ public: unit_m4(mat); - for (int i = 0; i < tms.getCount(); i++) { + for (unsigned int i = 0; i < tms.getCount(); i++) { COLLADAFW::Transformation *tm = tms[i]; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); float m[4][4]; @@ -2735,7 +2620,7 @@ public: const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); if (bindings.getCount()) { - for (int j = 0; j < bindings.getCount(); j++) { + for (unsigned int j = 0; j < bindings.getCount(); j++) { std::vector& curves = curve_map[bindings[j].animation]; COLLADAFW::AnimationList::AnimationClass animclass = bindings[j].animationClass; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); @@ -2851,7 +2736,7 @@ public: } COLLADAFW::NodePointerArray& children = node->getChildNodes(); - for (int i = 0; i < children.getCount(); i++) { + for (unsigned int i = 0; i < children.getCount(); i++) { if (calc_joint_parent_mat_rest(mat, m, children[i], end)) return true; } @@ -3065,14 +2950,13 @@ public: for (std::vector::iterator it = vscenes.begin(); it != vscenes.end(); it++) { const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes(); - for (int i = 0; i < roots.getCount(); i++) + for (unsigned int i = 0; i < roots.getCount(); i++) translate_anim_recursive(roots[i]); } } -#ifdef ARMATURE_TEST void translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW::Node *par = NULL, Object *parob = NULL) { if (par && par->getType() == COLLADAFW::Node::JOINT) { @@ -3089,20 +2973,17 @@ public: COLLADAFW::Transformation::TRANSLATE }; - int i; + unsigned int i; Object *ob; for (i = 0; i < 3; i++) ob = anim_importer.translate_animation(node, object_map, root_map, types[i]); COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (int i = 0; i < children.getCount(); i++) { + for (i = 0; i < children.getCount(); i++) { translate_anim_recursive(children[i], node, ob); } } -#else - -#endif /** When this method is called, the writer must write the global document asset. @return The writer should return true, if writing succeeded, false otherwise.*/ @@ -3221,7 +3102,7 @@ public: // if node has child nodes write them COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes(); - for (int i = 0; i < child_nodes.getCount(); i++) { + for (unsigned int i = 0; i < child_nodes.getCount(); i++) { write_node(child_nodes[i], node, sce, ob); } } @@ -3247,7 +3128,7 @@ public: Scene *sce = CTX_data_scene(mContext); const COLLADAFW::NodePointerArray& roots = visualScene->getRootNodes(); - for (int i = 0; i < roots.getCount(); i++) { + for (unsigned int i = 0; i < roots.getCount(); i++) { write_node(roots[i], NULL, sce, NULL); } -- cgit v1.2.3