[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22194] branches/soc-2009-chingachgook/ source/blender/collada: * fixed armature bind pose issue
Chingiz Dyussenov
chingiz.ds at gmail.com
Mon Aug 3 21:58:23 CEST 2009
Revision: 22194
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22194
Author: chingachgook
Date: 2009-08-03 21:58:23 +0200 (Mon, 03 Aug 2009)
Log Message:
-----------
* fixed armature bind pose issue
* fixed image exporting issue
Modified Paths:
--------------
branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp
branches/soc-2009-chingachgook/source/blender/collada/DocumentImporter.cpp
branches/soc-2009-chingachgook/source/blender/collada/collada_internal.h
Modified: branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp
===================================================================
--- branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp 2009-08-03 18:44:01 UTC (rev 22193)
+++ branches/soc-2009-chingachgook/source/blender/collada/DocumentExporter.cpp 2009-08-03 19:58:23 UTC (rev 22194)
@@ -1273,18 +1273,31 @@
Image *image = mtex->tex->ima;
std::string name(id_name(image));
- char ima_name[FILE_MAX];
+ char rel[FILE_MAX];
+ char abs[FILE_MAX];
+ char src[FILE_MAX];
char dir[FILE_MAX];
BLI_split_dirfile_basic(mfilename, dir, NULL);
- BKE_get_image_export_path(image, dir, NULL, NULL, ima_name, sizeof(ima_name));
+
+ BKE_get_image_export_path(image, dir, abs, sizeof(abs), rel, sizeof(rel));
+
+ if (strlen(abs)) {
+
+ // make absolute source path
+ BLI_strncpy(src, image->name, sizeof(src));
+ BLI_convertstringcode(src, G.sce);
+
+ // make dest directory if it doesn't exist
+ BLI_make_existing_file(abs);
- if (BLI_copy_fileops(image->name, dir) != 0) {
- fprintf(stderr, "Cannot copy image to file's directory. \n");
- }
+ if (BLI_copy_fileops(src, abs) != 0) {
+ fprintf(stderr, "Cannot copy image to file's directory. \n");
+ }
+ }
if (find(mImages.begin(), mImages.end(), name) == mImages.end()) {
- COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(ima_name)), name, "");
+ COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(rel)), name, "");
img.add(mSW);
mImages.push_back(name);
Modified: branches/soc-2009-chingachgook/source/blender/collada/DocumentImporter.cpp
===================================================================
--- branches/soc-2009-chingachgook/source/blender/collada/DocumentImporter.cpp 2009-08-03 18:44:01 UTC (rev 22193)
+++ branches/soc-2009-chingachgook/source/blender/collada/DocumentImporter.cpp 2009-08-03 19:58:23 UTC (rev 22194)
@@ -167,7 +167,7 @@
virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0;
};
-class TransformReader : protected TransformBase
+class TransformReader : public TransformBase
{
protected:
@@ -459,8 +459,11 @@
return false;
}
- void link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid)
+ void link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid,
+ TransformReader *tm)
{
+ tm->decompose(bind_shape_matrix, ob->loc, ob->rot, ob->size);
+
ob->parent = ob_arm;
ob->partype = PARSKEL;
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
@@ -856,7 +859,7 @@
// link armature with an object
Object *ob = mesh_importer->get_object_by_geom_uid(*get_geometry_uid(skin.get_controller_uid()));
if (ob) {
- skin.link_armature(C, ob, joint_by_uid);
+ skin.link_armature(C, ob, joint_by_uid, this);
}
else {
fprintf(stderr, "Cannot find object to link armature with.\n");
Modified: branches/soc-2009-chingachgook/source/blender/collada/collada_internal.h
===================================================================
--- branches/soc-2009-chingachgook/source/blender/collada/collada_internal.h 2009-08-03 18:44:01 UTC (rev 22193)
+++ branches/soc-2009-chingachgook/source/blender/collada/collada_internal.h 2009-08-03 19:58:23 UTC (rev 22194)
@@ -57,7 +57,7 @@
class TransformBase
{
-protected:
+public:
void decompose(float mat[][4], float *loc, float *rot, float *size)
{
Mat4ToSize(mat, size);
More information about the Bf-blender-cvs
mailing list