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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-08 09:07:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-08 09:07:48 +0300
commita25c11fd8d602236f36c34c342453149bdc1d909 (patch)
treec1e537d7ef21767130c459914313517671d0170b /source/blender/collada/DocumentImporter.cpp
parent009c38df5303f0a32eed2962650b89ebd6ae2e46 (diff)
Cleanup: trailing space
Remove from blender/nodes, collada, blenfont & render.
Diffstat (limited to 'source/blender/collada/DocumentImporter.cpp')
-rw-r--r--source/blender/collada/DocumentImporter.cpp106
1 files changed, 53 insertions, 53 deletions
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);
}