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:
authorGaia Clary <gaia.clary@machinimatrix.org>2012-06-07 21:55:26 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2012-06-07 21:55:26 +0400
commit49a5141cded6db36642461dc24064e6b695609af (patch)
treead64c8dc797a2cefd8218f8aadd68489994a5590 /source/blender/collada/collada_utils.cpp
parent64c45caff963c30cb9d4f6c0e94036ffa8363882 (diff)
[#31739] Collada: New Export selections 'Include Armatures'
Diffstat (limited to 'source/blender/collada/collada_utils.cpp')
-rw-r--r--source/blender/collada/collada_utils.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 8b7a28e5fbe..8693441d7c8 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -32,8 +32,10 @@
#include "COLLADAFWMeshPrimitive.h"
#include "COLLADAFWMeshVertexData.h"
+#include "DNA_modifier_types.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
@@ -42,8 +44,13 @@
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_object.h"
+#include "BKE_mesh.h"
#include "BKE_scene.h"
+extern "C" {
+#include "BKE_DerivedMesh.h"
+}
+
#include "WM_api.h" // XXX hrm, see if we can do without this
#include "WM_types.h"
@@ -125,3 +132,35 @@ Object *bc_add_object(Scene *scene, int type, const char *name)
return ob;
}
+Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob)
+{
+ Mesh *tmpmesh;
+ CustomDataMask mask = CD_MASK_MESH;
+ DerivedMesh *dm = mesh_create_derived_view(scene, ob, mask);
+ tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here
+ DM_to_mesh(dm, tmpmesh, ob);
+ dm->release(dm);
+ return tmpmesh;
+}
+
+Object *bc_get_assigned_armature(Object *ob)
+{
+ Object *ob_arm = NULL;
+
+ if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) {
+ ob_arm = ob->parent;
+ }
+ else {
+ ModifierData *mod = (ModifierData*)ob->modifiers.first;
+ while (mod) {
+ if (mod->type == eModifierType_Armature) {
+ ob_arm = ((ArmatureModifierData*)mod)->object;
+ }
+
+ mod = mod->next;
+ }
+ }
+
+ return ob_arm;
+}
+