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
path: root/source
diff options
context:
space:
mode:
authorSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2011-07-09 19:15:17 +0400
committerSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>2011-07-09 19:15:17 +0400
commiteb452225cec986e44f049d0cd42e862be13e4126 (patch)
treed52bbf65a72fb56d6af150223e8dddbf5748bc2b /source
parent767c7f24dd277fa1d8e97f02fcddb08cd6f25234 (diff)
Improvements to import system. Ability to include more parameters.
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/AnimationExporter.cpp12
-rw-r--r--source/blender/collada/AnimationImporter.cpp60
-rw-r--r--source/blender/collada/AnimationImporter.h32
3 files changed, 76 insertions, 28 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 311ed290c45..2072b1df7a8 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -92,7 +92,7 @@ void AnimationExporter::exportAnimations(Scene *sce)
if ((!strcmp(transformName, "lens"))||
(!strcmp(transformName, "ortho_scale"))||
- (!strcmp(transformName, "clipend")))
+ (!strcmp(transformName, "clipend"))||(!strcmp(transformName, "clipsta")))
dae_animation(ob ,fcu, transformName,true );
fcu = fcu->next;
}
@@ -188,7 +188,8 @@ void AnimationExporter::exportAnimations(Scene *sce)
}
//maybe a list or a vector of float animations
else if ( !strcmp(transformName, "spot_size")||!strcmp(transformName, "spot_blend")||
- !strcmp(transformName, "lens")||!strcmp(transformName, "ortho_scale")||!strcmp(transformName, "clipend"))
+ !strcmp(transformName, "lens")||!strcmp(transformName, "ortho_scale")||!strcmp(transformName, "clipend")||
+ !strcmp(transformName, "clipsta"))
{
axis_name = "";
}
@@ -811,6 +812,9 @@ void AnimationExporter::exportAnimations(Scene *sce)
tm_type = 8;
else if (!strcmp(name, "clipend"))
tm_type = 9;
+ else if (!strcmp(name, "clipsta"))
+ tm_type = 10;
+
else
tm_type = -1;
}
@@ -845,7 +849,11 @@ void AnimationExporter::exportAnimations(Scene *sce)
case 9:
tm_name = "zfar";
break;
+ case 10:
+ tm_name = "znear";
+ break;
+
default:
tm_name = "";
break;
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index ecd174891ae..5f4d4905646 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -724,7 +724,7 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
std::map<COLLADAFW::UniqueId, Object*>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map)
{
- int animType = get_animation_type(node, FW_object_map );
+ AnimationImporter::AnimMix* animType = get_animation_type(node, FW_object_map );
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
@@ -738,7 +738,8 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
bAction * act;
bActionGroup *grp = NULL;
- if ( (animType & NODE_TRANSFORM) != 0 )
+ //if ( (animType & NODE_TRANSFORM) != 0 )
+ if ( (animType->transform) != 0 )
{
const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
char joint_path[200];
@@ -804,7 +805,8 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
}
}
- if ( ((animType & LIGHT_COLOR) != 0)|| ((animType & LIGHT_FOA) != 0) || ((animType & LIGHT_FOE) != 0) )
+ //if ( ((animType & LIGHT_COLOR) != 0)|| ((animType & LIGHT_FOA) != 0) || ((animType & LIGHT_FOE) != 0) )
+ if ((animType->light) != 0)
{
Lamp * lamp = (Lamp*) ob->data;
@@ -817,7 +819,7 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
for (unsigned int i = 0; i < nodeLights.getCount(); i++) {
const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()];
- if ((animType & LIGHT_COLOR) != 0)
+ if ((animType->light & LIGHT_COLOR) != 0)
{
const COLLADAFW::Color *col = &(light->getColor());
const COLLADAFW::UniqueId& listid = col->getAnimationList();
@@ -840,13 +842,13 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
}
}
- if ((animType & LIGHT_FOA) != 0 )
+ if ((animType->light & LIGHT_FOA) != 0 )
{
const COLLADAFW::AnimatableFloat *foa = &(light->getFallOffAngle());
const COLLADAFW::UniqueId& listid = foa->getAnimationList();
Assign_float_animations( listid ,AnimCurves, "spot_size");
}
- if ( (animType & LIGHT_FOE) != 0 )
+ if ( (animType->light & LIGHT_FOE) != 0 )
{
const COLLADAFW::AnimatableFloat *foe = &(light->getFallOffExponent());
const COLLADAFW::UniqueId& listid = foe->getAnimationList();
@@ -856,7 +858,8 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
}
}
- if ( ((animType & CAMERA_XFOV) != 0) || (animType & CAMERA_XMAG) != 0 )
+ //if ( ((animType & CAMERA_XFOV) != 0) || (animType & CAMERA_XMAG) != 0 )
+ if ( (animType->camera) != 0)
{
Camera * camera = (Camera*) ob->data;
@@ -869,14 +872,14 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
for (unsigned int i = 0; i < nodeCameras.getCount(); i++) {
const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()];
- if ((animType & CAMERA_XFOV) != 0 )
+ if ((animType->camera & CAMERA_XFOV) != 0 )
{
const COLLADAFW::AnimatableFloat *xfov = &(camera->getXFov());
const COLLADAFW::UniqueId& listid = xfov->getAnimationList();
Assign_float_animations( listid ,AnimCurves, "lens");
}
- else if ((animType & CAMERA_XMAG) != 0 )
+ else if ((animType->camera & CAMERA_XMAG) != 0 )
{
const COLLADAFW::AnimatableFloat *xmag = &(camera->getXMag());
const COLLADAFW::UniqueId& listid = xmag->getAnimationList();
@@ -887,11 +890,16 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
}
//Check if object is animated by checking if animlist_map holds the animlist_id of node transforms
-int AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
+AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map)
{
- int type = INANIMATE ;
- //bool exists = false;
+ AnimationImporter::AnimMix *types = NULL;
+ types->transform = INANIMATE ;
+ types->light = INANIMATE;
+ types->camera = INANIMATE;
+ types->material = INANIMATE;
+ types->texture = INANIMATE;
+
const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations();
//for each transformation in node
@@ -903,7 +911,7 @@ int AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
if (animlist_map.find(listid) == animlist_map.end()) continue ;
else
{
- type = type|NODE_TRANSFORM;
+ types->transform = types->transform|NODE_TRANSFORM;
break;
}
}
@@ -917,22 +925,26 @@ int AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
//check if color has animations
if (animlist_map.find(col_listid) != animlist_map.end())
- type = type|LIGHT_COLOR;
+ // type = type|LIGHT_FOA;
+ types->light = types->light|LIGHT_COLOR;
const COLLADAFW::AnimatableFloat *fallOffAngle = &(light->getFallOffAngle());
const COLLADAFW::UniqueId& foa_listid = fallOffAngle ->getAnimationList();
if (animlist_map.find(foa_listid) != animlist_map.end())
- type = type|LIGHT_FOA;
+ // type = type|LIGHT_FOA;
+ types->light = types->light|LIGHT_FOA;
const COLLADAFW::AnimatableFloat *fallOffExpo = &(light->getFallOffExponent());
const COLLADAFW::UniqueId& foe_listid = fallOffExpo ->getAnimationList();
if (animlist_map.find(foe_listid) != animlist_map.end())
- type = type|LIGHT_FOE;
+ //type = type|LIGHT_FOE;
+ types->light = types->light|LIGHT_FOE;
+
+ //if ( type != 0) break;
+ if ( types->light != 0) break;
- if ( type != 0) break;
-
}
const COLLADAFW::InstanceCameraPointerArray& nodeCameras = node->getInstanceCameras();
@@ -944,19 +956,23 @@ int AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
const COLLADAFW::AnimatableFloat *xfov = &(camera->getXFov());
const COLLADAFW::UniqueId& xfov_listid = xfov ->getAnimationList();
if (animlist_map.find(xfov_listid) != animlist_map.end())
- type = type|CAMERA_XFOV;
+ //type = type|CAMERA_XFOV;
+ types->camera = types->camera|CAMERA_XFOV;
+
}
else
{
const COLLADAFW::AnimatableFloat *xmag = &(camera->getXMag());
const COLLADAFW::UniqueId& xmag_listid = xmag ->getAnimationList();
if (animlist_map.find(xmag_listid) != animlist_map.end())
- type = type|CAMERA_XMAG;
+ // type = type|CAMERA_XMAG;
+ types->camera = types->camera|CAMERA_XMAG;
}
- if ( type != 0) break;
+ //if ( type != 0) break;
+ if ( types->camera != 0) break;
}
- return type;
+ return types;
}
//XXX Is not used anymore.
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 138d932cdbf..037ae04a0b4 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -85,17 +85,41 @@ private:
void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
int typeFlag;
-
+
+ enum lightAnim
+ {
+// INANIMATE = 0,
+ LIGHT_COLOR = 2,
+ LIGHT_FOA = 4,
+ LIGHT_FOE = 8
+ };
+
+ enum cameraAnim
+ {
+// INANIMATE = 0,
+ CAMERA_XFOV = 2,
+ CAMERA_XMAG = 4
+ };
+
enum AnimationType
{
INANIMATE = 0,
NODE_TRANSFORM = 1,
- LIGHT_COLOR = 2,
+ /* LIGHT_COLOR = 2,
LIGHT_FOA = 4,
LIGHT_FOE = 8,
CAMERA_XFOV = 16,
- CAMERA_XMAG = 32
+ CAMERA_XMAG = 32*/
};
+
+ struct AnimMix
+ {
+ int transform;
+ int light;
+ int camera;
+ int material;
+ int texture;
+ };
public:
AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene);
@@ -117,7 +141,7 @@ public:
std::map<COLLADAFW::UniqueId, Object*>& object_map ,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
- int get_animation_type( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map ) ;
+ AnimMix* get_animation_type( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map ) ;
void Assign_transform_animations(COLLADAFW::Transformation* transform ,