/* ----------------------------------------------------------------------------- GSFramework Copyright 2001-2013 Emmanuel Julien. All Rights Reserved. ----------------------------------------------------------------------------- */ #include "project/project.h" #include "scene3d/scene.h" #include "ui/ui.h" #include "script/script_engine_types.h" #include "script/script_variant.h" using namespace GS::Core; //------------------------------------------------------------------------------ void Project::Activate(ProjectSceneInstance &inst, bool activate) { // Callback to project. if (script_unit->SetupFunctionCall("OnActivateScene")) { script_unit->PushFunctionCallArgument(Script::Variant(&inst, Script::typetag_ProjectScene)); script_unit->DoFunctionCall(); } // Set flag. inst.active = activate; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ GS::String ProjectSceneInstance::GetPath() const { if (instance) switch (GetType()) { case Type_Scene2d: return instance_2d->name; break; case Type_Scene3d: return instance_3d->name; break; } return "Empty"; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void ProjectSceneInstance::Free() { if (instance_2d) { instance_2d->SetAsScriptGlobalScene(); _safe_delete(instance_2d); } if (instance_3d) { instance_3d->SetAsScriptGlobalScene(); _safe_delete(instance_3d); } } ProjectSceneInstance::~ProjectSceneInstance() { Free(); } //------------------------------------------------------------------------------