collada: EvaluationContext is now feeded into the class instances of AnimationExporter and DocumentExporter on creation. Also skipped the const qualifier for now because BKE_scene_graph_update_for_newframe() needs it to be not const
This commit is contained in:
parent
d937d06c02
commit
e73fe77ac0
|
@ -34,7 +34,7 @@ void forEachObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
|
|||
}
|
||||
}
|
||||
|
||||
bool AnimationExporter::exportAnimations(EvaluationContext *eval_ctx, Scene *sce)
|
||||
bool AnimationExporter::exportAnimations(Scene *sce)
|
||||
{
|
||||
bool has_animations = hasAnimations(sce);
|
||||
if (has_animations) {
|
||||
|
|
|
@ -90,15 +90,15 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
AnimationExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings):
|
||||
AnimationExporter(EvaluationContext *eval_ctx, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings):
|
||||
eval_ctx(eval_ctx),
|
||||
COLLADASW::LibraryAnimations(sw),
|
||||
export_settings(export_settings)
|
||||
{
|
||||
this->sw = sw;
|
||||
}
|
||||
|
||||
bool exportAnimations(EvaluationContext *eval_ctx, Scene *sce);
|
||||
|
||||
bool exportAnimations(Scene *sce);
|
||||
// called for each exported object
|
||||
void operator() (Object *ob);
|
||||
|
||||
|
|
|
@ -152,7 +152,9 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
|
|||
return data->layers[layer_index].name;
|
||||
}
|
||||
|
||||
DocumentExporter::DocumentExporter(const ExportSettings *export_settings) : export_settings(export_settings) {
|
||||
DocumentExporter::DocumentExporter(EvaluationContext *eval_ctx, const ExportSettings *export_settings) :
|
||||
eval_ctx(eval_ctx),
|
||||
export_settings(export_settings) {
|
||||
}
|
||||
|
||||
static COLLADABU::NativeString make_temp_filepath(const char *name, const char *extension)
|
||||
|
@ -179,7 +181,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char *
|
|||
// COLLADA allows this through multiple <channel>s in <animation>.
|
||||
// For this to work, we need to know objects that use a certain action.
|
||||
|
||||
int DocumentExporter::exportCurrentScene(EvaluationContext *eval_ctx, Scene *sce)
|
||||
int DocumentExporter::exportCurrentScene(Scene *sce)
|
||||
{
|
||||
PointerRNA sceneptr, unit_settings;
|
||||
PropertyRNA *system; /* unused , *scale; */
|
||||
|
@ -302,8 +304,8 @@ int DocumentExporter::exportCurrentScene(EvaluationContext *eval_ctx, Scene *sce
|
|||
|
||||
if (this->export_settings->include_animations) {
|
||||
// <library_animations>
|
||||
AnimationExporter ae(writer, this->export_settings);
|
||||
ae.exportAnimations(eval_ctx, sce);
|
||||
AnimationExporter ae(eval_ctx, writer, this->export_settings);
|
||||
ae.exportAnimations(sce);
|
||||
}
|
||||
se.exportScene(eval_ctx, sce);
|
||||
|
||||
|
|
|
@ -38,11 +38,12 @@ struct Scene;
|
|||
class DocumentExporter
|
||||
{
|
||||
public:
|
||||
DocumentExporter(const ExportSettings *export_settings);
|
||||
int exportCurrentScene(EvaluationContext *eval_ctx, Scene *sce);
|
||||
DocumentExporter(EvaluationContext *eval_ctx, const ExportSettings *export_settings);
|
||||
int exportCurrentScene(Scene *sce);
|
||||
void exportScenes(const char *filename);
|
||||
private:
|
||||
const ExportSettings *export_settings;
|
||||
EvaluationContext *eval_ctx;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -149,8 +149,8 @@ int collada_export(
|
|||
bc_bubble_sort_by_Object_name(export_settings.export_set);
|
||||
}
|
||||
|
||||
DocumentExporter exporter(&export_settings);
|
||||
int status = exporter.exportCurrentScene(eval_ctx, sce);
|
||||
DocumentExporter exporter(eval_ctx, &export_settings);
|
||||
int status = exporter.exportCurrentScene(sce);
|
||||
|
||||
BLI_linklist_free(export_settings.export_set, NULL);
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ void bc_update_scene(EvaluationContext *eval_ctx, Scene *scene, float ctime)
|
|||
{
|
||||
BKE_scene_frame_set(scene, ctime);
|
||||
Main *bmain = bc_get_main();
|
||||
EvaluationContext *ev_context = bc_get_evaluation_context();
|
||||
BKE_scene_graph_update_for_newframe(eval_ctx, eval_ctx->depsgraph, bmain, scene, eval_ctx->view_layer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue