style cleanup

This commit is contained in:
2012-06-12 22:05:33 +00:00
parent 46c95d37c6
commit 2e8a2f7668
28 changed files with 1293 additions and 1254 deletions

View File

@@ -3090,13 +3090,11 @@ static Object *obrel_armature_find(Object *ob)
ob_arm = ob->parent; ob_arm = ob->parent;
} }
else { else {
ModifierData *mod = (ModifierData*)ob->modifiers.first; ModifierData *mod;
while (mod) { for (mod = (ModifierData *)ob->modifiers.first; mod; mod = mod->next) {
if (mod->type == eModifierType_Armature) { if (mod->type == eModifierType_Armature) {
ob_arm = ((ArmatureModifierData *)mod)->object; ob_arm = ((ArmatureModifierData *)mod)->object;
} }
mod = mod->next;
} }
} }
@@ -3104,11 +3102,11 @@ static Object *obrel_armature_find(Object *ob)
} }
static int obrel_is_recursive_child(Object *ob, Object *child) { static int obrel_is_recursive_child(Object *ob, Object *child) {
Object *ancestor = child->parent; Object *par;
while (ancestor) for (par = child->parent; par; par = par->parent) {
{ if (par == ob) {
if(ancestor == ob) return TRUE; return TRUE;
ancestor = ancestor->parent; }
} }
return FALSE; return FALSE;
} }
@@ -3151,9 +3149,9 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
obrel_list_add(&links, ob); obrel_list_add(&links, ob);
} }
else { else {
if ( (objectSet == OB_SET_SELECTED && TESTBASELIB_BGMODE(((View3D *)NULL), scene, base)) if ((objectSet == OB_SET_SELECTED && TESTBASELIB_BGMODE(((View3D *)NULL), scene, base)) ||
|| (objectSet == OB_SET_VISIBLE && BASE_EDITABLE_BGMODE(((View3D *)NULL), scene, base)) (objectSet == OB_SET_VISIBLE && BASE_EDITABLE_BGMODE(((View3D *)NULL), scene, base)))
) { {
Object *ob = base->object; Object *ob = base->object;
if (obrel_list_test(ob)) if (obrel_list_test(ob))
@@ -3186,8 +3184,9 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
Object *child = local_base->object; Object *child = local_base->object;
if (obrel_list_test(child)) { if (obrel_list_test(child)) {
if ((includeFilter & OB_REL_CHILDREN_RECURSIVE && obrel_is_recursive_child(ob,child)) if ((includeFilter & OB_REL_CHILDREN_RECURSIVE && obrel_is_recursive_child(ob, child)) ||
|| (includeFilter & OB_REL_CHILDREN && child->parent && child->parent == ob )) { (includeFilter & OB_REL_CHILDREN && child->parent && child->parent == ob))
{
obrel_list_add(&links, child); obrel_list_add(&links, child);
} }
} }
@@ -3206,7 +3205,7 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
} }
} }
} // end for }
return links; return links;
} }

View File

