File tree Expand file tree Collapse file tree 3 files changed +47
-6
lines changed
Expand file tree Collapse file tree 3 files changed +47
-6
lines changed Original file line number Diff line number Diff line change 66#ifndef slic3r_GUI_App_hpp_
77#define slic3r_GUI_App_hpp_
88
9- #include < angelscript/include/angelscript.h>
10- #include < angelscript/add_on/scriptbuilder/scriptbuilder.h>
119#include < memory>
1210#include < string>
1311#include " ImGuiWrapper.hpp"
@@ -171,8 +169,6 @@ class GUI_App : public wxApp
171169
172170 OpenGLManager m_opengl_mgr;
173171
174- // AngelScript::PtrRelease<AngelScript::asIScriptEngine> m_script_engine;
175-
176172 std::unique_ptr<RemovableDriveManager> m_removable_drive_manager;
177173
178174 std::unique_ptr<ImGuiWrapper> m_imgui;
@@ -196,8 +192,6 @@ class GUI_App : public wxApp
196192 bool is_recreating_gui () const { return m_is_recreating_gui; }
197193 std::string logo_name () const { return is_editor () ? SLIC3R_APP_KEY : GCODEVIEWER_APP_KEY; }
198194
199- // AngelScript::asIScriptEngine* get_script_engine() const { return m_script_engine.get(); }
200-
201195 // To be called after the GUI is fully built up.
202196 // Process command line parameters cached in this->init_params,
203197 // load configs, STLs etc.
Original file line number Diff line number Diff line change 1+ // /|/ Copyright (c) SuperSlicer 2023-2025 Remi Durand @supermerill
2+ // /|/
3+ // /|/ SuperSlicer is released under the terms of the AGPLv3 or higher
4+ // /|/
15#include " ScriptExecutor.hpp"
26
37#include " libslic3r/PresetBundle.hpp"
Original file line number Diff line number Diff line change 1+ // /|/ Copyright (c) SuperSlicer 2023-2025 Remi Durand @supermerill
2+ // /|/
3+ // /|/ SuperSlicer is released under the terms of the AGPLv3 or higher
4+ // /|/
15#ifndef slic3r_ScriptExecutor_hpp_
26#define slic3r_ScriptExecutor_hpp_
37
610
711#include < angelscript/include/angelscript.h>
812#include < angelscript/add_on/scriptbuilder/scriptbuilder.h>
13+ namespace AngelScript {
14+
15+ template <class T >
16+ class PtrRelease
17+ {
18+ private:
19+ T* ptr = nullptr ;
20+ public:
21+ PtrRelease () {}
22+ PtrRelease (const PtrRelease&) = delete ;
23+ PtrRelease& operator =(PtrRelease const &) = delete ;
24+ ~PtrRelease () { if (nullptr != ptr) ptr->Release (); }
25+
26+ // / @brief this reset release its ownership and re-acquire another one
27+ void reset (T* p) noexcept
28+ {
29+ assert ((nullptr == p) || (ptr != p)); // auto-reset not allowed
30+ if (nullptr != ptr) ptr->Release ();
31+ ptr = p;
32+ }
33+ // underlying pointer operations :
34+ inline T& operator *() const noexcept
35+ {
36+ assert (nullptr != ptr);
37+ return *ptr;
38+ }
39+ inline T* operator ->() const noexcept
40+ {
41+ assert (nullptr != ptr);
42+ return ptr;
43+ }
44+ inline T* get () const noexcept
45+ {
46+ // no assert, can return nullptr
47+ return ptr;
48+ }
49+ };
50+
51+ } // namespace AngelScript
952
1053namespace Slic3r { namespace GUI {
1154
You can’t perform that action at this time.
0 commit comments