Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/AnimationExporter.cpp54
-rw-r--r--source/blender/collada/AnimationExporter.h22
-rw-r--r--source/blender/collada/AnimationImporter.cpp84
-rw-r--r--source/blender/collada/AnimationImporter.h18
-rw-r--r--source/blender/collada/ArmatureExporter.cpp10
-rw-r--r--source/blender/collada/ArmatureImporter.cpp38
-rw-r--r--source/blender/collada/ArmatureImporter.h6
-rw-r--r--source/blender/collada/CameraExporter.cpp4
-rw-r--r--source/blender/collada/ControllerExporter.cpp24
-rw-r--r--source/blender/collada/DocumentExporter.cpp16
-rw-r--r--source/blender/collada/DocumentImporter.cpp106
-rw-r--r--source/blender/collada/DocumentImporter.h6
-rw-r--r--source/blender/collada/EffectExporter.cpp30
-rw-r--r--source/blender/collada/EffectExporter.h12
-rw-r--r--source/blender/collada/ErrorHandler.cpp2
-rw-r--r--source/blender/collada/ExtraHandler.cpp4
-rw-r--r--source/blender/collada/ExtraHandler.h18
-rw-r--r--source/blender/collada/ExtraTags.cpp2
-rw-r--r--source/blender/collada/ExtraTags.h16
-rw-r--r--source/blender/collada/GeometryExporter.cpp98
-rw-r--r--source/blender/collada/GeometryExporter.h6
-rw-r--r--source/blender/collada/ImageExporter.cpp10
-rw-r--r--source/blender/collada/ImageExporter.h4
-rw-r--r--source/blender/collada/LightExporter.cpp16
-rw-r--r--source/blender/collada/MaterialExporter.h2
-rw-r--r--source/blender/collada/MeshImporter.cpp108
-rw-r--r--source/blender/collada/MeshImporter.h10
-rw-r--r--source/blender/collada/SceneExporter.cpp18
-rw-r--r--source/blender/collada/SceneExporter.h2
-rw-r--r--source/blender/collada/SkinInfo.cpp8
-rw-r--r--source/blender/collada/SkinInfo.h4
-rw-r--r--source/blender/collada/TransformReader.cpp6
-rw-r--r--source/blender/collada/TransformReader.h2
-rw-r--r--source/blender/collada/TransformWriter.cpp2
-rw-r--r--source/blender/collada/collada_internal.h8
-rw-r--r--source/blender/collada/collada_utils.cpp26
-rw-r--r--source/blender/collada/collada_utils.h8
37 files changed, 405 insertions, 405 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index c891414f088..bf371332fd0 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -270,7 +270,7 @@ void AnimationExporter::export_sampled_transrotloc_animation(Object *ob, std::ve
create_sampled_animation(3, ctimes, baked_curves[SCALE], ob_name, "scale", "", false);
create_sampled_animation(3, ctimes, baked_curves[LOC], ob_name, "location", "", false);
- /* Not sure how to export rotation as a 3channel animation,
+ /* Not sure how to export rotation as a 3channel animation,
* so separate into 3 single animations for now:
*/
@@ -314,7 +314,7 @@ void AnimationExporter::operator()(Object *ob)
//This needs to be handled by extra profiles, so postponed for now
//export_morph_animation(ob);
-
+
//Export Lamp parameter animations
if ( (ob->type == OB_LAMP) && ((Lamp *)ob->data)->adt && ((Lamp *)ob->data)->adt->action) {
FCurve *fcu = (FCurve *)(((Lamp *)ob->data)->adt->action->curves.first);
@@ -338,7 +338,7 @@ void AnimationExporter::operator()(Object *ob)
if ((STREQ(transformName, "lens")) ||
(STREQ(transformName, "ortho_scale")) ||
- (STREQ(transformName, "clip_end")) ||
+ (STREQ(transformName, "clip_end")) ||
(STREQ(transformName, "clip_start")))
{
create_keyframed_animation(ob, fcu, transformName, true);
@@ -380,7 +380,7 @@ void AnimationExporter::export_object_constraint_animation(Object *ob)
}
void AnimationExporter::export_morph_animation(Object *ob)
-{
+{
FCurve *fcu;
char *transformName;
Key *key = BKE_key_from_object(ob);
@@ -388,12 +388,12 @@ void AnimationExporter::export_morph_animation(Object *ob)
if (key->adt && key->adt->action) {
fcu = (FCurve *)key->adt->action->curves.first;
-
+
while (fcu) {
transformName = extract_transform_name(fcu->rna_path);
create_keyframed_animation(ob, fcu, transformName, true);
-
+
fcu = fcu->next;
}
}
@@ -407,17 +407,17 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
bConstraint *con;
for (con = (bConstraint *)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL};
-
+
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
-
+
if (!validateConstraints(con)) continue;
if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct;
Object *obtar;
- /* get targets
+ /* get targets
* - constraints should use ct->matrix, not directly accessing values
- * - ct->matrix members have not yet been calculated here!
+ * - ct->matrix members have not yet been calculated here!
*/
cti->get_constraint_targets(con, &targets);
@@ -438,7 +438,7 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
float *AnimationExporter::get_eul_source_for_quat(Object *ob)
{
FCurve *fcu = (FCurve *)ob->adt->action->curves.first;
- const int keys = fcu->totvert;
+ const int keys = fcu->totvert;
float *quat = (float *)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values");
float *eul = (float *)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values");
float temp_quat[4];
@@ -520,11 +520,11 @@ void AnimationExporter::create_keyframed_animation(Object *ob, FCurve *fcu, char
/*
* Note: Handle transformation animations separately (to apply matrix inverse to fcurves)
- * We will use the object to evaluate the animation on all keyframes and calculate the
+ * We will use the object to evaluate the animation on all keyframes and calculate the
* resulting object matrix. We need this to incorporate the
* effects of the parent inverse matrix (when it contains a rotation component)
*
- * TODO: try to combine exported fcurves into 3 channel animations like done
+ * TODO: try to combine exported fcurves into 3 channel animations like done
* in export_sampled_animation(). For now each channel is exported as separate <Animation>.
*/
@@ -648,7 +648,7 @@ void AnimationExporter::create_keyframed_animation(Object *ob, FCurve *fcu, char
"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
//if shape key animation, this is the main problem, how to define the channel targets.
/*target = get_morph_id(ob) +
- "/value" +*/
+ "/value" +*/
}
addChannel(COLLADABU::URI(empty, sampler_id), target);
@@ -673,7 +673,7 @@ void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
}
bool AnimationExporter::is_bone_deform_group(Bone *bone)
-{
+{
bool is_def;
//Check if current bone is deform
if ((bone->flag & BONE_NO_DEFORM) == 0) return true;
@@ -707,7 +707,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
fcu = fcu->next;
}
- if (!(fcu)) return;*/
+ if (!(fcu)) return;*/
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
if (!pchan)
@@ -728,7 +728,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
dae_baked_animation(fra, ob_arm, bone);
}
- if (flag & ARM_RESTPOS)
+ if (flag & ARM_RESTPOS)
arm->flag = flag;
BKE_pose_where_is(scene, ob_arm);
}
@@ -921,7 +921,7 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
if (axis) {
param.push_back(axis);
}
- else
+ else
if (transform) {
param.push_back("TRANSFORM");
}
@@ -1307,7 +1307,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
enable_fcurves(ob->adt->action, bone->name);
}
-
+
std::vector<float>::iterator it;
int j = 0;
for (it = frames.begin(); it != frames.end(); it++) {
@@ -1325,7 +1325,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
else {
BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
}
-
+
// compute bone local mat
if (bone->parent) {
invert_m4_m4(ipar, parchan->pose_mat);
@@ -1333,7 +1333,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
}
else
copy_m4_m4(mat, pchan->pose_mat);
-
+
/* OPEN_SIM_COMPATIBILITY
* AFAIK animation to second life is via BVH, but no
* reason to not have the collada-animation be correct
@@ -1358,7 +1358,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
else {
copy_m4_m4(mat, ob->obmat);
}
-
+
UnitConverter converter;
double outmat[4][4];
@@ -1514,7 +1514,7 @@ std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type,
if (tm_name.size()) {
if (axis_name[0])
return tm_name + "." + std::string(axis_name);
- else
+ else
return tm_name;
}
@@ -1563,7 +1563,7 @@ std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type,
if (tm_name.size()) {
if (axis_name[0])
return tm_name + "." + std::string(axis_name);
- else
+ else
return tm_name;
}
@@ -1750,7 +1750,7 @@ void AnimationExporter::find_sampleframes(Object *ob, std::vector<float> &fra)
} while (true);
}
-/*
+/*
* find keyframes of all the objects animations
*/
void AnimationExporter::find_keyframes(Object *ob, std::vector<float> &fra)
@@ -1843,7 +1843,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
arm->flag &= ~ARM_RESTPOS;
BKE_pose_where_is(scene, ob_arm);
}
- //v array will hold all values which will be exported.
+ //v array will hold all values which will be exported.
if (fra.size()) {
float *values = (float *)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames");
sample_animation(values, fra, transform_type, bone, ob_arm, pchan);
@@ -1869,7 +1869,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
}
// restore restpos
- if (flag & ARM_RESTPOS)
+ if (flag & ARM_RESTPOS)
arm->flag = flag;
BKE_pose_where_is(scene, ob_arm);
}
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index a739b2b6cbe..36968d3edef 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
-extern "C"
+extern "C"
{
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
@@ -99,8 +99,8 @@ public:
bool exportAnimations(Scene *sce);
// called for each exported object
- void operator() (Object *ob);
-
+ void operator() (Object *ob);
+
protected:
const ExportSettings *export_settings;
@@ -126,7 +126,7 @@ protected:
// dae_bone_animation -> add_bone_animation
// (blend this into dae_bone_animation)
void dae_bone_animation(std::vector<float> &fra, float *v, int tm_type, int axis, std::string ob_name, std::string bone_name);
-
+
void dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone);
void dae_baked_object_animation(std::vector<float> &fra, Object *ob);
@@ -139,9 +139,9 @@ protected:
void add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform);
-
+
void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool is_angle, float *values, int *length);
-
+
float* get_eul_source_for_quat(Object *ob );
bool is_flat_line(std::vector<float> &values, int channel_count);
@@ -170,12 +170,12 @@ protected:
std::string create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents);
std::string fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name);
-
+
// for rotation, axis name is always appended and the value of append_axis is ignored
std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis);
std::string get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis);
std::string get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis);
-
+
void find_keyframes(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name);
void find_keyframes(Object *ob, std::vector<float> &fra);
void find_sampleframes(Object *ob, std::vector<float> &fra);
@@ -184,13 +184,13 @@ protected:
void make_anim_frames_from_targets(Object *ob, std::vector<float> &frames );
void find_rotation_frames(Object *ob, std::vector<float> &fra, const char *prefix, int rotmode);
-
+
// enable fcurves driving a specific bone, disable all the rest
// if bone_name = NULL enable all fcurves
void enable_fcurves(bAction *act, char *bone_name);
-
+
bool hasAnimations(Scene *sce);
-
+
char *extract_transform_name(char *rna_path);
std::string getObjectBoneName(Object *ob, const FCurve * fcu);
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 13bd5c16053..3dda67abbba 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -118,7 +118,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
// input, output
- bez.vec[1][0] = bc_get_float_value(input, j) * fps;
+ bez.vec[1][0] = bc_get_float_value(input, j) * fps;
bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
@@ -135,14 +135,14 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
// outtangent
bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim) + (2 * i)) * fps;
bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim) + (2 * i) + 1);
- if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER)
+ if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER)
bez.ipo = BEZT_IPO_BEZ;
- else
+ else
bez.ipo = BEZT_IPO_CONST;
//bez.h1 = bez.h2 = HD_AUTO;
}
else {
- bez.h1 = bez.h2 = HD_AUTO;
+ bez.h1 = bez.h2 = HD_AUTO;
bez.ipo = BEZT_IPO_LIN;
}
// bez.ipo = U.ipo_new; /* use default interpolation mode here... */
@@ -183,10 +183,10 @@ void AnimationImporter::fcurve_is_used(FCurve *fcu)
void AnimationImporter::add_fcurves_to_object(Main *bmain, Object *ob, std::vector<FCurve *>& curves, char *rna_path, int array_index, Animation *animated)
{
bAction *act;
-
+
if (!ob->adt || !ob->adt->action) act = verify_adt_action(bmain, (ID *)&ob->id, 1);
else act = ob->adt->action;
-
+
std::vector<FCurve *>::iterator it;
int i;
@@ -198,39 +198,39 @@ void AnimationImporter::add_fcurves_to_object(Main *bmain, Object *ob, std::vect
if (is_rotation)
fcurve_deg_to_rad(fcu);
#endif
-
+
for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) {
FCurve *fcu = *it;
fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
-
+
if (array_index == -1) fcu->array_index = i;
else fcu->array_index = array_index;
-
+
if (ob->type == OB_ARMATURE) {
bActionGroup *grp = NULL;
const char *bone_name = bc_get_joint_name(animated->node);
-
+
if (bone_name) {
/* try to find group */
grp = BKE_action_group_find_name(act, bone_name);
-
+
/* no matching groups, so add one */
if (grp == NULL) {
/* Add a new group, and make it active */
grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-
+
grp->flag = AGRP_SELECTED;
BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
-
+
BLI_addtail(&act->groups, grp);
BLI_uniquename(&act->groups, grp, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "Group"), '.',
offsetof(bActionGroup, name), 64);
}
-
+
/* add F-Curve to group */
action_groups_add_channel(act, grp, fcu);
fcurve_is_used(fcu);
-
+
}
#if 0
if (is_rotation) {
@@ -263,7 +263,7 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation *anim)
{
if (anim->getAnimationType() == COLLADAFW::Animation::ANIMATION_CURVE) {
COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve *)anim;
-
+
// XXX Don't know if it's necessary
// Should we check outPhysicalDimension?
if (curve->getInPhysicalDimension() != COLLADAFW::PHYSICAL_DIMENSION_TIME) {
@@ -296,10 +296,10 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation *anim)
else {
fprintf(stderr, "FORMULA animation type is not supported yet.\n");
}
-
+
return true;
}
-
+
// called on post-process stage after writeVisualScenes
bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList *animlist)
{
@@ -340,16 +340,16 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
{
bActionGroup *grp;
int i;
-
+
for (grp = (bActionGroup *)act->groups.first; grp; grp = grp->next) {
FCurve *eulcu[3] = {NULL, NULL, NULL};
-
+
if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end())
continue;
std::vector<FCurve *> &rot_fcurves = fcurves_actionGroup_map[grp];
-
+
if (rot_fcurves.size() > 3) continue;
for (i = 0; i < rot_fcurves.size(); i++)
@@ -437,7 +437,7 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve *> *curves, const char
for (it = curves->begin(), i = 0; it != curves->end(); it++, i++) {
FCurve *fcu = *it;
fcu->rna_path = BLI_strdup(rna_path);
-
+
if (array_index == -1) fcu->array_index = i;
else fcu->array_index = array_index;
@@ -674,7 +674,7 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
}
}
}
-
+
}
float AnimationImporter::convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx)
@@ -711,7 +711,7 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId& listid
//Add the curves of the current animation to the object
for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
FCurve *fcu = *iter;
-
+
for (unsigned int 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(fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x);
@@ -949,7 +949,7 @@ void AnimationImporter::translate_Animations(Main *bmain, COLLADAFW::Node *node,
const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations();
- //for each transformation in node
+ //for each transformation in node
for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) {
COLLADAFW::Transformation *transform = nodeTransforms[i];
COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType();
@@ -986,12 +986,12 @@ void AnimationImporter::translate_Animations(Main *bmain, COLLADAFW::Node *node,
//Add the curves of the current animation to the object
for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
FCurve *fcu = *iter;
-
+
BLI_addtail(AnimCurves, fcu);
fcurve_is_used(fcu);
}
}
-
+
}
}
}
@@ -1017,7 +1017,7 @@ void AnimationImporter::translate_Animations(Main *bmain, COLLADAFW::Node *node,
const COLLADAFW::Color *col = &(light->getColor());
const COLLADAFW::UniqueId& listid = col->getAnimationList();
- Assign_color_animations(listid, AnimCurves, "color");
+ Assign_color_animations(listid, AnimCurves, "color");
}
if ((animType->light & LIGHT_FOA) != 0) {
const COLLADAFW::AnimatableFloat *foa = &(light->getFallOffAngle());
@@ -1051,14 +1051,14 @@ void AnimationImporter::translate_Animations(Main *bmain, COLLADAFW::Node *node,
if ((animType->camera & CAMERA_XFOV) != 0) {
const COLLADAFW::AnimatableFloat *xfov = &(camera->getXFov());
const COLLADAFW::UniqueId& listid = xfov->getAnimationList();
- double aspect = get_aspect_ratio(camera);
+ double aspect = get_aspect_ratio(camera);
Assign_lens_animations(listid, AnimCurves, aspect, cam, "lens", CAMERA_XFOV);
}
else if ((animType->camera & CAMERA_YFOV) != 0) {
const COLLADAFW::AnimatableFloat *yfov = &(camera->getYFov());
const COLLADAFW::UniqueId& listid = yfov->getAnimationList();
- double aspect = get_aspect_ratio(camera);
+ double aspect = get_aspect_ratio(camera);
Assign_lens_animations(listid, AnimCurves, aspect, cam, "lens", CAMERA_YFOV);
}
@@ -1281,7 +1281,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type(const COLLADAF
const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations();
- //for each transformation in node
+ //for each transformation in node
for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) {
COLLADAFW::Transformation *transform = nodeTransforms[i];
const COLLADAFW::UniqueId& listid = transform->getAnimationList();
@@ -1369,7 +1369,7 @@ int AnimationImporter::setAnimType(const COLLADAFW::Animatable *prop, int types,
anim_type = types;
return anim_type;
-}
+}
// Is not used anymore.
void AnimationImporter::find_frames_old(std::vector<float> *frames, COLLADAFW::Node *node, COLLADAFW::Transformation::TransformationType tm_type)
@@ -1391,7 +1391,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, COLLADAFW::N
const COLLADAFW::UniqueId& listid = transform->getAnimationList();
//if transform is animated its animlist must exist.
if (animlist_map.find(listid) != animlist_map.end()) {
-
+
const COLLADAFW::AnimationList *animlist = animlist_map[listid];
const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
@@ -1441,11 +1441,11 @@ Object *AnimationImporter::translate_animation_OLD(Main *bmain, COLLADAFW::Node
COLLADAFW::Transformation::TransformationType tm_type,
Object *par_job)
{
-
+
bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
-
+
COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()];
const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
@@ -1456,11 +1456,11 @@ Object *AnimationImporter::translate_animation_OLD(Main *bmain, COLLADAFW::Node
// frames at which to sample
std::vector<float> frames;
-
+
find_frames_old(&frames, node, tm_type);
-
+
unsigned int i;
-
+
float irest_dae[4][4];
float rest[4][4], irest[4][4];
@@ -1731,9 +1731,9 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
}
}
-static void report_class_type_unsupported(const char *path,
+static void report_class_type_unsupported(const char *path,
const COLLADAFW::AnimationList::AnimationClass animclass,
- const COLLADAFW::Transformation::TransformationType type)
+ const COLLADAFW::Transformation::TransformationType type)
{
if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
fprintf(stderr, "%s: UNKNOWN animation class\n", path);
@@ -1828,7 +1828,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
fprintf(stderr, "%s: expected 1 curve, got %d\n", path, (int)curves.size());
return false;
}
-
+
switch (animclass) {
case COLLADAFW::AnimationList::POSITION_X:
vec[0] = evaluate_fcurve(curves[0], fra);
@@ -2010,7 +2010,7 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv
{
const char *bone_name = bc_get_joint_name(node);
bAction *act = ob->adt->action;
-
+
/* try to find group */
bActionGroup *grp = BKE_action_group_find_name(act, bone_name);
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 0957b1e6e06..f63329158f0 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -19,7 +19,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
/** \file AnimationImporter.h
* \ingroup collada
*/
@@ -75,9 +75,9 @@ private:
std::map<COLLADAFW::UniqueId, const COLLADAFW::AnimationList*> animlist_map;
std::vector<FCurve*> unused_curves;
std::map<COLLADAFW::UniqueId, Object*> joint_objects;
-
+
FCurve *create_fcurve(int array_index, const char *rna_path);
-
+
void add_bezt(FCurve *fcu, float frame, float value, eBezTriple_Interpolation ipo=BEZT_IPO_LIN);
// create one or several fcurves depending on the number of parameters being animated
@@ -89,7 +89,7 @@ private:
void add_fcurves_to_object(Main *bmain, Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
-
+
int typeFlag;
std::string import_from_version;
@@ -121,7 +121,7 @@ private:
MATERIAL_TRANSPARENCY = 1 << 4,
MATERIAL_IOR = 1 << 5
};
-
+
enum AnimationType
{
INANIMATE = 0,
@@ -144,7 +144,7 @@ public:
void set_import_from_version(std::string import_from_version);
bool write_animation(const COLLADAFW::Animation* anim);
-
+
// called on post-process stage after writeVisualScenes
bool write_animation_list(const COLLADAFW::AnimationList* animlist);
@@ -163,7 +163,7 @@ public:
void apply_matrix_curves(Main *bmain, Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
COLLADAFW::Transformation * tm );
-
+
void add_bone_animation_sampled(Main *bmain, Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
void Assign_transform_animations(COLLADAFW::Transformation* transform,
@@ -175,7 +175,7 @@ public:
void Assign_lens_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const double aspect, Camera *cam, const char *anim_type, int fov_type);
int setAnimType ( const COLLADAFW::Animatable * prop, int type, int addition);
-
+
void modify_fcurve(std::vector<FCurve*>* curves, const char *rna_path, int array_index );
void unused_fcurve(std::vector<FCurve*>* curves );
// prerequisites:
@@ -186,7 +186,7 @@ public:
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
COLLADAFW::Transformation::TransformationType tm_type,
Object *par_job = NULL);
-
+
void find_frames( std::vector<float>* frames, std::vector<FCurve*>* curves );
void find_frames_old( std::vector<float>* frames, COLLADAFW::Node * node, COLLADAFW::Transformation::TransformationType tm_type );
// internal, better make it private
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 9afe4662f74..52f7c5627b9 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -117,11 +117,11 @@ bool ArmatureExporter::add_instance_controller(Object *ob)
write_bone_URLs(ins, ob_arm, bone);
}
- InstanceWriter::add_material_bindings(ins.getBindMaterial(),
- ob,
+ InstanceWriter::add_material_bindings(ins.getBindMaterial(),
+ ob,
this->export_settings->active_uv_only,
this->export_settings->export_texture_type);
-
+
ins.add();
return true;
}
@@ -150,7 +150,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
Base *base = (Base *) sce->base.first;
while (base) {
Object *ob = base->object;
-
+
if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) {
objects.push_back(ob);
}
@@ -268,7 +268,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
if (!has_restmat) {
/* Have no restpose matrix stored, try old style <= Blender 2.78 */
-
+
bc_create_restpose_mat(this->export_settings, bone, bone_rest_mat, bone->arm_mat, true);
if (bone->parent) {
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 964f1f6b9e4..cfb25f5d117 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -59,7 +59,7 @@ ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh,
scene(sce),
unit_converter(conv),
import_settings(import_settings),
- empty(NULL),
+ empty(NULL),
mesh_importer(mesh) {
}
@@ -101,7 +101,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBon
std::vector<COLLADAFW::Node *>::iterator it;
it = std::find(finished_joints.begin(), finished_joints.end(), node);
if (it != finished_joints.end()) return chain_length;
-
+
EditBone *bone = ED_armature_ebone_add(arm, bc_get_joint_name(node));
totbone++;
@@ -139,7 +139,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBon
if (parent) bone->parent = parent;
- float loc[3], size[3], rot[3][3];
+ float loc[3], size[3], rot[3][3];
BoneExtensionMap &extended_bones = bone_extension_manager.getExtensionMap(arm);
BoneExtended &be = add_bone_extended(bone, node, totchild, layer_labels, extended_bones);
int layer = be.get_bone_layers();
@@ -384,7 +384,7 @@ void ArmatureImporter::set_euler_rotmode()
COLLADAFW::Node *joint = it->second;
std::map<COLLADAFW::UniqueId, SkinInfo>::iterator sit;
-
+
for (sit = skin_by_data_uid.begin(); sit != skin_by_data_uid.end(); sit++) {
SkinInfo& skin = sit->second;
@@ -408,7 +408,7 @@ void ArmatureImporter::set_euler_rotmode()
Object *ArmatureImporter::get_empty_for_leaves()
{
if (empty) return empty;
-
+
empty = bc_add_object(scene, OB_EMPTY, NULL);
empty->empty_drawtype = OB_EMPTY_SPHERE;
@@ -454,7 +454,7 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *>
//if there is an armature created for root_joint next root_joint
for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
if (get_armature_for_joint(*ri) != NULL) continue;
-
+
Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
if (!ob_arm)
continue;
@@ -570,8 +570,8 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo& skin)
}
if (!shared && this->joint_parent_map.size() > 0) {
- // All armatures have been created while creating the Node tree.
- // The Collada exporter currently does not create a
+ // All armatures have been created while creating the Node tree.
+ // The Collada exporter currently does not create a
// strict relationship between geometries and armatures
// So when we reimport a Blender collada file, then we have
// to guess what is meant.
@@ -655,12 +655,12 @@ void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, con
}
else {
-
+
copy_m4_m4(mat, obmat);
float invObmat[4][4];
invert_m4_m4(invObmat, ob_arm->obmat);
mul_m4_m4m4(pchan->pose_mat, invObmat, mat);
-
+
}
//float angle = 0.0f;
@@ -756,7 +756,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object
// free memory stolen from SkinControllerData
skin.free();
}
-
+
//for bones without skins
create_armature_bones(bmain, ob_arms);
@@ -806,9 +806,9 @@ bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControlle
// don't forget to call defgroup_unique_name before we copy
- // controller data uid -> [armature] -> joint data,
+ // controller data uid -> [armature] -> joint data,
// [mesh object]
- //
+ //
SkinInfo skin(unit_converter);
skin.borrow_skin_controller_data(data);
@@ -866,7 +866,7 @@ void ArmatureImporter::make_shape_keys()
//Prereq: all the geometries must be imported and mesh objects must be made
Object *source_ob = this->mesh_importer->get_object_by_geom_uid((*mc)->getSource());
-
+
if (source_ob) {
Mesh *source_me = (Mesh *)source_ob->data;
@@ -874,7 +874,7 @@ void ArmatureImporter::make_shape_keys()
Key *key = source_me->key = BKE_key_add((ID *)source_me);
key->type = KEY_RELATIVE;
KeyBlock *kb;
-
+
//insert basis key
kb = BKE_keyblock_add_ctime(key, "Basis", false);
BKE_keyblock_convert_from_mesh(source_me, kb);
@@ -885,14 +885,14 @@ void ArmatureImporter::make_shape_keys()
//This'll do for now since only mesh morphing is imported
Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
-
+
if (me) {
me->key = key;
std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), false);
BKE_keyblock_convert_from_mesh(me, kb);
-
+
//apply weights
weight = morphWeights.getFloatValues()->getData()[i];
kb->curval = weight;
@@ -988,14 +988,14 @@ BoneExtended &ArmatureImporter::add_bone_extended(EditBone *bone, COLLADAFW::Nod
has_connect = et->setData("connect", &connect_type);
bool has_roll = et->setData("roll", &roll);
-
+
layers = et->setData("layer", layers);
if (has_tail && !has_connect)
{
/* got a bone tail definition but no connect info -> bone is not connected */
has_connect = true;
- connect_type = 0;
+ connect_type = 0;
}
be->set_bone_layers(layers, layer_labels);
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index fbce14f1b05..87a7ae73a24 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -157,16 +157,16 @@ public:
bool write_controller(const COLLADAFW::Controller* controller);
COLLADAFW::UniqueId *get_geometry_uid(const COLLADAFW::UniqueId& controller_uid);
-
+
Object *get_armature_for_joint(COLLADAFW::Node *node);
void get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count);
-
+
// gives a world-space mat
bool get_joint_bind_mat(float m[4][4], COLLADAFW::Node *joint);
void set_tags_map( TagsMap& tags_map);
-
+
};
#endif
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index 649288c2db4..32bd24f1e0b 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -56,9 +56,9 @@ void forEachCameraObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set
void CamerasExporter::exportCameras(Scene *sce)
{
openLibrary();
-
+
forEachCameraObjectInExportSet(sce, *this, this->export_settings->export_set);
-
+
closeLibrary();
}
void CamerasExporter::operator()(Object *ob, Scene *sce)
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 14e8e0323a8..c89e0f1ec62 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -99,10 +99,10 @@ bool ControllerExporter::add_instance_controller(Object *ob)
}
InstanceWriter::add_material_bindings(ins.getBindMaterial(),
- ob,
+ ob,
this->export_settings->active_uv_only,
this->export_settings->export_texture_type);
-
+
ins.add();
return true;
}
@@ -150,7 +150,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
Base *base = (Base *) sce->base.first;
while (base) {
Object *ob = base->object;
-
+
if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) {
objects.push_back(ob);
}
@@ -205,7 +205,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
this->export_settings->export_mesh_type,
this->export_settings->apply_modifiers,
this->export_settings->triangulate);
-
+
if (!me->dvert) return;
std::string controller_name = id_name(ob_arm);
@@ -248,7 +248,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
for (j = 0; j < vert->totweight; j++) {
int idx = vert->dw[j].def_nr;
if (idx >= joint_index_by_def_index.size()) {
- // XXX: Maybe better find out where and
+ // XXX: Maybe better find out where and
// why the Out Of Bound indexes get created ?
oob_counter += 1;
}
@@ -316,7 +316,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
std::string targets_id = add_morph_targets(key, ob);
std::string morph_weights_id = add_morph_weights(key, ob);
-
+
COLLADASW::TargetsElement targets(mSW);
COLLADASW::InputList &input = targets.getInputList();
@@ -378,7 +378,7 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("MORPH_WEIGHT");
-
+
source.prepareToAppendValues();
KeyBlock *kb = (KeyBlock *)key->block.first;
@@ -398,7 +398,7 @@ void ControllerExporter::add_weight_extras(Key *key)
{
// can also try the base element and param alternative
COLLADASW::BaseExtraTechnique extra;
-
+
KeyBlock * kb = (KeyBlock *)key->block.first;
//skip the basis
kb = kb->next;
@@ -449,7 +449,7 @@ std::string ControllerExporter::add_joints_source(Object *ob_arm, ListBase *defb
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(totjoint);
source.setAccessorStride(1);
-
+
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("JOINT");
@@ -482,7 +482,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(totjoint); //BLI_listbase_count(defbase));
source.setAccessorStride(16);
-
+
source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4);
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("TRANSFORM");
@@ -511,7 +511,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
float bind_mat[4][4]; /* derived from bone->arm_mat */
bool has_bindmat = bc_get_property_matrix(pchan->bone, "bind_mat", bind_mat);
-
+
if (!has_bindmat) {
/* Have no bind matrix stored, try old style <= Blender 2.78 */
@@ -573,7 +573,7 @@ std::string ControllerExporter::add_weights_source(Mesh *me, const std::string&
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(weights.size());
source.setAccessorStride(1);
-
+
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("WEIGHT");
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 472bd326205..f1838b9dbb6 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -62,7 +62,7 @@
#include "COLLADASWInstanceNode.h"
#include "COLLADASWBaseInputElement.h"
-extern "C"
+extern "C"
{
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
@@ -258,14 +258,14 @@ int DocumentExporter::exportCurrentScene(bContext *C, const EvaluationContext *e
#endif
asset.getContributor().mAuthoringTool = version_buf;
asset.add();
-
+
LinkNode *export_set = this->export_settings->export_set;
// <library_cameras>
if (bc_has_object_type(export_set, OB_CAMERA)) {
CamerasExporter ce(writer, this->export_settings);
ce.exportCameras(sce);
}
-
+
// <library_lights>
if (bc_has_object_type(export_set, OB_LAMP)) {
LightsExporter le(writer, this->export_settings);
@@ -275,11 +275,11 @@ int DocumentExporter::exportCurrentScene(bContext *C, const EvaluationContext *e
// <library_images>
ImagesExporter ie(writer, this->export_settings);
ie.exportImages(sce);
-
+
// <library_effects>
EffectsExporter ee(writer, this->export_settings);
ee.exportEffects(sce);
-
+
// <library_materials>
MaterialsExporter me(writer, this->export_settings);
me.exportMaterials(sce);
@@ -293,7 +293,7 @@ int DocumentExporter::exportCurrentScene(bContext *C, const EvaluationContext *e
// <library_controllers>
ArmatureExporter arm_exporter(writer, this->export_settings);
ControllerExporter controller_exporter(writer, this->export_settings);
- if (bc_has_object_type(export_set, OB_ARMATURE) || this->export_settings->include_shapekeys)
+ if (bc_has_object_type(export_set, OB_ARMATURE) || this->export_settings->include_shapekeys)
{
controller_exporter.export_controllers(sce);
}
@@ -308,13 +308,13 @@ int DocumentExporter::exportCurrentScene(bContext *C, const EvaluationContext *e
ae.exportAnimations(sce);
}
se.exportScene(C, sce);
-
+
// <scene>
std::string scene_name(translate_id(id_name(sce)));
COLLADASW::Scene scene(writer, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING,
scene_name));
scene.add();
-
+
// close <Collada>
writer->endDocument();
delete writer;
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 03fcc2e5037..4173a024552 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -126,7 +126,7 @@ bool DocumentImporter::import()
COLLADASaxFWL::Loader loader(&errorHandler);
COLLADAFW::Root root(&loader, this);
ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer));
-
+
loader.registerExtraDataCallbackHandler(ehandler);
// deselect all to select new objects
@@ -139,19 +139,19 @@ bool DocumentImporter::import()
delete ehandler;
return false;
}
-
+
if (errorHandler.hasError()) {
delete ehandler;
return false;
}
-
+
/** TODO set up scene graph and such here */
-
+
mImportStage = Controller;
-
+
COLLADASaxFWL::Loader loader2;
COLLADAFW::Root root2(&loader2, this);
-
+
if (!root2.loadDocument(encodedFilename)) {
fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n");
delete ehandler;
@@ -194,7 +194,7 @@ void DocumentImporter::finish()
for (sit = vscenes.begin(); sit != vscenes.end(); sit++) {
PointerRNA sceneptr, unit_settings;
PropertyRNA *system, *scale;
-
+
// for scene unit settings: system, scale_length
RNA_id_pointer_create(&sce->id, &sceneptr);
@@ -203,7 +203,7 @@ void DocumentImporter::finish()
scale = RNA_struct_find_property(&unit_settings, "scale_length");
if (this->import_settings->import_units) {
-
+
switch (unit_converter.isMetricSystem()) {
case UnitConverter::Metric:
RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
@@ -276,7 +276,7 @@ void DocumentImporter::finish()
DAG_relations_tag_update(bmain);
}
-
+
bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units);
delete objects_to_scale;
@@ -477,7 +477,7 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
short type = 0;
et->setData("type", &type);
BKE_constraint_add_for_object(ob, "Test_con", type);
-
+
}
}
@@ -639,7 +639,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
root_objects->push_back(ob);
}
}
-
+
// XXX: if there're multiple instances, only one is stored
if (!ob) {
@@ -705,7 +705,7 @@ bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScen
{
if (mImportStage != General)
return true;
-
+
// this method called on post process after writeGeometry, writeMaterial, etc.
// for each <node> in <visual_scene>:
@@ -717,18 +717,18 @@ bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScen
// we link Objects with Meshes here
vscenes.push_back(visualScene);
-
+
return true;
}
-/** When this method is called, the writer must handle all nodes contained in the
+/** When this method is called, the writer must handle all nodes contained in the
* library nodes.
* \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryNodes)
{
if (mImportStage != General)
return true;
-
+
Scene *sce = CTX_data_scene(mContext);
const COLLADAFW::NodePointerArray& nodes = libraryNodes->getNodes();
@@ -748,7 +748,7 @@ bool DocumentImporter::writeGeometry(const COLLADAFW::Geometry *geom)
{
if (mImportStage != General)
return true;
-
+
return mesh_importer.write_geometry(geom);
}
@@ -758,13 +758,13 @@ bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat)
{
if (mImportStage != General)
return true;
-
+
const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId();
Material *ma = BKE_material_add(G.main, (char *)str_mat_id.c_str());
-
+
this->uid_effect_map[cmat->getInstantiatedEffect()] = ma;
this->uid_material_map[cmat->getUniqueId()] = ma;
-
+
return true;
}
@@ -774,29 +774,29 @@ MTex *DocumentImporter::create_texture(COLLADAFW::EffectCommon *ef, COLLADAFW::T
{
COLLADAFW::SamplerPointerArray& samp_array = ef->getSamplerPointerArray();
COLLADAFW::Sampler *sampler = samp_array[ctex.getSamplerId()];
-
+
const COLLADAFW::UniqueId& ima_uid = sampler->getSourceImage();
-
+
if (uid_image_map.find(ima_uid) == uid_image_map.end()) {
fprintf(stderr, "Couldn't find an image by UID.\n");
return NULL;
}
-
+
ma->mtex[i] = BKE_texture_mtex_add();
ma->mtex[i]->texco = TEXCO_UV;
ma->mtex[i]->tex = BKE_texture_add(G.main, "Texture");
ma->mtex[i]->tex->type = TEX_IMAGE;
ma->mtex[i]->tex->ima = uid_image_map[ima_uid];
-
+
texindex_texarray_map[ctex.getTextureMapId()].push_back(ma->mtex[i]);
-
+
return ma->mtex[i];
}
void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Material *ma)
{
COLLADAFW::EffectCommon::ShaderType shader = ef->getShaderType();
-
+
// blinn
if (shader == COLLADAFW::EffectCommon::SHADER_BLINN) {
ma->spec_shader = MA_SPEC_BLINN;
@@ -820,12 +820,12 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
ma->ray_mirror = ef->getReflectivity().getFloatValue();
// index of refraction
ma->ang = ef->getIndexOfRefraction().getFloatValue();
-
+
int i = 0;
COLLADAFW::Color col;
MTex *mtex = NULL;
TexIndexTextureArrayMap texindex_texarray_map;
-
+
// DIFFUSE
// color
if (ef->getDiffuse().isColor()) {
@@ -840,7 +840,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
}
// texture
else if (ef->getDiffuse().isTexture()) {
- COLLADAFW::Texture ctex = ef->getDiffuse().getTexture();
+ COLLADAFW::Texture ctex = ef->getDiffuse().getTexture();
mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
if (mtex != NULL) {
mtex->mapto = MAP_COL;
@@ -858,10 +858,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
}
// texture
else if (ef->getAmbient().isTexture()) {
- COLLADAFW::Texture ctex = ef->getAmbient().getTexture();
+ COLLADAFW::Texture ctex = ef->getAmbient().getTexture();
mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
if (mtex != NULL) {
- mtex->mapto = MAP_AMB;
+ mtex->mapto = MAP_AMB;
i++;
}
}
@@ -875,10 +875,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
}
// texture
else if (ef->getSpecular().isTexture()) {
- COLLADAFW::Texture ctex = ef->getSpecular().getTexture();
+ COLLADAFW::Texture ctex = ef->getSpecular().getTexture();
mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
if (mtex != NULL) {
- mtex->mapto = MAP_SPEC;
+ mtex->mapto = MAP_SPEC;
i++;
}
}
@@ -892,10 +892,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
}
// texture
else if (ef->getReflective().isTexture()) {
- COLLADAFW::Texture ctex = ef->getReflective().getTexture();
+ COLLADAFW::Texture ctex = ef->getReflective().getTexture();
mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
if (mtex != NULL) {
- mtex->mapto = MAP_REF;
+ mtex->mapto = MAP_REF;
i++;
}
}
@@ -908,10 +908,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
}
// texture
else if (ef->getEmission().isTexture()) {
- COLLADAFW::Texture ctex = ef->getEmission().getTexture();
+ COLLADAFW::Texture ctex = ef->getEmission().getTexture();
mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
if (mtex != NULL) {
- mtex->mapto = MAP_EMIT;
+ mtex->mapto = MAP_EMIT;
i++;
}
}
@@ -951,14 +951,14 @@ bool DocumentImporter::writeEffect(const COLLADAFW::Effect *effect)
{
if (mImportStage != General)
return true;
-
+
const COLLADAFW::UniqueId& uid = effect->getUniqueId();
-
+
if (uid_effect_map.find(uid) == uid_effect_map.end()) {
fprintf(stderr, "Couldn't find a material by UID.\n");
return true;
}
-
+
Material *ma = uid_effect_map[uid];
std::map<COLLADAFW::UniqueId, Material *>::iterator iter;
for (iter = uid_material_map.begin(); iter != uid_material_map.end(); iter++) {
@@ -977,7 +977,7 @@ bool DocumentImporter::writeEffect(const COLLADAFW::Effect *effect)
COLLADAFW::EffectCommon *ef = common_efs[0];
write_profile_COMMON(ef, ma);
this->FW_object_map[effect->getUniqueId()] = effect;
-
+
return true;
}
@@ -988,16 +988,16 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
{
if (mImportStage != General)
return true;
-
+
Camera *cam = NULL;
std::string cam_id, cam_name;
-
+
ExtraTags *et=getExtraTags(camera->getUniqueId());
cam_id = camera->getOriginalId();
cam_name = camera->getName();
if (cam_name.size()) cam = (Camera *)BKE_camera_add(G.main, (char *)cam_name.c_str());
else cam = (Camera *)BKE_camera_add(G.main, (char *)cam_id.c_str());
-
+
if (!cam) {
fprintf(stderr, "Cannot create camera.\n");
return true;
@@ -1010,7 +1010,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
}
cam->clipsta = camera->getNearClippingPlane().getValue();
cam->clipend = camera->getFarClippingPlane().getValue();
-
+
COLLADAFW::Camera::CameraType type = camera->getCameraType();
switch (type) {
case COLLADAFW::Camera::ORTHOGRAPHIC:
@@ -1030,7 +1030,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
}
break;
}
-
+
switch (camera->getDescriptionType()) {
case COLLADAFW::Camera::ASPECTRATIO_AND_Y:
{
@@ -1100,7 +1100,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
// read nothing, use blender defaults.
break;
}
-
+
this->uid_camera_map[camera->getUniqueId()] = cam;
this->FW_object_map[camera->getUniqueId()] = camera;
// XXX import camera options
@@ -1113,7 +1113,7 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
{
if (mImportStage != General)
return true;
-
+
const std::string& imagepath = image->getImageURI().toNativePath();
char dir[FILE_MAX];
@@ -1124,7 +1124,7 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
BLI_join_dirfile(absolute_path, sizeof(absolute_path), dir, imagepath.c_str());
if (BLI_exists(absolute_path)) {
workpath = absolute_path;
- }
+ }
else {
// Maybe imagepath was already absolute ?
if (!BLI_exists(imagepath.c_str())) {
@@ -1140,7 +1140,7 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
return true;
}
this->uid_image_map[image->getUniqueId()] = ima;
-
+
return true;
}
@@ -1261,7 +1261,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
// assuming point light (const att = 1.0);
att1 = 1.0f;
}
-
+
d *= (1.0f / unit_converter.getLinearMeter());
lamp->energy = e;
@@ -1324,7 +1324,7 @@ bool DocumentImporter::writeAnimation(const COLLADAFW::Animation *anim)
{
if (mImportStage != General)
return true;
-
+
// return true;
return anim_importer.write_animation(anim);
}
@@ -1334,7 +1334,7 @@ bool DocumentImporter::writeAnimationList(const COLLADAFW::AnimationList *animat
{
if (mImportStage != General)
return true;
-
+
// return true;
return anim_importer.write_animation_list(animationList);
}
@@ -1351,7 +1351,7 @@ bool DocumentImporter::writeController(const COLLADAFW::Controller *controller)
{
if (mImportStage != General)
return true;
-
+
return armature_importer.write_controller(controller);
}
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index 62f76dbc022..c5bc6907867 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -79,7 +79,7 @@ public:
std::vector<Object *> *write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
MTex* create_texture(COLLADAFW::EffectCommon*, COLLADAFW::Texture&, Material*, int, TexIndexTextureArrayMap&);
void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);
-
+
void translate_anim_recursive(COLLADAFW::Node*, COLLADAFW::Node*, Object*);
/**
@@ -149,7 +149,7 @@ private:
ArmatureImporter armature_importer;
MeshImporter mesh_importer;
AnimationImporter anim_importer;
-
+
/** TagsMap typedef for uid_tags_map. */
typedef std::map<std::string, ExtraTags*> TagsMap;
/** Tags map of unique id as a string and ExtraTags instance. */
@@ -165,7 +165,7 @@ private:
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> node_map;
std::vector<const COLLADAFW::VisualScene*> vscenes;
std::vector<Object*> libnode_ob;
-
+
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> root_map; // find root joint by child joint uid, for bone tree evaluation during resampling
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map;
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index a4764cab67e..d33ce725e58 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -55,7 +55,7 @@ EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettin
bool EffectsExporter::hasEffects(Scene *sce)
{
Base *base = (Base *)sce->base.first;
-
+
while (base) {
Object *ob = base->object;
int a;
@@ -75,7 +75,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
void EffectsExporter::exportEffects(Scene *sce)
{
this->scene = sce;
-
+
if (this->export_settings->export_texture_type == BC_TEXTURE_TYPE_MAT) {
if (hasEffects(sce)) {
MaterialFunctor mf;
@@ -152,7 +152,7 @@ void EffectsExporter::writePhong(COLLADASW::EffectProfile &ep, Material *ma)
void EffectsExporter::writeTextures(
COLLADASW::EffectProfile &ep,
std::string &key,
- COLLADASW::Sampler *sampler,
+ COLLADASW::Sampler *sampler,
MTex *t, Image *ima,
std::string &uvname )
{
@@ -184,7 +184,7 @@ void EffectsExporter::writeTextures(
ep.setTransparent(createTexture(ima, uvname, sampler));
}
// extension:
- // Normal map --> Must be stored with <extra> tag as different technique,
+ // Normal map --> Must be stored with <extra> tag as different technique,
// since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
if (t->mapto & MAP_NORM) {
COLLADASW::Texture texture(key);
@@ -205,7 +205,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
createTextureIndices(ma, tex_indices);
openEffect(translate_id(id_name(ma)) + "-effect");
-
+
COLLADASW::EffectProfile ep(mSW);
ep.setProfileType(COLLADASW::EffectProfile::COMMON);
ep.openProfile();
@@ -229,7 +229,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
writePhong(ep, ma);
}
}
-
+
// index of refraction
if (ma->mode & MA_RAYTRANSP) {
ep.setIndexOfRefraction(ma->ang, false, "index_of_refraction");
@@ -290,7 +290,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
//COLLADASW::Surface surfaces[MAX_MTEX];
//void *samp_surf[MAX_MTEX][2];
void *samp_surf[MAX_MTEX];
-
+
// image to index to samp_surf map
// samp_surf[index] stores 2 pointers, sampler and surface
std::map<std::string, int> im_samp_map;
@@ -299,10 +299,10 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
for (a = 0, b = 0; a < tex_indices.size(); a++) {
MTex *t = ma->mtex[tex_indices[a]];
Image *ima = t->tex->ima;
-
+
// Image not set for texture
if (!ima) continue;
-
+
std::string key(id_name(ima));
key = translate_id(key);
@@ -317,7 +317,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// COLLADASW::NewParamSurface surface(mSW);
// surface->setParamType(COLLADASW::CSW_SURFACE_TYPE_2D);
-
+
//<newparam> <sampler> <source>
COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
@@ -326,11 +326,11 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// copy values to arrays since they will live longer
samplers[a] = sampler;
//surfaces[a] = surface;
-
+
// store pointers so they can be used later when we create <texture>s
samp_surf[b] = &samplers[a];
//samp_surf[b][1] = &surfaces[a];
-
+
im_samp_map[key] = b;
b++;
}
@@ -381,12 +381,12 @@ COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima,
COLLADASW::Sampler *sampler
/*COLLADASW::Surface *surface*/)
{
-
+
COLLADASW::Texture texture(translate_id(id_name(ima)));
texture.setTexcoord(uv_layer_name);
//texture.setSurface(*surface);
texture.setSampler(*sampler);
-
+
COLLADASW::ColorOrTexture cot(texture);
return cot;
}
@@ -398,7 +398,7 @@ COLLADASW::ColorOrTexture EffectsExporter::getcol(float r, float g, float b, flo
return cot;
}
-//returns the array of mtex indices which have image
+//returns the array of mtex indices which have image
//need this for exporting textures
void EffectsExporter::createTextureIndices(Material *ma, std::vector<int> &indices)
{
diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h
index 7d45a085777..278e1ebcfce 100644
--- a/source/blender/collada/EffectExporter.h
+++ b/source/blender/collada/EffectExporter.h
@@ -49,30 +49,30 @@ public:
EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
void exportEffects(Scene *sce);
void operator()(Material *ma, Object *ob);
-
+
COLLADASW::ColorOrTexture createTexture(Image *ima,
std::string& uv_layer_name,
COLLADASW::Sampler *sampler
/*COLLADASW::Surface *surface*/);
-
+
COLLADASW::ColorOrTexture getcol(float r, float g, float b, float a);
private:
/** Fills the array of mtex indices which have image. Used for exporting images. */
void createTextureIndices(Material *ma, std::vector<int> &indices);
-
+
void writeBlinn(COLLADASW::EffectProfile &ep, Material *ma);
void writeLambert(COLLADASW::EffectProfile &ep, Material *ma);
void writePhong(COLLADASW::EffectProfile &ep, Material *ma);
void writeTextures(COLLADASW::EffectProfile &ep,
std::string &key,
- COLLADASW::Sampler *sampler,
+ COLLADASW::Sampler *sampler,
MTex *t, Image *ima,
std::string &uvname );
bool hasEffects(Scene *sce);
-
+
const ExportSettings *export_settings;
-
+
Scene *scene;
};
diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp
index 7e18328f000..26674445d98 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -53,7 +53,7 @@ bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error)
See https://github.com/KhronosGroup/OpenCOLLADA/issues/442
*/
bool isWarning = false;
-
+
if (error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER) {
COLLADASaxFWL::SaxParserError *saxParserError = (COLLADASaxFWL::SaxParserError *) error;
const GeneratedSaxParser::ParserError& parserError = saxParserError->getError();
diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp
index bef7accd9f7..5d704bc9abc 100644
--- a/source/blender/collada/ExtraHandler.cpp
+++ b/source/blender/collada/ExtraHandler.cpp
@@ -54,9 +54,9 @@ bool ExtraHandler::elementEnd(const char *elementName)
bool ExtraHandler::textData(const char *text, size_t textLength)
{
char buf[1024];
-
+
if (currentElement.length() == 0 || currentExtraTags == 0) return false;
-
+
BLI_strncpy(buf, text, textLength + 1);
currentExtraTags->addTag(currentElement, std::string(buf));
return true;
diff --git a/source/blender/collada/ExtraHandler.h b/source/blender/collada/ExtraHandler.h
index f380c3d6871..4dda862b3cc 100644
--- a/source/blender/collada/ExtraHandler.h
+++ b/source/blender/collada/ExtraHandler.h
@@ -50,31 +50,31 @@ public:
/** Handle the beginning of an element. */
bool elementBegin( const char* elementName, const char** attributes);
-
+
/** Handle the end of an element. */
bool elementEnd(const char* elementName );
-
+
/** Receive the data in text format. */
bool textData(const char* text, size_t textLength);
/** Method to ask, if the current callback handler want to read the data of the given extra element. */
- bool parseElement (
- const char* profileName,
- const unsigned long& elementHash,
+ bool parseElement (
+ const char* profileName,
+ const unsigned long& elementHash,
const COLLADAFW::UniqueId& uniqueId,
COLLADAFW::Object* object);
/** For backwards compatibility with older OpenCollada, new version added object parameter */
- bool parseElement (
- const char* profileName,
- const unsigned long& elementHash,
+ bool parseElement (
+ const char* profileName,
+ const unsigned long& elementHash,
const COLLADAFW::UniqueId& uniqueId);
private:
/** Disable default copy constructor. */
ExtraHandler(const ExtraHandler& pre);
/** Disable default assignment operator. */
const ExtraHandler& operator= ( const ExtraHandler& pre );
-
+
/** Handle to DocumentImporter for interface to extra element data saving. */
DocumentImporter* dimp;
AnimationImporter* aimp;
diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp
index ea225d8a4ae..fd249884c3f 100644
--- a/source/blender/collada/ExtraTags.cpp
+++ b/source/blender/collada/ExtraTags.cpp
@@ -50,7 +50,7 @@ bool ExtraTags::isProfile(std::string profile)
bool ExtraTags::addTag(std::string tag, std::string data)
{
tags[tag] = data;
-
+
return true;
}
diff --git a/source/blender/collada/ExtraTags.h b/source/blender/collada/ExtraTags.h
index ad272dcba65..84857622ee8 100644
--- a/source/blender/collada/ExtraTags.h
+++ b/source/blender/collada/ExtraTags.h
@@ -41,35 +41,35 @@ public:
/** Handle the beginning of an element. */
bool addTag(std::string tag, std::string data);
-
+
/** Set given short pointer to value of tag, if it exists. */
bool setData(std::string tag, short *data);
-
+
/** Set given int pointer to value of tag, if it exists. */
bool setData(std::string tag, int *data);
-
+
/** Set given float pointer to value of tag, if it exists. */
bool setData(std::string tag, float *data);
-
+
/** Set given char pointer to value of tag, if it exists. */
bool setData(std::string tag, char *data);
std::string setData(std::string tag, std::string &data);
/** Return true if the extra tags is for specified profile. */
bool isProfile(std::string profile);
-
+
private:
/** Disable default copy constructor. */
ExtraTags(const ExtraTags& pre);
/** Disable default assignment operator. */
const ExtraTags& operator= ( const ExtraTags& pre );
-
+
/** The profile for which the tags are. */
std::string profile;
-
+
/** Map of tag and text pairs. */
std::map<std::string, std::string> tags;
-
+
/** Get text data for tag as an int. */
int asInt(std::string tag, bool *ok);
/** Get text data for tag as a float. */
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index f09307c1891..4b693332715 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -70,14 +70,14 @@ void GeometryExporter::exportGeom(Scene *sce)
}
void GeometryExporter::operator()(Object *ob)
-{
+{
// XXX don't use DerivedMesh, Mesh instead?
-#if 0
+#if 0
DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH);
#endif
bool use_instantiation = this->export_settings->use_object_instantiation;
- Mesh *me = bc_get_mesh_copy( mScene,
+ Mesh *me = bc_get_mesh_copy( mScene,
ob,
this->export_settings->export_mesh_type,
this->export_settings->apply_modifiers,
@@ -88,7 +88,7 @@ void GeometryExporter::operator()(Object *ob)
std::vector<BCPolygonNormalsIndices> norind;
// Skip if linked geometry was already exported from another reference
- if (use_instantiation &&
+ if (use_instantiation &&
exportedGeometry.find(geom_id) != exportedGeometry.end())
{
return;
@@ -104,15 +104,15 @@ void GeometryExporter::operator()(Object *ob)
// openMesh(geoId, geoName, meshId)
openMesh(geom_id, geom_name);
-
+
// writes <source> for vertex coords
createVertsSource(geom_id, me);
-
+
// writes <source> for normal coords
createNormalsSource(geom_id, me, nor);
bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE);
-
+
// writes <source> for uv coords if mesh has uv coords
if (has_uvs) {
createTexcoordsSource(geom_id, me);
@@ -153,9 +153,9 @@ void GeometryExporter::operator()(Object *ob)
createPolylists(uv_image_set, has_uvs, has_color, ob, me, geom_id, norind);
}
}
-
+
closeMesh();
-
+
if (me->flag & ME_TWOSIDED) {
mSW->appendTextBlock("<extra><technique profile=\"MAYA\"><double_sided>1</double_sided></technique></extra>");
}
@@ -184,7 +184,7 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
std::string geom_id = get_geometry_id(ob, false) + "_morph_" + translate_id(kb->name);
std::vector<Normal> nor;
std::vector<BCPolygonNormalsIndices> norind;
-
+
if (exportedGeometry.find(geom_id) != exportedGeometry.end())
{
return;
@@ -200,15 +200,15 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
// openMesh(geoId, geoName, meshId)
openMesh(geom_id, geom_name);
-
+
// writes <source> for vertex coords
createVertsSource(geom_id, me);
-
+
// writes <source> for normal coords
createNormalsSource(geom_id, me, nor);
bool has_uvs = (bool)CustomData_has_layer(&me->fdata, CD_MTFACE);
-
+
// writes <source> for uv coords if mesh has uv coords
if (has_uvs) {
createTexcoordsSource(geom_id, me);
@@ -229,7 +229,7 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
//createLooseEdgeList(ob, me, geom_id, norind);
- // XXX slow
+ // XXX slow
if (ob->totcol && this->export_settings->export_texture_type == BC_TEXTURE_TYPE_MAT) {
for (int a = 0; a < ob->totcol; a++) {
createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
@@ -240,9 +240,9 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
std::set<Image *> uv_images = bc_getUVImages(ob, all_uv_layers);
createPolylists(uv_images, has_uvs, has_color, ob, me, geom_id, norind);
}
-
+
closeMesh();
-
+
if (me->flag & ME_TWOSIDED) {
mSW->appendTextBlock("<extra><technique profile=\"MAYA\"><double_sided>1</double_sided></technique></extra>");
}
@@ -261,9 +261,9 @@ void GeometryExporter::createLooseEdgeList(Object *ob,
std::vector<unsigned int> edge_list;
int index;
- // Find all loose edges in Mesh
+ // Find all loose edges in Mesh
// and save vertex indices in edge_list
- for (index = 0; index < totedges; index++)
+ for (index = 0; index < totedges; index++)
{
MEdge *edge = &medges[index];
@@ -284,14 +284,14 @@ void GeometryExporter::createLooseEdgeList(Object *ob,
COLLADASW::InputList &til = lines.getInputList();
-
- // creates <input> in <lines> for vertices
+
+ // creates <input> in <lines> for vertices
COLLADASW::Input input1(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
til.push_back(input1);
lines.prepareToAppendValues();
- for (index = 0; index < edges_in_linelist; index++)
+ for (index = 0; index < edges_in_linelist; index++)
{
lines.appendValues(edge_list[2 * index + 1]);
lines.appendValues(edge_list[2 * index]);
@@ -366,7 +366,7 @@ void GeometryExporter::createPolylist(short material_index,
// count faces with this material
for (i = 0; i < totpolys; i++) {
MPoly *p = &mpolys[i];
-
+
if (p->mat_nr == material_index) {
faces_in_polylist++;
vcount_list.push_back(p->totloop);
@@ -381,14 +381,14 @@ void GeometryExporter::createPolylist(short material_index,
fprintf(stderr, "%s: material with index %d is not used.\n", id_name(ob).c_str(), material_index);
return;
}
-
+
Material *ma = ob->totcol ? give_current_material(ob, material_index + 1) : NULL;
COLLADASW::PrimitivesBase *facelist = getFacelist(is_triangulated, mSW);
-
+
// sets count attribute in <polylist>
facelist->setCount(faces_in_polylist);
-
+
// sets material name
if (ma) {
std::string material_id = get_material_id(ma);
@@ -398,22 +398,22 @@ void GeometryExporter::createPolylist(short material_index,
}
COLLADASW::InputList &til = facelist->getInputList();
-
- // creates <input> in <polylist> for vertices
+
+ // creates <input> in <polylist> for vertices
COLLADASW::Input input1(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
-
+
// creates <input> in <polylist> for normals
COLLADASW::Input input2(COLLADASW::InputSemantic::NORMAL, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL), 1);
-
+
til.push_back(input1);
til.push_back(input2);
-
+
// if mesh has uv coords writes <input> for TEXCOORD
int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE)-1;
for (i = 0; i < num_layers; i++) {
if (!this->export_settings->active_uv_only || i == active_uv_index) {
-
+
std::string uv_name(bc_get_uvlayer_name(me, i));
std::string effective_id = geom_id; // (uv_name == "") ? geom_id : uv_name;
std::string layer_id = makeTexcoordSourceId(
@@ -421,7 +421,7 @@ void GeometryExporter::createPolylist(short material_index,
i, this->export_settings->active_uv_only);
/* Note: the third parameter denotes the offset of TEXCOORD in polylist elements
- For now this is always 2 (This may change sometime/maybe)
+ For now this is always 2 (This may change sometime/maybe)
*/
COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
makeUrl(layer_id),
@@ -447,8 +447,8 @@ void GeometryExporter::createPolylist(short material_index,
map_index++;
}
}
-
-
+
+
// performs the actual writing
prepareToAppendValues(is_triangulated, facelist, vcount_list);
@@ -504,7 +504,7 @@ void GeometryExporter::createPolylists(std::set<Image *> uv_images,
norind);
}
- /* We msut add an additional collector for the case when
+ /* We msut add an additional collector for the case when
* some parts of the object are not textured at all.
* The next call creates a polylist for all untextured polygons
*/
@@ -580,7 +580,7 @@ void GeometryExporter::createPolylist(std::string imageid,
}
COLLADASW::InputList &til = facelist->getInputList();
- // creates <input> in <polylist> for vertices
+ // creates <input> in <polylist> for vertices
COLLADASW::Input input1(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
// creates <input> in <polylist> for normals
@@ -670,7 +670,7 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
#endif
int totverts = me->totvert;
MVert *verts = me->mvert;
-
+
COLLADASW::FloatSourceF source(mSW);
source.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::POSITION));
source.setArrayId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::POSITION) +
@@ -690,7 +690,7 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
for (i = 0; i < totverts; i++) {
source.appendValues(verts[i].co[0], verts[i].co[1], verts[i].co[2]);
}
-
+
source.finish();
}
@@ -742,7 +742,7 @@ void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me)
);
}
}
-
+
source.finish();
}
}
@@ -777,26 +777,26 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
int layer_index = CustomData_get_layer_index_n(&me->ldata, CD_MLOOPUV, a);
if (!this->export_settings->active_uv_only || layer_index == active_uv_index) {
MLoopUV *mloops = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, a);
-
+
COLLADASW::FloatSourceF source(mSW);
std::string active_uv_name(bc_get_active_uvlayer_name(me));
std::string effective_id = geom_id; // (active_uv_name == "") ? geom_id : active_uv_name;
std::string layer_id = makeTexcoordSourceId(
- effective_id,
- a,
+ effective_id,
+ a,
this->export_settings->active_uv_only );
source.setId(layer_id);
source.setArrayId(layer_id + ARRAY_ID_SUFFIX);
-
+
source.setAccessorCount(totuv);
source.setAccessorStride(2);
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("S");
param.push_back("T");
-
+
source.prepareToAppendValues();
-
+
for (int index = 0; index < totpoly; index++) {
MPoly *mpoly = mpolys+index;
MLoopUV *mloop = mloops+mpoly->loopstart;
@@ -805,7 +805,7 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
mloop[j].uv[1]);
}
}
-
+
source.finish();
}
}
@@ -835,7 +835,7 @@ void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::v
param.push_back("X");
param.push_back("Y");
param.push_back("Z");
-
+
source.prepareToAppendValues();
std::vector<Normal>::iterator it;
@@ -920,10 +920,10 @@ std::string GeometryExporter::getIdBySemantics(std::string geom_id, COLLADASW::I
COLLADASW::URI GeometryExporter::getUrlBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix)
{
-
+
std::string id(getIdBySemantics(geom_id, type, other_suffix));
return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
-
+
}
COLLADASW::URI GeometryExporter::makeUrl(std::string id)
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index 890304f4568..8c536721e4b 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -127,7 +127,7 @@ public:
void createNormalsSource(std::string geom_id, Mesh *me, std::vector<Normal>& nor);
void create_normals(std::vector<Normal> &nor, std::vector<BCPolygonNormalsIndices> &ind, Mesh *me);
-
+
std::string getIdBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix = "");
std::string makeVertexColorSourceId(std::string& geom_id, char *layer_name);
@@ -136,10 +136,10 @@ public:
COLLADASW::URI makeUrl(std::string id);
void export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb);
-
+
private:
std::set<std::string> exportedGeometry;
-
+
const ExportSettings *export_settings;
Mesh * get_mesh(Scene *sce, Object *ob, int apply_modifiers);
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index a3b710abc66..87f1197e3af 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -34,7 +34,7 @@ extern "C" {
#include "DNA_image_types.h"
#include "DNA_meshdata_types.h"
-#include "BKE_customdata.h"
+#include "BKE_customdata.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
@@ -53,7 +53,7 @@ ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings
{
}
-void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
+void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
{
std::string id(id_name(image));
std::string translated_id(translate_id(id));
@@ -117,7 +117,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
BLI_cleanup_path(NULL, source_path);
if (use_copies) {
-
+
// This image is already located on the file system.
// But we want to create copies here.
// To move images into the same export directory.
@@ -144,7 +144,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
}
/* set name also to mNameNC. This helps other viewers import files exported from Blender better */
- COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(export_path)), translated_id, translated_id);
+ COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(export_path)), translated_id, translated_id);
img.add(mSW);
fprintf(stdout, "Collada export: Added image: %s\n", export_file);
mImages.push_back(translated_id);
@@ -200,7 +200,7 @@ void ImagesExporter::export_UV_Images()
bool ImagesExporter::hasImages(Scene *sce)
{
LinkNode *node;
-
+
for (node = this->export_settings->export_set; node; node = node->next) {
Object *ob = (Object *)node->link;
diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h
index 0eaebdd5cdd..524260891ae 100644
--- a/source/blender/collada/ImageExporter.h
+++ b/source/blender/collada/ImageExporter.h
@@ -45,13 +45,13 @@ class ImagesExporter: COLLADASW::LibraryImages
{
public:
ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
-
+
void exportImages(Scene *sce);
void operator()(Material *ma, Object *ob);
private:
std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
- void export_UV_Images();
+ void export_UV_Images();
void export_UV_Image(Image *image, bool use_texture_copies);
bool hasImages(Scene *sce);
const ExportSettings *export_settings;
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index ff50abfedae..02c5438ec47 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -54,9 +54,9 @@ LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings
void LightsExporter::exportLights(Scene *sce)
{
openLibrary();
-
+
forEachLampObjectInExportSet(sce, *this, this->export_settings->export_set);
-
+
closeLibrary();
}
@@ -67,11 +67,11 @@ void LightsExporter::operator()(Object *ob)
std::string la_name(id_name(la));
COLLADASW::Color col(la->r * la->energy, la->g * la->energy, la->b * la->energy);
float d, constatt, linatt, quadatt;
-
+
d = la->dist;
-
+
constatt = 1.0f;
-
+
if (la->falloff_type == LA_FALLOFF_INVLINEAR) {
linatt = 1.0f / d;
quadatt = 0.0f;
@@ -80,7 +80,7 @@ void LightsExporter::operator()(Object *ob)
linatt = 0.0f;
quadatt = 1.0f / (d * d);
}
-
+
// sun
if (la->type == LA_SUN) {
COLLADASW::DirectionalLight cla(mSW, la_id, la_name);
@@ -130,7 +130,7 @@ void LightsExporter::operator()(Object *ob)
exportBlenderProfile(cla, la);
addLight(cla);
}
-
+
}
bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Lamp *la)
@@ -190,6 +190,6 @@ bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Lamp *la)
cla.addExtraTechniqueParameter("blender", "skyblendfac", la->skyblendfac);
cla.addExtraTechniqueParameter("blender", "sky_exposure", la->sky_exposure);
cla.addExtraTechniqueParameter("blender", "sky_colorspace", la->sky_colorspace);
-
+
return true;
}
diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h
index ef44bf8a03e..e830a433432 100644
--- a/source/blender/collada/MaterialExporter.h
+++ b/source/blender/collada/MaterialExporter.h
@@ -65,7 +65,7 @@ class ForEachMaterialFunctor
Functor *f;
public:
ForEachMaterialFunctor(Functor*f) : f(f) {}
-
+
void operator ()(Object *ob)
{
int a;
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index cd73742a2d6..604db646419 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -154,7 +154,7 @@ void UVDataWrapper::getUV(int uv_index, float *uv)
if (values->empty()) return;
uv[0] = (*values)[uv_index * stride];
uv[1] = (*values)[uv_index * stride + 1];
-
+
}
break;
case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
@@ -163,7 +163,7 @@ void UVDataWrapper::getUV(int uv_index, float *uv)
if (values->empty()) return;
uv[0] = (float)(*values)[uv_index * stride];
uv[1] = (float)(*values)[uv_index * stride + 1];
-
+
}
break;
case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN:
@@ -316,7 +316,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su
return false;
}
}
-
+
return true;
}
@@ -356,7 +356,7 @@ bool MeshImporter::primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp) {
int normals_count = mp->getNormalIndices().getCount();
if (normals_count > 0) {
int index_count = mp->getPositionIndices().getCount();
- if (index_count == normals_count)
+ if (index_count == normals_count)
has_useable_normals = true;
else {
fprintf(stderr,
@@ -387,7 +387,7 @@ bool MeshImporter::primitive_has_faces(COLLADAFW::MeshPrimitive *mp) {
break;
}
default: {
- has_faces = false;
+ has_faces = false;
break;
}
}
@@ -431,7 +431,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me)
size_t prim_poly_count = mpvc->getFaceCount();
size_t prim_loop_count = 0;
- for (int index=0; index < prim_poly_count; index++)
+ for (int index=0; index < prim_poly_count; index++)
{
int vcount = get_vertex_count(mpvc, index);
if (vcount > 0) {
@@ -545,7 +545,7 @@ unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) {
// This functin is copied from source/blender/editors/mesh/mesh_data.c
//
// TODO: (As discussed with sergey-) :
-// Maybe move this function to blenderkernel/intern/mesh.c
+// Maybe move this function to blenderkernel/intern/mesh.c
// and add definition to BKE_mesh.c
// =================================================================
void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
@@ -580,7 +580,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
// =================================================================
// Read all loose edges.
-// Important: This function assumes that all edges from existing
+// Important: This function assumes that all edges from existing
// faces have allready been generated and added to me->medge
// So this function MUST be called after read_faces() (see below)
// =================================================================
@@ -591,21 +591,21 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
unsigned int face_edge_count = me->totedge;
/* unsigned int total_edge_count = loose_edge_count + face_edge_count; */ /* UNUSED */
-
+
mesh_add_edges(me, loose_edge_count);
MEdge *med = me->medge + face_edge_count;
COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
for (int i = 0; i < prim_arr.getCount(); i++) {
-
+
COLLADAFW::MeshPrimitive *mp = prim_arr[i];
int type = mp->getPrimitiveType();
if (type == COLLADAFW::MeshPrimitive::LINES) {
unsigned int edge_count = mp->getFaceCount();
unsigned int *indices = mp->getPositionIndices().getData();
-
+
for (int j = 0; j < edge_count; j++, med++) {
med->bweight = 0;
med->crease = 0;
@@ -622,7 +622,7 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
// =======================================================================
// Read all faces from TRIANGLES, TRIANGLE_FANS, POLYLIST, POLYGON
-// Important: This function MUST be called before read_lines()
+// Important: This function MUST be called before read_lines()
// Otherwise we will loose all edges from faces (see read_lines() above)
//
// TODO: import uv set names
@@ -630,7 +630,7 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me)
{
unsigned int i;
-
+
allocate_poly_data(collada_mesh, me);
UVDataWrapper uvs(collada_mesh->getUVCoords());
@@ -646,7 +646,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me)
COLLADAFW::MeshVertexData& nor = collada_mesh->getNormals();
for (i = 0; i < prim_arr.getCount(); i++) {
-
+
COLLADAFW::MeshPrimitive *mp = prim_arr[i];
// faces
@@ -659,7 +659,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me)
bool mp_has_faces = primitive_has_faces(mp);
int collada_meshtype = mp->getPrimitiveType();
-
+
// since we cannot set mpoly->mat_nr here, we store a portion of me->mpoly in Primitive
Primitive prim = {mpoly, 0};
@@ -686,7 +686,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me)
mpoly->flag |= ME_SMOOTH;
normal_indices++;
}
-
+
mpoly++;
mloop += 3;
loop_index += 3;
@@ -796,7 +796,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me)
void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i, int stride)
{
i *= stride;
-
+
switch (arr.getType()) {
case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
{
@@ -884,33 +884,33 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi
const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId();
size_t setindex = ctexture.getSetIndex();
std::string uvname = ctexture.getSemantic();
-
+
if (setindex == -1) return NULL;
-
+
const CustomData *data = &me->fdata;
int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
if (layer_index == -1) return NULL;
CustomDataLayer *cdl = &data->layers[layer_index + setindex];
-
+
/* set uvname to bind_vertex_input semantic */
BLI_strncpy(cdl->name, uvname.c_str(), sizeof(cdl->name));
if (texindex_texarray_map.find(texture_index) == texindex_texarray_map.end()) {
-
+
fprintf(stderr, "Cannot find texture array by texture index.\n");
return color_texture;
}
-
+
std::vector<MTex *> textures = texindex_texarray_map[texture_index];
-
+
std::vector<MTex *>::iterator it;
-
+
for (it = textures.begin(); it != textures.end(); it++) {
-
+
MTex *texture = *it;
-
+
if (texture) {
BLI_strncpy(texture->uvname, uvname.c_str(), sizeof(texture->uvname));
if (texture->mapto == MAP_COL) color_texture = texture;
@@ -928,7 +928,7 @@ static bool bc_has_same_material_configuration(Object *ob1, Object *ob2)
{
if (ob1->totcol != ob2->totcol) return false; // not same number of materials
if (ob1->totcol == 0) return false; // no material at all
-
+
for (int index=0; index < ob1->totcol; index++) {
if (ob1->matbits[index] != ob2->matbits[index]) return false; // shouldn't happen
if (ob1->matbits[index] == 0) return false; // shouldn't happen
@@ -1061,35 +1061,35 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
MTex *color_texture = NULL;
Mesh *me = (Mesh *)ob->data;
const COLLADAFW::UniqueId& ma_uid = cmaterial.getReferencedMaterial();
-
+
// do we know this material?
if (uid_material_map.find(ma_uid) == uid_material_map.end()) {
-
+
fprintf(stderr, "Cannot find material by UID.\n");
return NULL;
}
// first time we get geom_uid, ma_uid pair. Save for later check.
materials_mapped_to_geom.insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::UniqueId>(*geom_uid, ma_uid));
-
+
Material *ma = uid_material_map[ma_uid];
// Attention! This temporaly assigns material to object on purpose!
// See note above.
ob->actcol=0;
assign_material(G.main, ob, ma, mat_index + 1, BKE_MAT_ASSIGN_OBJECT);
-
- COLLADAFW::TextureCoordinateBindingArray& tex_array =
+
+ COLLADAFW::TextureCoordinateBindingArray& tex_array =
cmaterial.getTextureCoordinateBindingArray();
TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma];
unsigned int i;
// loop through <bind_vertex_inputs>
for (i = 0; i < tex_array.getCount(); i++) {
-
+
color_texture = assign_textures_to_uvlayer(tex_array[i], me, texindex_texarray_map,
color_texture);
}
-
+
// set texture face
if (color_texture &&
strlen((color_texture)->uvname) &&
@@ -1099,17 +1099,17 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
color_texture->uvname);
strcpy(layername, color_texture->uvname);
}
-
+
MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid];
COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId();
-
+
// assign material indices to mesh faces
if (mat_prim_map.find(mat_id) != mat_prim_map.end()) {
-
+
std::vector<Primitive>& prims = mat_prim_map[mat_id];
-
+
std::vector<Primitive>::iterator it;
-
+
for (it = prims.begin(); it != prims.end(); it++) {
Primitive& prim = *it;
MPoly *mpoly = prim.mpoly;
@@ -1123,7 +1123,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
}
}
}
- }
+ }
return texture_face;
}
@@ -1133,19 +1133,19 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
std::map<Material *, TexIndexTextureArrayMap>& material_texture_mapping_map)
{
const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId();
-
+
// check if node instanciates controller or geometry
if (isController) {
-
+
geom_uid = armature_importer->get_geometry_uid(*geom_uid);
-
+
if (!geom_uid) {
fprintf(stderr, "Couldn't find a mesh UID by controller's UID.\n");
return NULL;
}
}
else {
-
+
if (uid_mesh_map.find(*geom_uid) == uid_mesh_map.end()) {
// this could happen if a mesh was not created
// (e.g. if it contains unsupported geometry)
@@ -1154,11 +1154,11 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
}
}
if (!uid_mesh_map[*geom_uid]) return NULL;
-
+
// name Object
const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
const char *name = (id.length()) ? id.c_str() : NULL;
-
+
// add object
Object *ob = bc_add_object(scene, OB_MESH, name);
bc_set_mark(ob); // used later for material assignement optimization
@@ -1167,7 +1167,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
// store object pointer for ArmatureImporter
uid_object_map[*geom_uid] = ob;
imported_objects.push_back(ob);
-
+
// replace ob->data freeing the old one
Mesh *old_mesh = (Mesh *)ob->data;
Mesh *new_mesh = uid_mesh_map[*geom_uid];
@@ -1181,13 +1181,13 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
char layername[100];
layername[0] = '\0';
MTFace *texture_face = NULL;
-
+
COLLADAFW::MaterialBindingArray& mat_array =
geom->getMaterialBindings();
-
+
// loop through geom's materials
for (unsigned int i = 0; i < mat_array.getCount(); i++) {
-
+
if (mat_array[i].getReferencedMaterial().isValid()) {
texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid,
layername, texture_face,
@@ -1210,14 +1210,14 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
fprintf(stderr, "Mesh type %s is not supported\n", bc_geomTypeToStr(geom->getType()));
return true;
}
-
+
COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh *)geom;
-
+
if (!is_nice_mesh(mesh)) {
fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh).c_str());
return true;
}
-
+
const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str());
id_us_min(&me->id); // is already 1 here, but will be set later in BKE_mesh_assign_object
@@ -1226,7 +1226,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
// mesh_geom_map needed to map mesh to its geometry name (for shape key naming)
this->uid_mesh_map[mesh->getUniqueId()] = me;
this->mesh_geom_map[std::string(me->id.name)] = str_geom_id;
-
+
read_vertices(mesh, me);
read_polys(mesh, me);
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index d6426fbaf56..f0da3cc21cf 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -108,7 +108,7 @@ private:
typedef std::map<COLLADAFW::MaterialId, std::vector<Primitive> > MaterialIdPrimitiveArrayMap;
std::map<COLLADAFW::UniqueId, MaterialIdPrimitiveArrayMap> geom_uid_mat_mapping_map; // crazy name!
std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId> materials_mapped_to_geom; //< materials that have already been mapped to a geometry. A pair of geom uid and mat uid, one geometry can have several materials
-
+
bool set_poly_indices(MPoly *mpoly,
MLoop *mloop,
int loop_index,
@@ -134,7 +134,7 @@ private:
bool is_nice_mesh(COLLADAFW::Mesh *mesh);
void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me);
-
+
bool primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp);
bool primitive_has_faces(COLLADAFW::MeshPrimitive *mp);
@@ -164,7 +164,7 @@ public:
virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid);
virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId& geom_uid);
-
+
MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
MTex *color_texture);
@@ -176,8 +176,8 @@ public:
Object *ob, const COLLADAFW::UniqueId *geom_uid,
char *layername, MTFace *texture_face,
std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map, short mat_index);
-
-
+
+
Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
bool isController,
std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index c195ecb4725..4e08548449f 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -49,7 +49,7 @@ void SceneExporter::exportScene(bContext *C, Scene *sce)
}
void SceneExporter::exportHierarchy(bContext *C, Scene *sce)
-{
+{
LinkNode *node;
std::vector<Object *> base_objects;
@@ -58,7 +58,7 @@ void SceneExporter::exportHierarchy(bContext *C, Scene *sce)
Object *ob = (Object *) node->link;
ob->id.tag |= LIB_TAG_DOIT;
}
-
+
// Now find all exportable base ojects (highest in export hierarchy)
for (node = this->export_settings->export_set; node; node = node->next) {
Object *ob = (Object *) node->link;
@@ -146,9 +146,9 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce)
COLLADASW::InstanceGeometry instGeom(mSW);
instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, this->export_settings->use_object_instantiation)));
instGeom.setName(translate_id(id_name(ob)));
- InstanceWriter::add_material_bindings(instGeom.getBindMaterial(),
- ob,
- this->export_settings->active_uv_only,
+ InstanceWriter::add_material_bindings(instGeom.getBindMaterial(),
+ ob,
+ this->export_settings->active_uv_only,
this->export_settings->export_texture_type);
instGeom.add();
@@ -204,17 +204,17 @@ void SceneExporter::writeNodes(bContext *C, Object *ob, Scene *sce)
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"rot_error",con->rot_error);
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"tar_space",con->tarspace);
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"lin_error",con->lin_error);
-
- //not ideal: add the target object name as another parameter.
+
+ //not ideal: add the target object name as another parameter.
//No real mapping in the .dae
//Need support for multiple target objects also.
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL};
if (cti && cti->get_constraint_targets) {
-
+
bConstraintTarget *ct;
Object *obtar;
-
+
cti->get_constraint_targets(con, &targets);
for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) {
diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h
index 60cb078d91b..6cf561749de 100644
--- a/source/blender/collada/SceneExporter.h
+++ b/source/blender/collada/SceneExporter.h
@@ -102,7 +102,7 @@ private:
friend class ArmatureExporter;
void exportHierarchy(bContext *C, Scene *sce);
void writeNodes(bContext *C, Object *ob, Scene *sce);
-
+
ArmatureExporter *arm_exporter;
const ExportSettings *export_settings;
};
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index c48c060dc95..72d5c656920 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -121,7 +121,7 @@ void SkinInfo::borrow_skin_controller_data(const COLLADAFW::SkinControllerData *
unit_converter->dae_matrix_to_mat4_(bind_shape_matrix, skin->getBindShapeMatrix());
}
-
+
void SkinInfo::free()
{
joints_per_vertex.releaseMemory();
@@ -199,7 +199,7 @@ const COLLADAFW::UniqueId& SkinInfo::get_controller_uid()
}
// check if this skin controller references a joint or any descendant of it
-//
+//
// some nodes may not be referenced by SkinController,
// in this case to determine if the node belongs to this armature,
// we need to search down the tree
@@ -259,9 +259,9 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
// skip joints that have invalid UID
if ((*it).joint_uid == COLLADAFW::UniqueId::INVALID) continue;
-
+
// name group by joint node name
-
+
if (joint_by_uid.find((*it).joint_uid) != joint_by_uid.end()) {
name = bc_get_joint_name(joint_by_uid[(*it).joint_uid]);
}
diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h
index e074f59cffc..de88bf32fcf 100644
--- a/source/blender/collada/SkinInfo.h
+++ b/source/blender/collada/SkinInfo.h
@@ -88,7 +88,7 @@ public:
void transfer_uint_array_data_const(const COLLADAFW::UIntValuesArray& src, COLLADAFW::UIntValuesArray& dest);
void borrow_skin_controller_data(const COLLADAFW::SkinControllerData* skin);
-
+
void free();
// using inverse bind matrices to construct armature
@@ -110,7 +110,7 @@ public:
const COLLADAFW::UniqueId& get_controller_uid();
// check if this skin controller references a joint or any descendant of it
- //
+ //
// some nodes may not be referenced by SkinController,
// in this case to determine if the node belongs to this armature,
// we need to search down the tree
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 7f742be7e30..bf9c34153b7 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -54,7 +54,7 @@ void TransformReader::get_node_mat(
float copy[4][4];
unit_m4(mat);
-
+
for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {
COLLADAFW::Transformation *tm = node->getTransformations()[i];
@@ -87,11 +87,11 @@ void TransformReader::get_node_mat(
copy_m4_m4(copy, mat);
mul_m4_m4m4(mat, copy, cur);
-
+
if (animation_map) {
// AnimationList that drives this Transformation
const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList();
-
+
// store this so later we can link animation data with ob
Animation anim = {ob, node, tm};
(*animation_map)[anim_list_id] = anim;
diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h
index 08bb17ccac1..6544aa1c040 100644
--- a/source/blender/collada/TransformReader.h
+++ b/source/blender/collada/TransformReader.h
@@ -19,7 +19,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
-
+
/** \file TransformReader.h
* \ingroup collada
*/
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index b7eeff3b074..89653c139f3 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -116,7 +116,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob, B
{
float loc[3], rot[3], scale[3];
bc_decompose(f_obmat, loc, rot, NULL, scale);
- add_transform(node, loc, rot, scale);
+ add_transform(node, loc, rot, scale);
break;
}
}
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index fc848100b79..ff998a94685 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -51,7 +51,7 @@ private:
float y_up_mat4[4][4];
float z_up_mat4[4][4];
float scale_mat4[4][4];
-
+
public:
enum UnitSystem {
@@ -66,11 +66,11 @@ public:
void read_asset(const COLLADAFW::FileInfo *asset);
void convertVector3(COLLADABU::Math::Vector3 &vec, float *v);
-
+
UnitConverter::UnitSystem isMetricSystem(void);
-
+
float getLinearMeter(void);
-
+
// TODO need also for angle conversion, time conversion...
void dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4& in);
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 27389990082..153bc8b28bd 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -74,7 +74,7 @@ float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned in
if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT)
return array.getFloatValues()->getData()[index];
- else
+ else
return array.getDoubleValues()->getData()[index];
}
@@ -82,10 +82,10 @@ float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned in
int bc_test_parent_loop(Object *par, Object *ob)
{
/* test if 'ob' is a parent somewhere in par's parents */
-
+
if (par == NULL) return 0;
if (ob == par) return 1;
-
+
return bc_test_parent_loop(par->parent, ob);
}
@@ -95,7 +95,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
{
Object workob;
Scene *sce = CTX_data_scene(C);
-
+
if (!par || bc_test_parent_loop(par, ob))
return false;
@@ -113,7 +113,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
mul_m4_m4m4(mat, par->obmat, ob->obmat);
copy_m4_m4(ob->obmat, mat);
}
-
+
// apply child obmat (i.e. decompose it into rot/loc/size)
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
@@ -224,7 +224,7 @@ Object *bc_get_assigned_armature(Object *ob)
// IMPORTANT: This function expects that
// all exported objects have set:
// ob->id.tag & LIB_TAG_DOIT
-Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob)
+Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob)
{
Object *ancestor = ob;
while (ob->parent && bc_is_marked(ob->parent)) {
@@ -249,7 +249,7 @@ bool bc_is_in_Export_set(LinkNode *export_set, Object *ob)
bool bc_has_object_type(LinkNode *export_set, short obtype)
{
LinkNode *node;
-
+
for (node = export_set; node; node = node->next) {
Object *ob = (Object *)node->link;
/* XXX - why is this checking for ob->data? - we could be looking for empties */
@@ -283,7 +283,7 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set)
for (node = export_set; node->next && !sorted; node = node->next) {
sorted = true;
-
+
LinkNode *current;
for (current = export_set; current->next; current = current->next) {
Object *a = (Object *)current->link;
@@ -294,12 +294,12 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set)
current->next->link = a;
sorted = false;
}
-
+
}
}
}
-/* Check if a bone is the top most exportable bone in the bone hierarchy.
+/* Check if a bone is the top most exportable bone in the bone hierarchy.
* When deform_bones_only == false, then only bones with NO parent
* can be root bones. Otherwise the top most deform bones in the hierarchy
* are root bones.
@@ -360,13 +360,13 @@ void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene)
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
}
-void bc_match_scale(std::vector<Object *> *objects_done,
+void bc_match_scale(std::vector<Object *> *objects_done,
UnitConverter &bc_unit,
bool scale_to_scene)
{
for (std::vector<Object *>::iterator it = objects_done->begin();
it != objects_done->end();
- ++it)
+ ++it)
{
Object *ob = *it;
if (ob -> parent == NULL) {
@@ -774,7 +774,7 @@ float bc_get_property(Bone *bone, std::string key, float def)
/**
* Read a custom bone property and convert to matrix
* Return true if conversion was succesfull
-*
+*
* Return false if:
* - the property does not exist
* - is not an array of size 16
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 0069b4d4871..cbce74485b7 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -90,8 +90,8 @@ extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
extern bool bc_is_root_bone(Bone *aBone, bool deform_bones_only);
extern int bc_get_active_UVLayer(Object *ob);
-extern std::string bc_replace_string(std::string data, const std::string& pattern, const std::string& replacement);
-extern std::string bc_url_encode(std::string data);
+extern std::string bc_replace_string(std::string data, const std::string& pattern, const std::string& replacement);
+extern std::string bc_url_encode(std::string data);
extern void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene);
extern void bc_match_scale(std::vector<Object *> *objects_done, UnitConverter &unit_converter, bool scale_to_scene);
@@ -141,8 +141,8 @@ class BCPolygonNormalsIndices
normal_indices.push_back(index);
}
- unsigned int operator[](unsigned int i) {
- return normal_indices[i];
+ unsigned int operator[](unsigned int i) {
+ return normal_indices[i];
}
};