@@ -1110,6 +1110,7 @@ void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
} }
} }
/* TODO - only check NodeLink objects that are exported */
bool AnimationExporter::hasAnimations(Scene *sce) bool AnimationExporter::hasAnimations(Scene *sce)
{ {
Base *base = (Base *) sce->base.first; Base *base = (Base *) sce->base.first;

View File

@@ -240,7 +240,8 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve*>&
} }
AnimationImporter::AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) : AnimationImporter::AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) :
TransformReader(conv), armature_importer(arm), scene(scene) { } TransformReader(conv), armature_importer(arm), scene(scene) {
}
AnimationImporter::~AnimationImporter() AnimationImporter::~AnimationImporter()
{ {

View File

@@ -58,7 +58,8 @@ extern "C" {
// XXX exporter writes wrong data for shared armatures. A separate // XXX exporter writes wrong data for shared armatures. A separate
// controller should be written for each armature-mesh binding how do // controller should be written for each armature-mesh binding how do
// we make controller ids then? // we make controller ids then?
ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryControllers(sw), export_settings(export_settings) {} ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryControllers(sw), export_settings(export_settings) {
}
// write bone nodes // write bone nodes
void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce, void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce,
@@ -226,7 +227,8 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
//} //}
} }
/*void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node) #if 0
void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node)
{ {
node.start(); node.start();
@@ -241,7 +243,9 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
} }
node.end(); node.end();
}*/ }
#endif
void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node) void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
{ {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name); bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
@@ -302,7 +306,7 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
// joint names: ob -> vertex group names // joint names: ob -> vertex group names
// vertex group weights: me->dvert -> groups -> index, weight // vertex group weights: me->dvert -> groups -> index, weight
/* #if 0
me->dvert : me->dvert :
typedef struct MDeformVert { typedef struct MDeformVert {
@@ -315,7 +319,7 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
int def_nr; int def_nr;
float weight; float weight;
} MDeformWeight; } MDeformWeight;
*/ #endif
bool use_instantiation = this->export_settings->use_object_instantiation; bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me; Mesh *me;
@@ -384,9 +388,11 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
} }
else { else {
vcounts.push_back(0); vcounts.push_back(0);
/*vcounts.push_back(1); #if 0
vcounts.push_back(1);
joints.push_back(-1); joints.push_back(-1);
weights.push_back(1.0f);*/ weights.push_back(1.0f);
#endif
} }
} }
} }

View File

@@ -50,7 +50,8 @@ static const char *bc_get_joint_name(T *node)
} }
ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) : ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) :
TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {} TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {
}
ArmatureImporter::~ArmatureImporter() ArmatureImporter::~ArmatureImporter()
{ {
@@ -428,8 +429,8 @@ void ArmatureImporter::create_armature_bones( )
// create unskinned bones // create unskinned bones
/* /*
TODO: * TODO:
check if bones have already been created for a given joint * check if bones have already been created for a given joint
*/ */
leaf_bone_length = FLT_MAX; leaf_bone_length = FLT_MAX;
create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm); create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm);
@@ -799,6 +800,3 @@ bool ArmatureImporter::get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint)
return found; return found;
} }

View File

@@ -37,7 +37,8 @@ extern "C" {
#include "collada_internal.h" #include "collada_internal.h"
CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryCameras(sw), export_settings(export_settings) {} CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryCameras(sw), export_settings(export_settings) {
}
template<class Functor> template<class Functor>
void forEachCameraObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set) void forEachCameraObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
@@ -90,5 +91,6 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
addCamera(ccam); addCamera(ccam);
break; break;
}} }
}
} }

View File

@@ -146,7 +146,8 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
return data->layers[layer_index].name; return data->layers[layer_index].name;
} }
DocumentExporter::DocumentExporter(const ExportSettings *export_settings) : export_settings(export_settings) {} DocumentExporter::DocumentExporter(const ExportSettings *export_settings) : export_settings(export_settings) {
}
// TODO: it would be better to instantiate animations rather than create a new one per object // TODO: it would be better to instantiate animations rather than create a new one per object
// COLLADA allows this through multiple <channel>s in <animation>. // COLLADA allows this through multiple <channel>s in <animation>.
@@ -289,9 +290,8 @@ void DocumentExporter::exportScenes(const char* filename)
} }
/* /*
* NOTES:
NOTES: *
* AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user * AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user
*
*/ */

View File

