Fix compilation error with Collada enabled
This commit is contained in:
parent
911f239d09
commit
ac0da72a60
|
@ -34,10 +34,11 @@ void forEachObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
|
|||
}
|
||||
}
|
||||
|
||||
bool AnimationExporter::exportAnimations(Scene *sce)
|
||||
bool AnimationExporter::exportAnimations(struct EvaluationContext *eval_ctx, Scene *sce)
|
||||
{
|
||||
bool has_animations = hasAnimations(sce);
|
||||
if (has_animations) {
|
||||
this->eval_ctx = eval_ctx;
|
||||
this->scene = sce;
|
||||
|
||||
openLibrary();
|
||||
|
@ -480,7 +481,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
|
|||
|
||||
if (flag & ARM_RESTPOS) {
|
||||
arm->flag &= ~ARM_RESTPOS;
|
||||
BKE_pose_where_is(scene, ob_arm);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob_arm);
|
||||
}
|
||||
|
||||
if (fra.size()) {
|
||||
|
@ -489,7 +490,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
|
|||
|
||||
if (flag & ARM_RESTPOS)
|
||||
arm->flag = flag;
|
||||
BKE_pose_where_is(scene, ob_arm);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob_arm);
|
||||
}
|
||||
|
||||
void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone)
|
||||
|
@ -945,10 +946,10 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
|
|||
if (pchan->flag & POSE_CHAIN) {
|
||||
enable_fcurves(ob->adt->action, NULL);
|
||||
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
|
||||
BKE_pose_where_is(scene, ob);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob);
|
||||
}
|
||||
else {
|
||||
BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
|
||||
BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1);
|
||||
}
|
||||
|
||||
// compute bone local mat
|
||||
|
@ -1438,7 +1439,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
|
|||
// exit rest position
|
||||
if (flag & ARM_RESTPOS) {
|
||||
arm->flag &= ~ARM_RESTPOS;
|
||||
BKE_pose_where_is(scene, ob_arm);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob_arm);
|
||||
}
|
||||
//v array will hold all values which will be exported.
|
||||
if (fra.size()) {
|
||||
|
@ -1468,7 +1469,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
|
|||
// restore restpos
|
||||
if (flag & ARM_RESTPOS)
|
||||
arm->flag = flag;
|
||||
BKE_pose_where_is(scene, ob_arm);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob_arm);
|
||||
}
|
||||
|
||||
void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan)
|
||||
|
@ -1493,7 +1494,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
|
|||
|
||||
|
||||
BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
|
||||
BKE_pose_where_is_bone(scene, ob_arm, pchan, ctime, 1);
|
||||
BKE_pose_where_is_bone(eval_ctx, scene, ob_arm, pchan, ctime, 1);
|
||||
|
||||
// compute bone local mat
|
||||
if (bone->parent) {
|
||||
|
@ -1554,7 +1555,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
|
|||
|
||||
if (obtar) {
|
||||
BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
|
||||
BKE_object_where_is_calc_time(scene, obtar, ctime);
|
||||
BKE_object_where_is_calc_time(eval_ctx, scene, obtar, ctime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1563,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
|
|||
cti->flush_constraint_targets(con, &targets, 1);
|
||||
}
|
||||
}
|
||||
BKE_object_where_is_calc_time(scene, ob, ctime);
|
||||
BKE_object_where_is_calc_time(eval_ctx, scene, ob, ctime);
|
||||
copy_m4_m4(mat, ob->obmat);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,12 +79,13 @@ extern "C"
|
|||
#include <vector>
|
||||
#include <algorithm> // std::find
|
||||
|
||||
|
||||
struct EvaluationContext;
|
||||
|
||||
class AnimationExporter: COLLADASW::LibraryAnimations
|
||||
{
|
||||
private:
|
||||
Scene *scene;
|
||||
struct EvaluationContext *eval_ctx;
|
||||
COLLADASW::StreamWriter *sw;
|
||||
|
||||
public:
|
||||
|
@ -94,7 +95,7 @@ public:
|
|||
{ this->sw = sw; }
|
||||
|
||||
|
||||
bool exportAnimations(Scene *sce);
|
||||
bool exportAnimations(struct EvaluationContext *eval_ctx, Scene *sce);
|
||||
|
||||
// called for each exported object
|
||||
void operator() (Object *ob);
|
||||
|
|
|
@ -104,8 +104,9 @@ bool ControllerExporter::add_instance_controller(Object *ob)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ControllerExporter::export_controllers(Scene *sce)
|
||||
void ControllerExporter::export_controllers(struct EvaluationContext *eval_ctx, Scene *sce)
|
||||
{
|
||||
this->eval_ctx = eval_ctx;
|
||||
scene = sce;
|
||||
|
||||
openLibrary();
|
||||
|
@ -197,7 +198,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
|
|||
bool use_instantiation = this->export_settings->use_object_instantiation;
|
||||
Mesh *me;
|
||||
|
||||
me = bc_get_mesh_copy(scene,
|
||||
me = bc_get_mesh_copy(eval_ctx, scene,
|
||||
ob,
|
||||
this->export_settings->export_mesh_type,
|
||||
this->export_settings->apply_modifiers,
|
||||
|
@ -299,7 +300,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
|
|||
bool use_instantiation = this->export_settings->use_object_instantiation;
|
||||
Mesh *me;
|
||||
|
||||
me = bc_get_mesh_copy(scene,
|
||||
me = bc_get_mesh_copy(eval_ctx, scene,
|
||||
ob,
|
||||
this->export_settings->export_mesh_type,
|
||||
this->export_settings->apply_modifiers,
|
||||
|
@ -494,7 +495,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
|
|||
// put armature in rest position
|
||||
if (!(arm->flag & ARM_RESTPOS)) {
|
||||
arm->flag |= ARM_RESTPOS;
|
||||
BKE_pose_where_is(scene, ob_arm);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob_arm);
|
||||
}
|
||||
|
||||
for (bDeformGroup *def = (bDeformGroup *)defbase->first; def; def = def->next) {
|
||||
|
@ -542,7 +543,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas
|
|||
// back from rest positon
|
||||
if (!(flag & ARM_RESTPOS)) {
|
||||
arm->flag = flag;
|
||||
BKE_pose_where_is(scene, ob_arm);
|
||||
BKE_pose_where_is(eval_ctx, scene, ob_arm);
|
||||
}
|
||||
|
||||
source.finish();
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
#include "BKE_key.h"
|
||||
|
||||
struct EvaluationContext;
|
||||
class SceneExporter;
|
||||
|
||||
class ControllerExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
|
||||
|
@ -65,11 +66,12 @@ public:
|
|||
|
||||
bool add_instance_controller(Object *ob);
|
||||
|
||||
void export_controllers(Scene *sce);
|
||||
void export_controllers(struct EvaluationContext *eval_ctx, Scene *sce);
|
||||
|
||||
void operator()(Object *ob);
|
||||
|
||||
private:
|
||||
struct EvaluationContext *eval_ctx;
|
||||
Scene *scene;
|
||||
UnitConverter converter;
|
||||
const ExportSettings *export_settings;
|
||||
|
|
|
@ -285,19 +285,19 @@ int DocumentExporter::exportCurrentScene(EvaluationContext *eval_ctx, Scene *sce
|
|||
// <library_geometries>
|
||||
if (bc_has_object_type(export_set, OB_MESH)) {
|
||||
GeometryExporter ge(writer, this->export_settings);
|
||||
ge.exportGeom(sce);
|
||||
ge.exportGeom(eval_ctx, sce);
|
||||
}
|
||||
|
||||
// <library_animations>
|
||||
AnimationExporter ae(writer, this->export_settings);
|
||||
bool has_animations = ae.exportAnimations(sce);
|
||||
bool has_animations = ae.exportAnimations(eval_ctx, sce);
|
||||
|
||||
// <library_controllers>
|
||||
ArmatureExporter arm_exporter(writer, this->export_settings);
|
||||
ControllerExporter controller_exporter(writer, this->export_settings);
|
||||
if (bc_has_object_type(export_set, OB_ARMATURE) || this->export_settings->include_shapekeys)
|
||||
{
|
||||
controller_exporter.export_controllers(sce);
|
||||
controller_exporter.export_controllers(eval_ctx, sce);
|
||||
}
|
||||
|
||||
// <library_visual_scenes>
|
||||
|
|
|
@ -57,10 +57,11 @@ GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSett
|
|||
{
|
||||
}
|
||||
|
||||
void GeometryExporter::exportGeom(Scene *sce)
|
||||
void GeometryExporter::exportGeom(struct EvaluationContext *eval_ctx, Scene *sce)
|
||||
{
|
||||
openLibrary();
|
||||
|
||||
mEvalCtx = eval_ctx;
|
||||
mScene = sce;
|
||||
GeometryFunctor gf;
|
||||
gf.forEachMeshObjectInExportSet<GeometryExporter>(sce, *this, this->export_settings->export_set);
|
||||
|
@ -76,7 +77,7 @@ void GeometryExporter::operator()(Object *ob)
|
|||
#endif
|
||||
|
||||
bool use_instantiation = this->export_settings->use_object_instantiation;
|
||||
Mesh *me = bc_get_mesh_copy( mScene,
|
||||
Mesh *me = bc_get_mesh_copy(mEvalCtx, mScene,
|
||||
ob,
|
||||
this->export_settings->export_mesh_type,
|
||||
this->export_settings->apply_modifiers,
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
#include "BKE_key.h"
|
||||
|
||||
struct EvaluationContext;
|
||||
|
||||
extern Object *bc_get_highest_selected_ancestor_or_self(Object *ob);
|
||||
|
||||
class Normal
|
||||
|
@ -72,12 +74,13 @@ class GeometryExporter : COLLADASW::LibraryGeometries
|
|||
|
||||
Normal n;
|
||||
|
||||
struct EvaluationContext *mEvalCtx;
|
||||
Scene *mScene;
|
||||
|
||||
public:
|
||||
GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
|
||||
|
||||
void exportGeom(Scene *sce);
|
||||
void exportGeom(struct EvaluationContext *eval_ctx, Scene *sce);
|
||||
|
||||
void operator()(Object *ob);
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ void SceneExporter::writeNodes(EvaluationContext *eval_ctx, Object *ob, Scene *s
|
|||
for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) {
|
||||
if (bc_is_marked(*i)) {
|
||||
bc_remove_mark(*i);
|
||||
writeNodes(*i, eval_ctx, sce);
|
||||
writeNodes(eval_ctx, *i, sce);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -226,9 +226,6 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
|
|||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
EvaluationContext eval_ctx;
|
||||
|
||||
CTX_data_eval_ctx(C, &eval_ctx);
|
||||
|
||||
ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature);
|
||||
ArmatureModifierData *amd = (ArmatureModifierData *)md;
|
||||
|
@ -250,7 +247,7 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
|
|||
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
|
||||
#endif
|
||||
copy_m4_m4(ob->obmat, bind_shape_matrix);
|
||||
BKE_object_apply_mat4(&eval_ctx, ob, ob->obmat, 0, 0);
|
||||
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
|
||||
|
||||
amd->deformflag = ARM_DEF_VGROUP;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
|
|||
}
|
||||
|
||||
// apply child obmat (i.e. decompose it into rot/loc/size)
|
||||
BKE_object_apply_mat4(&eval_ctx, ob, ob->obmat, 0, 0);
|
||||
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
|
||||
|
||||
// compute parentinv
|
||||
BKE_object_workob_calc_parent(&eval_ctx, sce, ob, &workob);
|
||||
|
@ -147,7 +147,7 @@ Object *bc_add_object(Scene *scene, int type, const char *name)
|
|||
return ob;
|
||||
}
|
||||
|
||||
Mesh *bc_get_mesh_copy(Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate)
|
||||
Mesh *bc_get_mesh_copy(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate)
|
||||
{
|
||||
Mesh *tmpmesh;
|
||||
CustomDataMask mask = CD_MASK_MESH;
|
||||
|
@ -157,12 +157,12 @@ Mesh *bc_get_mesh_copy(Scene *scene, Object *ob, BC_export_mesh_type export_mesh
|
|||
switch (export_mesh_type) {
|
||||
case BC_MESH_TYPE_VIEW:
|
||||
{
|
||||
dm = mesh_create_derived_view(scene, ob, mask);
|
||||
dm = mesh_create_derived_view(eval_ctx, scene, ob, mask);
|
||||
break;
|
||||
}
|
||||
case BC_MESH_TYPE_RENDER:
|
||||
{
|
||||
dm = mesh_create_derived_render(scene, ob, mask);
|
||||
dm = mesh_create_derived_render(eval_ctx, scene, ob, mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,13 +60,15 @@ extern "C" {
|
|||
#include "ExportSettings.h"
|
||||
#include "collada_internal.h"
|
||||
|
||||
struct EvaluationContext;
|
||||
|
||||
typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex *> > TexIndexTextureArrayMap;
|
||||
|
||||
extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index);
|
||||
extern int bc_test_parent_loop(Object *par, Object *ob);
|
||||
extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true);
|
||||
extern Object *bc_add_object(Scene *scene, int type, const char *name);
|
||||
extern Mesh *bc_get_mesh_copy(Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate);
|
||||
extern Mesh *bc_get_mesh_copy(struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate);
|
||||
|
||||
extern Object *bc_get_assigned_armature(Object *ob);
|
||||
extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob);
|
||||
|
|
|
@ -24,6 +24,7 @@ set(INC
|
|||
../../blenlib
|
||||
../../blentranslation
|
||||
../../bmesh
|
||||
../../depsgraph
|
||||
../../makesdna
|
||||
../../makesrna
|
||||
../../windowmanager
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
|
||||
#include "io_collada.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
|
|
Loading…
Reference in New Issue