[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39898] trunk/blender/source/blender/ collada: Some whitespace changes
Nathan Letwory
nathan at letworyinteractive.com
Sun Sep 4 02:16:03 CEST 2011
Revision: 39898
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39898
Author: jesterking
Date: 2011-09-04 00:15:59 +0000 (Sun, 04 Sep 2011)
Log Message:
-----------
Some whitespace changes
Modified Paths:
--------------
trunk/blender/source/blender/collada/AnimationExporter.cpp
trunk/blender/source/blender/collada/AnimationImporter.cpp
trunk/blender/source/blender/collada/AnimationImporter.h
trunk/blender/source/blender/collada/ArmatureExporter.cpp
trunk/blender/source/blender/collada/ArmatureImporter.cpp
trunk/blender/source/blender/collada/ArmatureImporter.h
trunk/blender/source/blender/collada/MeshImporter.cpp
trunk/blender/source/blender/collada/SkinInfo.cpp
trunk/blender/source/blender/collada/TransformWriter.cpp
Modified: trunk/blender/source/blender/collada/AnimationExporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/AnimationExporter.cpp 2011-09-03 21:30:40 UTC (rev 39897)
+++ trunk/blender/source/blender/collada/AnimationExporter.cpp 2011-09-04 00:15:59 UTC (rev 39898)
@@ -1,26 +1,26 @@
/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
+* $Id$
+*
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
#include "GeometryExporter.h"
#include "AnimationExporter.h"
@@ -30,10 +30,10 @@
void forEachObjectInScene(Scene *sce, Functor &f)
{
Base *base= (Base*) sce->base.first;
-
+
while(base) {
Object *ob = base->object;
-
+
f(ob);
base= base->next;
@@ -61,7 +61,7 @@
bool isMatAnim = false;
//Export transform animations
- if(ob->adt && ob->adt->action)
+ if(ob->adt && ob->adt->action)
{
fcu = (FCurve*)ob->adt->action->curves.first;
@@ -72,21 +72,21 @@
for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
write_bone_animation_matrix(ob, bone);
}
-
+
while (fcu) {
//for armature animations as objects
if ( ob->type == OB_ARMATURE )
transformName = fcu->rna_path;
else
transformName = extract_transform_name( fcu->rna_path );
-
+
if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
(!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
(!strcmp(transformName, "rotation_quaternion")))
dae_animation(ob ,fcu, transformName, false);
fcu = fcu->next;
}
-
+
}
//Export Lamp parameter animations
@@ -94,8 +94,8 @@
{
fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
while (fcu) {
- transformName = extract_transform_name( fcu->rna_path );
-
+ transformName = extract_transform_name( fcu->rna_path );
+
if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))||
(!strcmp(transformName, "distance")) )
dae_animation(ob , fcu, transformName, true );
@@ -108,8 +108,8 @@
{
fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
while (fcu) {
- transformName = extract_transform_name( fcu->rna_path );
-
+ transformName = extract_transform_name( fcu->rna_path );
+
if ((!strcmp(transformName, "lens"))||
(!strcmp(transformName, "ortho_scale"))||
(!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start")))
@@ -129,7 +129,7 @@
fcu = (FCurve*)ma->adt->action->curves.first;
while (fcu) {
transformName = extract_transform_name( fcu->rna_path );
-
+
if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color"))
||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))||
(!strcmp(transformName, "ior")))
@@ -137,384 +137,384 @@
fcu = fcu->next;
}
}
-
+
}
}
- //euler sources from quternion sources
- float * AnimationExporter::get_eul_source_for_quat(Object *ob )
+//euler sources from quternion sources
+float * AnimationExporter::get_eul_source_for_quat(Object *ob )
+{
+ FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
+ 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];
+ float temp_eul[3];
+ while(fcu)
{
- FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
- 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];
- float temp_eul[3];
- while(fcu)
- {
- char * transformName = extract_transform_name( fcu->rna_path );
-
- if( !strcmp(transformName, "rotation_quaternion") ) {
- for ( int i = 0 ; i < fcu->totvert ; i++){
- *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
- }
- }
- fcu = fcu->next;
+ char * transformName = extract_transform_name( fcu->rna_path );
+
+ if( !strcmp(transformName, "rotation_quaternion") ) {
+ for ( int i = 0 ; i < fcu->totvert ; i++){
+ *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
}
+ }
+ fcu = fcu->next;
+ }
- for ( int i = 0 ; i < keys ; i++){
- for ( int j = 0;j<4;j++)
- temp_quat[j] = quat[(i*4)+j];
+ for ( int i = 0 ; i < keys ; i++){
+ for ( int j = 0;j<4;j++)
+ temp_quat[j] = quat[(i*4)+j];
- quat_to_eul(temp_eul,temp_quat);
+ quat_to_eul(temp_eul,temp_quat);
- for (int k = 0;k<3;k++)
- eul[i*3 + k] = temp_eul[k];
+ for (int k = 0;k<3;k++)
+ eul[i*3 + k] = temp_eul[k];
- }
- MEM_freeN(quat);
- return eul;
-
}
+ MEM_freeN(quat);
+ return eul;
- //Get proper name for bones
- std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
- {
- //hard-way to derive the bone name from rna_path. Must find more compact method
- std::string rna_path = std::string(fcu->rna_path);
+}
- char* boneName = strtok((char *)rna_path.c_str(), "\"");
- boneName = strtok(NULL,"\"");
-
- if( boneName != NULL )
- return /*id_name(ob) + "_" +*/ std::string(boneName);
- else
- return id_name(ob);
+//Get proper name for bones
+std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
+{
+ //hard-way to derive the bone name from rna_path. Must find more compact method
+ std::string rna_path = std::string(fcu->rna_path);
+
+ char* boneName = strtok((char *)rna_path.c_str(), "\"");
+ boneName = strtok(NULL,"\"");
+
+ if( boneName != NULL )
+ return /*id_name(ob) + "_" +*/ std::string(boneName);
+ else
+ return id_name(ob);
+}
+
+//convert f-curves to animation curves and write
+void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
+{
+ const char *axis_name = NULL;
+ char anim_id[200];
+
+ bool has_tangents = false;
+ bool quatRotation = false;
+
+ if ( !strcmp(transformName, "rotation_quaternion") )
+ {
+ fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
+ quatRotation = true;
+ return;
}
- //convert f-curves to animation curves and write
- void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
+ //axis names for colors
+ else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")||
+ (!strcmp(transformName, "alpha")))
{
- const char *axis_name = NULL;
- char anim_id[200];
-
- bool has_tangents = false;
- bool quatRotation = false;
-
- if ( !strcmp(transformName, "rotation_quaternion") )
- {
- fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
- quatRotation = true;
- return;
- }
-
- //axis names for colors
- else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")||
- (!strcmp(transformName, "alpha")))
- {
- const char *axis_names[] = {"R", "G", "B"};
- if (fcu->array_index < 3)
+ const char *axis_names[] = {"R", "G", "B"};
+ if (fcu->array_index < 3)
axis_name = axis_names[fcu->array_index];
- }
+ }
- //axis names for transforms
- else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
- (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion")))
- {
- const char *axis_names[] = {"X", "Y", "Z"};
- if (fcu->array_index < 3)
+ //axis names for transforms
+ else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
+ (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion")))
+ {
+ const char *axis_names[] = {"X", "Y", "Z"};
+ if (fcu->array_index < 3)
axis_name = axis_names[fcu->array_index];
- }
+ }
- //no axis name. single parameter.
- else{
- axis_name = "";
- }
-
- std::string ob_name = std::string("null");
+ //no axis name. single parameter.
+ else{
+ axis_name = "";
+ }
- //Create anim Id
- if (ob->type == OB_ARMATURE)
- {
- ob_name = getObjectBoneName( ob , fcu);
- BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(),
- transformName, axis_name);
- }
- else
- {
- if (ma)
- ob_name = id_name(ob) + "_material";
- else
- ob_name = id_name(ob);
- BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
- fcu->rna_path, axis_name);
- }
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list