@@ -103,7 +103,8 @@ DocumentImporter::DocumentImporter(bContext *C, const char *filename) :
armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)), armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)), mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)),
anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C)) anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C))
{} {
}
DocumentImporter::~DocumentImporter() DocumentImporter::~DocumentImporter()
{ {
@@ -265,14 +266,16 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
root_map[node->getUniqueId()] = root_map[par->getUniqueId()]; root_map[node->getUniqueId()] = root_map[par->getUniqueId()];
} }
/*COLLADAFW::Transformation::TransformationType types[] = { #if 0
COLLADAFW::Transformation::TransformationType types[] = {
COLLADAFW::Transformation::ROTATE, COLLADAFW::Transformation::ROTATE,
COLLADAFW::Transformation::SCALE, COLLADAFW::Transformation::SCALE,
COLLADAFW::Transformation::TRANSLATE, COLLADAFW::Transformation::TRANSLATE,
COLLADAFW::Transformation::MATRIX COLLADAFW::Transformation::MATRIX
}; };
Object *ob;*/ Object *ob;
#endif
unsigned int i; unsigned int i;
//for (i = 0; i < 4; i++) //for (i = 0; i < 4; i++)
@@ -286,7 +289,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
} }
/** When this method is called, the writer must write the global document asset. /** When this method is called, the writer must write the global document asset.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeGlobalAsset(const COLLADAFW::FileInfo *asset) bool DocumentImporter::writeGlobalAsset(const COLLADAFW::FileInfo *asset)
{ {
unit_converter.read_asset(asset); unit_converter.read_asset(asset);
@@ -295,7 +298,7 @@ bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo* asset )
} }
/** When this method is called, the writer must write the scene. /** When this method is called, the writer must write the scene.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene) bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene)
{ {
// XXX could store the scene id, but do nothing for now // XXX could store the scene id, but do nothing for now
@@ -517,7 +520,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
} }
/** When this method is called, the writer must write the entire visual scene. /** When this method is called, the writer must write the entire visual scene.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScene) bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScene)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -539,8 +542,8 @@ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualSc
} }
/** 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. * library nodes.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryNodes) bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryNodes)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -558,7 +561,7 @@ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* librar
} }
/** When this method is called, the writer must write the geometry. /** When this method is called, the writer must write the geometry.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeGeometry(const COLLADAFW::Geometry *geom) bool DocumentImporter::writeGeometry(const COLLADAFW::Geometry *geom)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -568,7 +571,7 @@ bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom )
} }
/** When this method is called, the writer must write the material. /** When this method is called, the writer must write the material.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat) bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -740,23 +743,25 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
} }
// TRANSPARENT // TRANSPARENT
// color // color
// if (ef->getOpacity().isColor()) { #if 0
// // XXX don't know what to do here if (ef->getOpacity().isColor()) {
// } // XXX don't know what to do here
// // texture }
// else if (ef->getOpacity().isTexture()) { // texture
// ctex = ef->getOpacity().getTexture(); else if (ef->getOpacity().isTexture()) {
// if (mtex != NULL) mtex->mapto &= MAP_ALPHA; ctex = ef->getOpacity().getTexture();
// else { if (mtex != NULL) mtex->mapto &= MAP_ALPHA;
// mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); else {
// if (mtex != NULL) mtex->mapto = MAP_ALPHA; mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
// } if (mtex != NULL) mtex->mapto = MAP_ALPHA;
// } }
}
#endif
material_texture_mapping_map[ma] = texindex_texarray_map; material_texture_mapping_map[ma] = texindex_texarray_map;
} }
/** When this method is called, the writer must write the effect. /** When this method is called, the writer must write the effect.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeEffect(const COLLADAFW::Effect *effect) bool DocumentImporter::writeEffect(const COLLADAFW::Effect *effect)
{ {
@@ -794,7 +799,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
/** When this method is called, the writer must write the camera. /** When this method is called, the writer must write the camera.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -910,7 +915,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
} }
/** When this method is called, the writer must write the image. /** When this method is called, the writer must write the image.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeImage(const COLLADAFW::Image *image) bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -935,7 +940,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image )
} }
/** When this method is called, the writer must write the light. /** When this method is called, the writer must write the light.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeLight(const COLLADAFW::Light *light) bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
{ {
if (mImportStage != General) if (mImportStage != General)
@@ -1129,7 +1134,7 @@ bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* anima
} }
/** When this method is called, the writer must write the skin controller data. /** When this method is called, the writer must write the skin controller data.
\return The writer should return true, if writing succeeded, false otherwise.*/ * \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeSkinControllerData(const COLLADAFW::SkinControllerData *skin) bool DocumentImporter::writeSkinControllerData(const COLLADAFW::SkinControllerData *skin)
{ {
return armature_importer.write_skin_controller_data(skin); return armature_importer.write_skin_controller_data(skin);

View File

@@ -55,7 +55,8 @@ static std::string getActiveUVLayerName(Object *ob)
return ""; return "";
} }
EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryEffects(sw), export_settings(export_settings) {} EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryEffects(sw), export_settings(export_settings) {
}
bool EffectsExporter::hasEffects(Scene *sce) bool EffectsExporter::hasEffects(Scene *sce)
{ {

View File

@@ -35,7 +35,8 @@ ExtraHandler::ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp) : cu
this->aimp = aimp; this->aimp = aimp;
} }
ExtraHandler::~ExtraHandler() {} ExtraHandler::~ExtraHandler() {
}
bool ExtraHandler::elementBegin(const char *elementName, const char **attributes) bool ExtraHandler::elementBegin(const char *elementName, const char **attributes)
{ {
@@ -64,7 +65,8 @@ bool ExtraHandler::textData(const char* text, size_t textLength)
bool ExtraHandler::parseElement( bool ExtraHandler::parseElement(
const char *profileName, const char *profileName,
const unsigned long& elementHash, const unsigned long& elementHash,
const COLLADAFW::UniqueId& uniqueId ) { const COLLADAFW::UniqueId& uniqueId)
{
if (BLI_strcaseeq(profileName, "blender")) { if (BLI_strcaseeq(profileName, "blender")) {
//printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str()); //printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
currentUid = uniqueId; currentUid = uniqueId;

View File

@@ -52,7 +52,8 @@ extern "C" {
#include "collada_utils.h" #include "collada_utils.h"
// TODO: optimize UV sets by making indexed list with duplicates removed // TODO: optimize UV sets by making indexed list with duplicates removed
GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {} GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {
}
void GeometryExporter::exportGeom(Scene *sce) void GeometryExporter::exportGeom(Scene *sce)
@@ -91,7 +92,9 @@ void GeometryExporter::operator()(Object *ob)
// Skip if linked geometry was already exported from another reference // Skip if linked geometry was already exported from another reference
if (use_instantiation && if (use_instantiation &&
exportedGeometry.find(geom_id) != exportedGeometry.end()) exportedGeometry.find(geom_id) != exportedGeometry.end())
{
return; return;
}
std::string geom_name = (use_instantiation) ? id_name(ob->data) : id_name(ob); std::string geom_name = (use_instantiation) ? id_name(ob->data) : id_name(ob);
@@ -563,8 +566,9 @@ COLLADASW::URI GeometryExporter::makeUrl(std::string id)
return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id); return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
} }
#if 0
/* int GeometryExporter::getTriCount(MFace *faces, int totface) { int GeometryExporter::getTriCount(MFace *faces, int totface)
{
int i; int i;
int tris = 0; int tris = 0;
for (i = 0; i < totface; i++) { for (i = 0; i < totface; i++) {
@@ -576,4 +580,5 @@ COLLADASW::URI GeometryExporter::makeUrl(std::string id)
} }
return tris; return tris;
}*/ }
#endif

View File

@@ -42,8 +42,10 @@
#include "BLI_string.h" #include "BLI_string.h"
ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryImages(sw), export_settings(export_settings) ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryImages(sw), export_settings(export_settings)
{} {
}
/* TODO - shouldn't this use the objects LinkNode's ? */
bool ImagesExporter::hasImages(Scene *sce) bool ImagesExporter::hasImages(Scene *sce)
{ {
Base *base = (Base *)sce->base.first; Base *base = (Base *)sce->base.first;

View File

@@ -48,7 +48,8 @@ void forEachLampObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
} }
} }
LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryLights(sw), export_settings(export_settings) {} LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryLights(sw), export_settings(export_settings) {
}
void LightsExporter::exportLights(Scene *sce) void LightsExporter::exportLights(Scene *sce)
{ {

View File

@@ -31,7 +31,8 @@
#include "COLLADABUUtils.h" #include "COLLADABUUtils.h"
#include "collada_internal.h" #include "collada_internal.h"
MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryMaterials(sw), export_settings(export_settings) {} MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryMaterials(sw), export_settings(export_settings) {
}
void MaterialsExporter::exportMaterials(Scene *sce) void MaterialsExporter::exportMaterials(Scene *sce)
{ {
@@ -45,7 +46,7 @@ void MaterialsExporter::exportMaterials(Scene *sce)
} }
} }
/* TODO - shouldn't this use the scenes object LinkNode's ? */
bool MaterialsExporter::hasMaterials(Scene *sce) bool MaterialsExporter::hasMaterials(Scene *sce)
{ {
Base *base = (Base *)sce->base.first; Base *base = (Base *)sce->base.first;

View File

@@ -111,7 +111,8 @@ static const char *bc_geomTypeToStr(COLLADAFW::Geometry::GeometryType type)
UVDataWrapper::UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata) UVDataWrapper::UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata)
{} {
}
#ifdef COLLADA_DEBUG #ifdef COLLADA_DEBUG
void WVDataWrapper::print() void WVDataWrapper::print()
@@ -394,8 +395,8 @@ int MeshImporter::count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me)
unsigned int *indices = mp->getPositionIndices().getData(); unsigned int *indices = mp->getPositionIndices().getData();
if (type == COLLADAFW::MeshPrimitive::POLYLIST || if (type == COLLADAFW::MeshPrimitive::POLYLIST ||
type == COLLADAFW::MeshPrimitive::POLYGONS) { type == COLLADAFW::MeshPrimitive::POLYGONS)
{
COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp; COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp;
COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray(); COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
@@ -921,7 +922,8 @@ bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor,
return true; return true;
} }
MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {} MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {
}
void MeshImporter::bmeshConversion() void MeshImporter::bmeshConversion()
{ {

View File

@@ -30,7 +30,8 @@
SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings) SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings)
: COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm), export_settings(export_settings) : COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm), export_settings(export_settings)
{} {
}
void SceneExporter::exportScene(Scene *sce) void SceneExporter::exportScene(Scene *sce)
{ {

View File

@@ -57,7 +57,8 @@ static const char *bc_get_joint_name(T *node)
// This is used to store data passed in write_controller_data. // This is used to store data passed in write_controller_data.
// Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members
// so that arrays don't get freed until we free them explicitly. // so that arrays don't get freed until we free them explicitly.
SkinInfo::SkinInfo() {} SkinInfo::SkinInfo() {
}
SkinInfo::SkinInfo(const SkinInfo& skin) : weights(skin.weights), SkinInfo::SkinInfo(const SkinInfo& skin) : weights(skin.weights),
joint_data(skin.joint_data), joint_data(skin.joint_data),
@@ -73,7 +74,8 @@ SkinInfo::SkinInfo(const SkinInfo& skin) : weights(skin.weights),
transfer_int_array_data_const(skin.joint_indices, joint_indices); transfer_int_array_data_const(skin.joint_indices, joint_indices);
} }
SkinInfo::SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) {} SkinInfo::SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) {
}
// nobody owns the data after this, so it should be freed manually with releaseMemory // nobody owns the data after this, so it should be freed manually with releaseMemory
template <class T> template <class T>

