diff options
Diffstat (limited to 'source/blender/io/collada')
-rw-r--r-- | source/blender/io/collada/AnimationExporter.cpp | 2 | ||||
-rw-r--r-- | source/blender/io/collada/AnimationImporter.cpp | 62 | ||||
-rw-r--r-- | source/blender/io/collada/ArmatureImporter.cpp | 8 | ||||
-rw-r--r-- | source/blender/io/collada/DocumentImporter.cpp | 14 | ||||
-rw-r--r-- | source/blender/io/collada/EffectExporter.cpp | 2 | ||||
-rw-r--r-- | source/blender/io/collada/ExtraHandler.cpp | 4 | ||||
-rw-r--r-- | source/blender/io/collada/GeometryExporter.cpp | 14 | ||||
-rw-r--r-- | source/blender/io/collada/MeshImporter.cpp | 59 | ||||
-rw-r--r-- | source/blender/io/collada/SkinInfo.cpp | 14 | ||||
-rw-r--r-- | source/blender/io/collada/TransformReader.cpp | 2 | ||||
-rw-r--r-- | source/blender/io/collada/collada_internal.cpp | 12 | ||||
-rw-r--r-- | source/blender/io/collada/collada_utils.cpp | 2 |
12 files changed, 97 insertions, 98 deletions
diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp index 7df9df1f460..85e8ccf9f2a 100644 --- a/source/blender/io/collada/AnimationExporter.cpp +++ b/source/blender/io/collada/AnimationExporter.cpp @@ -687,7 +687,7 @@ std::string AnimationExporter::collada_interpolation_source(const BCAnimationCur std::vector<float> frames; curve.get_frames(frames); - for (unsigned int i = 0; i < curve.sample_count(); i++) { + for (uint i = 0; i < curve.sample_count(); i++) { float frame = frames[i]; int ipo = curve.get_interpolation_type(frame); if (ipo == BEZT_IPO_BEZ) { diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp index cc91c3eeac9..094f62e3c13 100644 --- a/source/blender/io/collada/AnimationImporter.cpp +++ b/source/blender/io/collada/AnimationImporter.cpp @@ -74,7 +74,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) float fps = (float)FPS; size_t dim = curve->getOutDimension(); - unsigned int i; + uint i; std::vector<FCurve *> &fcurves = curve_map[curve->getUniqueId()]; @@ -91,7 +91,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) fcu->array_index = 0; fcu->auto_smoothing = U.auto_smoothing_new; - for (unsigned int j = 0; j < curve->getKeyCount(); j++) { + for (uint j = 0; j < curve->getKeyCount(); j++) { BezTriple bez; memset(&bez, 0, sizeof(BezTriple)); @@ -106,7 +106,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) COLLADAFW::FloatOrDoubleArray &outtan = curve->getOutTangentValues(); /* In-tangent. */ - unsigned int index = 2 * (j * dim + i); + uint index = 2 * (j * dim + i); bez.vec[0][0] = bc_get_float_value(intan, index) * fps; bez.vec[0][1] = bc_get_float_value(intan, index + 1); @@ -148,7 +148,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) { - for (unsigned int i = 0; i < cu->totvert; i++) { + for (uint i = 0; i < cu->totvert; i++) { /* TODO: convert handles too. */ cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f); cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f); @@ -158,7 +158,7 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) void AnimationImporter::fcurve_scale(FCurve *cu, int scale) { - for (unsigned int i = 0; i < cu->totvert; i++) { + for (uint i = 0; i < cu->totvert; i++) { /* TODO: convert handles too. */ cu->bezt[i].vec[1][1] *= scale; cu->bezt[i].vec[0][1] *= scale; @@ -484,7 +484,7 @@ void AnimationImporter::find_frames(std::vector<float> *frames, std::vector<FCur for (iter = curves->begin(); iter != curves->end(); iter++) { FCurve *fcu = *iter; - for (unsigned int k = 0; k < fcu->totvert; k++) { + for (uint k = 0; k < fcu->totvert; k++) { /* get frame value from bezTriple */ float fra = fcu->bezt[k].vec[1][0]; /* if frame already not added add frame to frames */ @@ -649,7 +649,7 @@ void AnimationImporter::Assign_color_animations(const COLLADAFW::UniqueId &listi const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; switch (bindings[j].animationClass) { @@ -699,7 +699,7 @@ void AnimationImporter::Assign_float_animations(const COLLADAFW::UniqueId &listi const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; BLI_strncpy(rna_path, anim_type, sizeof(rna_path)); @@ -756,7 +756,7 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId &listid const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; BLI_strncpy(rna_path, anim_type, sizeof(rna_path)); @@ -767,7 +767,7 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId &listid for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve *fcu = *iter; - for (unsigned int i = 0; i < fcu->totvert; i++) { + for (uint i = 0; i < fcu->totvert; i++) { fcu->bezt[i].vec[0][1] = convert_to_focal_length( fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x); fcu->bezt[i].vec[1][1] = convert_to_focal_length( @@ -817,7 +817,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, } /* new curves to assign matrix transform animation */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale */ - unsigned int totcu = 10; + uint totcu = 10; const char *tm_str = nullptr; char rna_path[200]; for (int i = 0; i < totcu; i++) { @@ -1033,7 +1033,7 @@ void AnimationImporter::translate_Animations( const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); /* for each transformation in node */ - for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { + for (uint i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType(); @@ -1053,7 +1053,7 @@ void AnimationImporter::translate_Animations( animlist->getAnimationBindings(); /* all the curves belonging to the current binding */ std::vector<FCurve *> animcurves; - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; if (is_matrix) { apply_matrix_curves(ob, animcurves, root, node, transform); @@ -1092,7 +1092,7 @@ void AnimationImporter::translate_Animations( ListBase *AnimCurves = &(act->curves); const COLLADAFW::InstanceLightPointerArray &nodeLights = node->getInstanceLights(); - for (unsigned int i = 0; i < nodeLights.getCount(); i++) { + for (uint i = 0; i < nodeLights.getCount(); i++) { const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()]; @@ -1130,7 +1130,7 @@ void AnimationImporter::translate_Animations( ListBase *AnimCurves = &(act->curves); const COLLADAFW::InstanceCameraPointerArray &nodeCameras = node->getInstanceCameras(); - for (unsigned int i = 0; i < nodeCameras.getCount(); i++) { + for (uint i = 0; i < nodeCameras.getCount(); i++) { const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()]; @@ -1184,9 +1184,9 @@ void AnimationImporter::translate_Animations( } const COLLADAFW::InstanceGeometryPointerArray &nodeGeoms = node->getInstanceGeometries(); - for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) { + for (uint i = 0; i < nodeGeoms.getCount(); i++) { const COLLADAFW::MaterialBindingArray &matBinds = nodeGeoms[i]->getMaterialBindings(); - for (unsigned int j = 0; j < matBinds.getCount(); j++) { + for (uint j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId &matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *)(FW_object_map[matuid]); if (ef != nullptr) { /* can be NULL T28909. */ @@ -1273,7 +1273,7 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, /* new curves to assign matrix transform animation */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale. */ - unsigned int totcu = 10; + uint totcu = 10; const char *tm_str = nullptr; char rna_path[200]; for (int i = 0; i < totcu; i++) { @@ -1381,7 +1381,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); /* for each transformation in node */ - for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { + for (uint i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; const COLLADAFW::UniqueId &listid = transform->getAnimationList(); @@ -1395,7 +1395,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( } const COLLADAFW::InstanceLightPointerArray &nodeLights = node->getInstanceLights(); - for (unsigned int i = 0; i < nodeLights.getCount(); i++) { + for (uint i = 0; i < nodeLights.getCount(); i++) { const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()]; types->light = setAnimType(&(light->getColor()), (types->light), LIGHT_COLOR); @@ -1408,7 +1408,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( } const COLLADAFW::InstanceCameraPointerArray &nodeCameras = node->getInstanceCameras(); - for (unsigned int i = 0; i < nodeCameras.getCount(); i++) { + for (uint i = 0; i < nodeCameras.getCount(); i++) { const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()]; if (camera == nullptr) { @@ -1440,9 +1440,9 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( } const COLLADAFW::InstanceGeometryPointerArray &nodeGeoms = node->getInstanceGeometries(); - for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) { + for (uint i = 0; i < nodeGeoms.getCount(); i++) { const COLLADAFW::MaterialBindingArray &matBinds = nodeGeoms[i]->getMaterialBindings(); - for (unsigned int j = 0; j < matBinds.getCount(); j++) { + for (uint j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId &matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *)(FW_object_map[matuid]); if (ef != nullptr) { /* can be NULL T28909. */ @@ -1490,7 +1490,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, /* for each <rotate>, <translate>, etc. there is a separate Transformation */ const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); - unsigned int i; + uint i; /* find frames at which to sample plus convert all rotation keys to radians */ for (i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; @@ -1508,7 +1508,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, if (bindings.getCount()) { /* for each AnimationBinding get the fcurves which animate the transform */ - for (unsigned int j = 0; j < bindings.getCount(); j++) { + for (uint j = 0; j < bindings.getCount(); j++) { std::vector<FCurve *> &curves = curve_map[bindings[j].animation]; bool xyz = ((nodeTmType == COLLADAFW::Transformation::TRANSLATE || nodeTmType == COLLADAFW::Transformation::SCALE) && @@ -1525,7 +1525,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, fcurve_deg_to_rad(fcu); } - for (unsigned int k = 0; k < fcu->totvert; k++) { + for (uint k = 0; k < fcu->totvert; k++) { /* get frame value from bezTriple */ float fra = fcu->bezt[k].vec[1][0]; /* if frame already not added add frame to frames */ @@ -1573,7 +1573,7 @@ Object *AnimationImporter::translate_animation_OLD( find_frames_old(&frames, node, tm_type); - unsigned int i; + uint i; float irest_dae[4][4]; float rest[4][4], irest[4][4]; @@ -1632,7 +1632,7 @@ Object *AnimationImporter::translate_animation_OLD( /* new curves */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale */ - unsigned int totcu = is_matrix ? 10 : (is_rotation ? 4 : 3); + uint totcu = is_matrix ? 10 : (is_rotation ? 4 : 3); for (i = 0; i < totcu; i++) { @@ -1825,7 +1825,7 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], unit_m4(mat); - for (unsigned int i = 0; i < tms.getCount(); i++) { + for (uint i = 0; i < tms.getCount(); i++) { COLLADAFW::Transformation *tm = tms[i]; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); float m[4][4]; @@ -1909,7 +1909,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, dae_translate_to_v3(tm, vec); } - for (unsigned int index = 0; index < bindings.getCount(); index++) { + for (uint index = 0; index < bindings.getCount(); index++) { const COLLADAFW::AnimationList::AnimationBinding &binding = bindings[index]; std::vector<FCurve *> &curves = curve_map[binding.animation]; COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass; @@ -2062,7 +2062,7 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], } COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { if (calc_joint_parent_mat_rest(mat, m, children[i], end)) { return true; } diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index c7db2356d20..a742ee3a1dd 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -190,7 +190,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { int cl = create_bone(skin, children[i], bone, children.getCount(), mat, arm, layer_labels); if (cl > chain_length) { chain_length = cl; @@ -719,7 +719,7 @@ void ArmatureImporter::set_pose(Object *ob_arm, #endif COLLADAFW::NodePointerArray &children = root_node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { set_pose(ob_arm, children[i], bone_name, mat); } } @@ -727,7 +727,7 @@ void ArmatureImporter::set_pose(Object *ob_arm, bool ArmatureImporter::node_is_decomposed(const COLLADAFW::Node *node) { const COLLADAFW::TransformationPointerArray &nodeTransforms = node->getTransformations(); - for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) { + for (uint i = 0; i < nodeTransforms.getCount(); i++) { COLLADAFW::Transformation *transform = nodeTransforms[i]; COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType(); if (tm_type == COLLADAFW::Transformation::MATRIX) { @@ -879,7 +879,7 @@ bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControlle /* store join inv bind matrix to use it later in armature construction */ const COLLADAFW::Matrix4Array &inv_bind_mats = data->getInverseBindMatrices(); - for (unsigned int i = 0; i < data->getJointsCount(); i++) { + for (uint i = 0; i < data->getJointsCount(); i++) { skin.add_joint(inv_bind_mats[i]); } diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 00c69a5fb8a..851e57bb750 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -213,7 +213,7 @@ void DocumentImporter::finish() /* Write nodes to scene */ fprintf(stderr, "+-- Import Scene --------\n"); const COLLADAFW::NodePointerArray &roots = (*sit)->getRootNodes(); - for (unsigned int i = 0; i < roots.getCount(); i++) { + for (uint i = 0; i < roots.getCount(); i++) { std::vector<Object *> *objects_done = write_node(roots[i], nullptr, sce, nullptr, false); objects_to_scale->insert( objects_to_scale->end(), objects_done->begin(), objects_done->end()); @@ -234,7 +234,7 @@ void DocumentImporter::finish() for (const COLLADAFW::VisualScene *vscene : vscenes) { const COLLADAFW::NodePointerArray &roots = vscene->getRootNodes(); - for (unsigned int i = 0; i < roots.getCount(); i++) { + for (uint i = 0; i < roots.getCount(); i++) { translate_anim_recursive(roots[i], nullptr, nullptr); } } @@ -292,7 +292,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, Object *ob; #endif - unsigned int i; + uint i; if (node->getType() == COLLADAFW::Node::JOINT && par == nullptr) { /* For Skeletons without root node we have to simulate the @@ -424,7 +424,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::NodePointerArray &children = source_node->getChildNodes(); if (children.getCount()) { - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { COLLADAFW::Node *child_node = children[i]; const COLLADAFW::UniqueId &child_id = child_node->getUniqueId(); if (object_map.find(child_id) == object_map.end()) { @@ -675,7 +675,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, ob = *objects_done->begin(); } - for (unsigned int i = 0; i < child_nodes.getCount(); i++) { + for (uint i = 0; i < child_nodes.getCount(); i++) { std::vector<Object *> *child_objects; child_objects = write_node(child_nodes[i], node, sce, ob, is_library_node); delete child_objects; @@ -720,7 +720,7 @@ bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryN const COLLADAFW::NodePointerArray &nodes = libraryNodes->getNodes(); fprintf(stderr, "+-- Read Library nodes ----------\n"); - for (unsigned int i = 0; i < nodes.getCount(); i++) { + for (uint i = 0; i < nodes.getCount(); i++) { std::vector<Object *> *child_objects; child_objects = write_node(nodes[i], nullptr, sce, nullptr, true); delete child_objects; @@ -1182,7 +1182,7 @@ bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *e bool DocumentImporter::is_armature(COLLADAFW::Node *node) { COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes(); - for (unsigned int i = 0; i < child_nodes.getCount(); i++) { + for (uint i = 0; i < child_nodes.getCount(); i++) { if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) { return true; } diff --git a/source/blender/io/collada/EffectExporter.cpp b/source/blender/io/collada/EffectExporter.cpp index 40ce20617fc..e8a715633e1 100644 --- a/source/blender/io/collada/EffectExporter.cpp +++ b/source/blender/io/collada/EffectExporter.cpp @@ -217,7 +217,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) create_image_samplers(ep, material_image_map, active_uv); #if 0 - unsigned int a, b; + uint a, b; for (a = 0, b = 0; a < tex_indices.size(); a++) { MTex *t = ma->mtex[tex_indices[a]]; Image *ima = t->tex->ima; diff --git a/source/blender/io/collada/ExtraHandler.cpp b/source/blender/io/collada/ExtraHandler.cpp index b281f0e1a0a..d9c193ddbb5 100644 --- a/source/blender/io/collada/ExtraHandler.cpp +++ b/source/blender/io/collada/ExtraHandler.cpp @@ -43,7 +43,7 @@ bool ExtraHandler::textData(const char *text, size_t textLength) } bool ExtraHandler::parseElement(const char *profileName, - const unsigned long &elementHash, + const ulong &elementHash, const COLLADAFW::UniqueId &uniqueId) { /* implement for backwards compatibility, new version added object parameter */ @@ -51,7 +51,7 @@ bool ExtraHandler::parseElement(const char *profileName, } bool ExtraHandler::parseElement(const char *profileName, - const unsigned long &elementHash, + const ulong &elementHash, const COLLADAFW::UniqueId &uniqueId, COLLADAFW::Object *object) { diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp index e60900ccdb6..0e74c3ed516 100644 --- a/source/blender/io/collada/GeometryExporter.cpp +++ b/source/blender/io/collada/GeometryExporter.cpp @@ -203,7 +203,7 @@ void GeometryExporter::createLooseEdgeList(Object *ob, Mesh *me, std::string &ge const Span<MEdge> edges = me->edges(); int totedges = me->totedge; int edges_in_linelist = 0; - std::vector<unsigned int> edge_list; + std::vector<uint> edge_list; int index; /* Find all loose edges in Mesh @@ -244,7 +244,7 @@ void GeometryExporter::createLooseEdgeList(Object *ob, Mesh *me, std::string &ge static void prepareToAppendValues(bool is_triangulated, COLLADASW::PrimitivesBase &primitive_list, - std::vector<unsigned long> &vcount_list) + std::vector<ulong> &vcount_list) { /* performs the actual writing */ if (is_triangulated) { @@ -285,7 +285,7 @@ static COLLADASW::PrimitivesBase *create_primitive_list(bool is_triangulated, static bool collect_vertex_counts_per_poly(Mesh *me, int material_index, - std::vector<unsigned long> &vcount_list) + std::vector<ulong> &vcount_list) { const Span<MPoly> polys = me->polys(); const blender::bke::AttributeAccessor attributes = me->attributes(); @@ -325,7 +325,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index, const Span<MPoly> polys = me->polys(); const Span<MLoop> loops = me->loops(); - std::vector<unsigned long> vcount_list; + std::vector<ulong> vcount_list; bool is_triangulated = collect_vertex_counts_per_poly(me, material_index, vcount_list); int polygon_count = vcount_list.size(); @@ -585,7 +585,7 @@ void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::v COLLADASW::FloatSourceF source(mSW); source.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL)); source.setArrayId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL) + ARRAY_ID_SUFFIX); - source.setAccessorCount((unsigned long)nor.size()); + source.setAccessorCount((ulong)nor.size()); source.setAccessorStride(3); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); param.push_back("X"); @@ -612,7 +612,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, std::vector<BCPolygonNormalsIndices> &polygons_normals, Mesh *me) { - std::map<Normal, unsigned int> shared_normal_indices; + std::map<Normal, uint> shared_normal_indices; int last_normal_index = -1; const Span<MVert> verts = me->verts(); @@ -645,7 +645,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, BCPolygonNormalsIndices poly_indices; for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) { - unsigned int loop_idx = mpoly->loopstart + loop_index; + uint loop_idx = mpoly->loopstart + loop_index; if (use_vertex_normals) { float normalized[3]; diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 4b7c4275568..fea57698261 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -208,7 +208,7 @@ MeshImporter::MeshImporter(UnitConverter *unitconv, } bool MeshImporter::set_poly_indices( - MPoly *mpoly, MLoop *mloop, int loop_index, const unsigned int *indices, int loop_count) + MPoly *mpoly, MLoop *mloop, int loop_index, const uint *indices, int loop_count) { mpoly->loopstart = loop_index; mpoly->totloop = loop_count; @@ -276,7 +276,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) const std::string &name = bc_get_dae_name(mesh); - for (unsigned int i = 0; i < prim_arr.getCount(); i++) { + for (uint i = 0; i < prim_arr.getCount(); i++) { COLLADAFW::MeshPrimitive *mp = prim_arr[i]; COLLADAFW::MeshPrimitive::PrimitiveType type = mp->getPrimitiveType(); @@ -292,7 +292,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) int hole_count = 0; int nonface_count = 0; - for (unsigned int j = 0; j < vca.getCount(); j++) { + for (uint j = 0; j < vca.getCount(); j++) { int count = vca[j]; if (abs(count) < 3) { nonface_count++; @@ -455,7 +455,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) CustomData_add_layer(&me->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, me->totpoly); CustomData_add_layer(&me->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, me->totloop); - unsigned int totuvset = collada_mesh->getUVCoords().getInputInfosArray().getCount(); + uint totuvset = collada_mesh->getUVCoords().getInputInfosArray().getCount(); for (int i = 0; i < totuvset; i++) { if (collada_mesh->getUVCoords().getLength(i) == 0) { totuvset = 0; @@ -490,7 +490,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) } } -unsigned int MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) +uint MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) { int type = mp->getPrimitiveType(); int result; @@ -513,7 +513,7 @@ unsigned int MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) return result; } -unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) +uint MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) { COLLADAFW::MeshPrimitiveArray &prim_arr = mesh->getMeshPrimitives(); int loose_edge_count = 0; @@ -571,11 +571,11 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) { - unsigned int loose_edge_count = get_loose_edge_count(mesh); + uint loose_edge_count = get_loose_edge_count(mesh); if (loose_edge_count > 0) { - unsigned int face_edge_count = me->totedge; - /* unsigned int total_edge_count = loose_edge_count + face_edge_count; */ /* UNUSED */ + uint face_edge_count = me->totedge; + /* uint total_edge_count = loose_edge_count + face_edge_count; */ /* UNUSED */ mesh_add_edges(me, loose_edge_count); MutableSpan<MEdge> edges = me->edges_for_write(); @@ -588,8 +588,8 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) int type = mp->getPrimitiveType(); if (type == COLLADAFW::MeshPrimitive::LINES) { - unsigned int edge_count = mp->getFaceCount(); - unsigned int *indices = mp->getPositionIndices().getData(); + uint edge_count = mp->getFaceCount(); + uint *indices = mp->getPositionIndices().getData(); for (int j = 0; j < edge_count; j++, med++) { med->flag |= ME_LOOSEEDGE; @@ -605,7 +605,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me, blender::Vector<blender::float3> &loop_normals) { - unsigned int i; + uint i; allocate_poly_data(collada_mesh, me); @@ -632,8 +632,8 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, /* faces */ size_t prim_totpoly = mp->getFaceCount(); - unsigned int *position_indices = mp->getPositionIndices().getData(); - unsigned int *normal_indices = mp->getNormalIndices().getData(); + uint *position_indices = mp->getPositionIndices().getData(); + uint *normal_indices = mp->getNormalIndices().getData(); bool mp_has_normals = primitive_has_useable_normals(mp); bool mp_has_faces = primitive_has_faces(mp); @@ -649,22 +649,21 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, * XXX In particular the handling of the normal_indices is very wrong */ /* TODO: UV, vertex color and custom normal support */ if (collada_meshtype == COLLADAFW::MeshPrimitive::TRIANGLE_FANS) { - unsigned int grouped_vertex_count = mp->getGroupedVertexElementsCount(); - for (unsigned int group_index = 0; group_index < grouped_vertex_count; group_index++) { - unsigned int first_vertex = position_indices[0]; /* Store first trifan vertex */ - unsigned int first_normal = normal_indices[0]; /* Store first trifan vertex normal */ - unsigned int vertex_count = mp->getGroupedVerticesVertexCount(group_index); + uint grouped_vertex_count = mp->getGroupedVertexElementsCount(); + for (uint group_index = 0; group_index < grouped_vertex_count; group_index++) { + uint first_vertex = position_indices[0]; /* Store first trifan vertex */ + uint first_normal = normal_indices[0]; /* Store first trifan vertex normal */ + uint vertex_count = mp->getGroupedVerticesVertexCount(group_index); - for (unsigned int vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) { + for (uint vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) { /* For each triangle store indices of its 3 vertices */ - unsigned int triangle_vertex_indices[3] = { + uint triangle_vertex_indices[3] = { first_vertex, position_indices[1], position_indices[2]}; set_poly_indices(mpoly, mloop, loop_index, triangle_vertex_indices, 3); if (mp_has_normals) { /* vertex normals, same implementation as for the triangles */ /* The same for vertices normals. */ - unsigned int vertex_normal_indices[3] = { - first_normal, normal_indices[1], normal_indices[2]}; + uint vertex_normal_indices[3] = {first_normal, normal_indices[1], normal_indices[2]}; if (!is_flat_face(vertex_normal_indices, nor, 3)) { mpoly->flag |= ME_SMOOTH; } @@ -693,13 +692,13 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, collada_meshtype == COLLADAFW::MeshPrimitive::POLYGONS || collada_meshtype == COLLADAFW::MeshPrimitive::TRIANGLES) { COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp; - unsigned int start_index = 0; + uint start_index = 0; COLLADAFW::IndexListArray &index_list_array_uvcoord = mp->getUVCoordIndicesArray(); COLLADAFW::IndexListArray &index_list_array_vcolor = mp->getColorIndicesArray(); int invalid_loop_holes = 0; - for (unsigned int j = 0; j < prim_totpoly; j++) { + for (uint j = 0; j < prim_totpoly; j++) { /* Vertices in polygon: */ int vcount = get_vertex_count(mpvc, j); @@ -712,7 +711,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, invalid_loop_holes += 1; } - for (unsigned int uvset_index = 0; uvset_index < index_list_array_uvcoord.getCount(); + for (uint uvset_index = 0; uvset_index < index_list_array_uvcoord.getCount(); uvset_index++) { /* get mtface by face index and uv set index */ COLLADAFW::IndexList &index_list = *index_list_array_uvcoord[uvset_index]; @@ -743,7 +742,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, if (use_custom_normals) { /* Store the custom normals for later application. */ float vert_normal[3]; - unsigned int *cur_normal = normal_indices; + uint *cur_normal = normal_indices; for (int k = 0; k < vcount; k++, cur_normal++) { get_vector(vert_normal, nor, *cur_normal, 3); normalize_v3(vert_normal); @@ -755,7 +754,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, if (mp->hasColorIndices()) { int vcolor_count = index_list_array_vcolor.getCount(); - for (unsigned int vcolor_index = 0; vcolor_index < vcolor_count; vcolor_index++) { + for (uint vcolor_index = 0; vcolor_index < vcolor_count; vcolor_index++) { COLLADAFW::IndexList &color_index_list = *mp->getColorIndices(vcolor_index); COLLADAFW::String colname = extract_vcolname(color_index_list.getName()); @@ -847,7 +846,7 @@ void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData &arr, int i, } } -bool MeshImporter::is_flat_face(unsigned int *nind, COLLADAFW::MeshVertexData &nor, int count) +bool MeshImporter::is_flat_face(uint *nind, COLLADAFW::MeshVertexData &nor, int count) { float a[3], b[3]; @@ -1107,7 +1106,7 @@ Object *MeshImporter::create_mesh_object( COLLADAFW::MaterialBindingArray &mat_array = geom->getMaterialBindings(); /* loop through geom's materials */ - for (unsigned int i = 0; i < mat_array.getCount(); i++) { + for (uint i = 0; i < mat_array.getCount(); i++) { if (mat_array[i].getReferencedMaterial().isValid()) { assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid, i); diff --git a/source/blender/io/collada/SkinInfo.cpp b/source/blender/io/collada/SkinInfo.cpp index 8144e0a499d..0654bae3730 100644 --- a/source/blender/io/collada/SkinInfo.cpp +++ b/source/blender/io/collada/SkinInfo.cpp @@ -77,7 +77,7 @@ void SkinInfo::transfer_int_array_data_const(const COLLADAFW::IntValuesArray &sr void SkinInfo::transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray &src, COLLADAFW::UIntValuesArray &dest) { - dest.setData((unsigned int *)src.getData(), src.getCount()); + dest.setData((uint *)src.getData(), src.getCount()); dest.yieldOwnerShip(); } @@ -90,7 +90,7 @@ void SkinInfo::borrow_skin_controller_data(const COLLADAFW::SkinControllerData * /* cannot transfer data for FloatOrDoubleArray, copy values manually */ const COLLADAFW::FloatOrDoubleArray &weight = skin->getWeights(); - for (unsigned int i = 0; i < weight.getValuesCount(); i++) { + for (uint i = 0; i < weight.getValuesCount(); i++) { weights.push_back(bc_get_float_value(weight, i)); } @@ -118,7 +118,7 @@ void SkinInfo::set_controller(const COLLADAFW::SkinController *co) /* fill in joint UIDs */ const COLLADAFW::UniqueIdArray &joint_uids = co->getJoints(); - for (unsigned int i = 0; i < joint_uids.getCount(); i++) { + for (uint i = 0; i < joint_uids.getCount(); i++) { joint_data[i].joint_uid = joint_uids[i]; /* store armature pointer */ @@ -181,7 +181,7 @@ bool SkinInfo::uses_joint_or_descendant(COLLADAFW::Node *node) } COLLADAFW::NodePointerArray &children = node->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { if (uses_joint_or_descendant(children[i])) { return true; } @@ -254,9 +254,9 @@ void SkinInfo::link_armature(bContext *C, * * get def group by index with BLI_findlink */ - for (unsigned int vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) { + for (uint vertex = 0, weight = 0; vertex < joints_per_vertex.getCount(); vertex++) { - unsigned int limit = weight + joints_per_vertex[vertex]; + uint limit = weight + joints_per_vertex[vertex]; for (; weight < limit; weight++) { int joint = joint_indices[weight], joint_weight = weight_indices[weight]; @@ -319,7 +319,7 @@ bool SkinInfo::find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_ro } COLLADAFW::NodePointerArray &children = tree_root->getChildNodes(); - for (unsigned int i = 0; i < children.getCount(); i++) { + for (uint i = 0; i < children.getCount(); i++) { if (find_node_in_tree(node, children[i])) { return true; } diff --git a/source/blender/io/collada/TransformReader.cpp b/source/blender/io/collada/TransformReader.cpp index e5872c28bce..47deddb5feb 100644 --- a/source/blender/io/collada/TransformReader.cpp +++ b/source/blender/io/collada/TransformReader.cpp @@ -33,7 +33,7 @@ void TransformReader::get_node_mat(float mat[4][4], unit_m4(mat); - for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) { + for (uint i = 0; i < node->getTransformations().getCount(); i++) { COLLADAFW::Transformation *tm = node->getTransformations()[i]; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index da9a4cd4a9b..c4f13f1cbd2 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -153,7 +153,7 @@ void UnitConverter::calculate_scale(Scene &sce) * The COLLADA spec also allows additional chars for member access ('.'), these * must obviously be removed too, otherwise they would be heavily misinterpreted. */ -const unsigned char translate_start_name_map[256] = { +const uchar translate_start_name_map[256] = { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, @@ -172,7 +172,7 @@ const unsigned char translate_start_name_map[256] = { 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, }; -const unsigned char translate_name_map[256] = { +const uchar translate_name_map[256] = { 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, @@ -212,16 +212,16 @@ std::string translate_id(const std::string &id) } std::string id_translated = id; - id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]]; - for (unsigned int i = 1; i < id_translated.size(); i++) { - id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; + id_translated[0] = translate_start_name_map[(uint)id_translated[0]]; + for (uint i = 1; i < id_translated.size(); i++) { + id_translated[i] = translate_name_map[(uint)id_translated[i]]; } /* It's so much workload now, the if () should speed up things. */ if (id_translated != id) { /* Search duplicates. */ map_string_list::iterator iter = global_id_map.find(id_translated); if (iter != global_id_map.end()) { - unsigned int i = 0; + uint i = 0; bool found = false; for (i = 0; i < iter->second.size(); i++) { if (id == iter->second[i]) { diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index 03bc14c6d13..bfa150faf8b 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -66,7 +66,7 @@ #include "ExportSettings.h" #include "collada_utils.h" -float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, unsigned int index) +float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, uint index) { if (index >= array.getValuesCount()) { return 0.0f; |