View File

@@ -29,7 +29,8 @@
#include "TransformReader.h" #include "TransformReader.h"
TransformReader::TransformReader(UnitConverter* conv) : unit_converter(conv) {} TransformReader::TransformReader(UnitConverter *conv) : unit_converter(conv) {
}
void TransformReader::get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob) void TransformReader::get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob)
{ {

View File

@@ -59,7 +59,7 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4],
void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
{ {
/* #if 0
float rot[3], loc[3], scale[3]; float rot[3], loc[3], scale[3];
if (ob->parent) { if (ob->parent) {
@@ -92,7 +92,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
} }
add_transform(node, loc, rot, scale); add_transform(node, loc, rot, scale);
*/ #endif
/* Using parentinv should allow use of existing curves */ /* Using parentinv should allow use of existing curves */
if (ob->parent) { if (ob->parent) {
@@ -124,9 +124,11 @@ void TransformWriter::add_node_transform_identity(COLLADASW::Node& node)
void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3]) void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float rot[3], float scale[3])
{ {
node.addTranslate("location", loc[0], loc[1], loc[2]); node.addTranslate("location", loc[0], loc[1], loc[2]);
/*node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2])); #if 0
node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2]));
node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1])); node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));*/ node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));
#endif
node.addRotateZ("rotationZ", RAD2DEGF(rot[2])); node.addRotateZ("rotationZ", RAD2DEGF(rot[2]));
node.addRotateY("rotationY", RAD2DEGF(rot[1])); node.addRotateY("rotationY", RAD2DEGF(rot[1]));
node.addRotateX("rotationX", RAD2DEGF(rot[0])); node.addRotateX("rotationX", RAD2DEGF(rot[0]));

View File

@@ -95,4 +95,6 @@ extern "C"
return 1; return 1;
} }
/* end extern C */
} }

View File

@@ -31,7 +31,8 @@
#include "BLI_linklist.h" #include "BLI_linklist.h"
UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {
}
void UnitConverter::read_asset(const COLLADAFW::FileInfo *asset) void UnitConverter::read_asset(const COLLADAFW::FileInfo *asset)
{ {
@@ -152,7 +153,8 @@ const unsigned char translate_start_name_map[256] = {
225, 226, 227, 228, 229, 230, 231, 232, 225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240, 233, 234, 235, 236, 237, 238, 239, 240,
241, 242, 243, 244, 245, 246, 95, 248, 241, 242, 243, 244, 245, 246, 95, 248,
249, 250, 251, 252, 253, 254, 255}; 249, 250, 251, 252, 253, 254, 255
};
const unsigned char translate_name_map[256] = { const unsigned char translate_name_map[256] = {
95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
@@ -186,7 +188,8 @@ const unsigned char translate_name_map[256] = {
225, 226, 227, 228, 229, 230, 231, 232, 225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240, 233, 234, 235, 236, 237, 238, 239, 240,
241, 242, 243, 244, 245, 246, 95, 248, 241, 242, 243, 244, 245, 246, 95, 248,
249, 250, 251, 252, 253, 254, 255}; 249, 250, 251, 252, 253, 254, 255
};
typedef std::map< std::string, std::vector<std::string> > map_string_list; typedef std::map< std::string, std::vector<std::string> > map_string_list;
map_string_list global_id_map; map_string_list global_id_map;

View File

@@ -154,13 +154,11 @@ Object *bc_get_assigned_armature(Object *ob)
ob_arm = ob->parent; ob_arm = ob->parent;
} }
else { else {
ModifierData *mod = (ModifierData*)ob->modifiers.first; ModifierData *mod;
while (mod) { for (mod = (ModifierData *)ob->modifiers.first; mod; mod = mod->next) {
if (mod->type == eModifierType_Armature) { if (mod->type == eModifierType_Armature) {
ob_arm = ((ArmatureModifierData *)mod)->object; ob_arm = ((ArmatureModifierData *)mod)->object;
} }
mod = mod->next;
} }
} }

View File

@@ -2163,10 +2163,10 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
{ {
char filename[FILE_MAX]; char filename[FILE_MAX];
int selected, second_life, int selected, second_life,
include_armatures, int include_armatures,
apply_modifiers, int apply_modifiers,
include_children, int include_children,
use_object_instantiation; int use_object_instantiation;
if (!RNA_struct_property_is_set(op->ptr, "filepath")) { if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given"); BKE_report(op->reports, RPT_ERROR, "No filename given");
@@ -3825,7 +3825,8 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""}, {GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
{GESTURE_MODAL_NOP, "NOP", 0, "No Operation", ""}, {GESTURE_MODAL_NOP, "NOP", 0, "No Operation", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Gesture Circle"); wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Gesture Circle");
@@ -3873,7 +3874,8 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line"); wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
@@ -3902,7 +3904,8 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""}, {GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Border"); wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Border");
@@ -3962,7 +3965,8 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_IN, "IN", 0, "In", ""}, {GESTURE_MODAL_IN, "IN", 0, "In", ""},
{GESTURE_MODAL_OUT, "OUT", 0, "Out", ""}, {GESTURE_MODAL_OUT, "OUT", 0, "Out", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Zoom Border"); wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Zoom Border");