File tree Expand file tree Collapse file tree 8 files changed +30
-48
lines changed
Expand file tree Collapse file tree 8 files changed +30
-48
lines changed Original file line number Diff line number Diff line change @@ -1900,8 +1900,6 @@ void F3DStarter::LoadFileGroupInternal(
19001900 options.ui .drop_zone .enable = options.ui .drop_zone .show_logo =
19011901 this ->Internals ->LoadedFiles .empty ();
19021902 options.ui .filename_info = filenameInfo;
1903- auto hierarchy = scene.GetSceneHierarchyNodes (); // changed to NodeInfo vector
1904- this ->Internals ->Engine ->getWindow ().SetSceneHierarchy (hierarchy);
19051903}
19061904
19071905// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ set(F3D_VTK_MODULES
77 VTK::IOImage
88 VTK::InteractionWidgets
99 f3d::vtkext
10- f3d::vtkextPrivate
1110)
1211
1312# Check modules
@@ -152,7 +151,7 @@ target_include_directories(libf3d
152151 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
153152 )
154153
155- vtk_module_autoinit(TARGETS libf3d MODULES ${F3D_VTK_MODULES} )
154+ vtk_module_autoinit(TARGETS libf3d MODULES ${F3D_VTK_MODULES} f3d::vtkextPrivate )
156155
157156# The initialize function pointer of the static plugins must be added to the map of static plugins
158157# in the factory constructor. When loading a plugin, there's a lookup into this map.
@@ -173,19 +172,9 @@ configure_file(
173172# libf3d links with the static plugins.
174173list (TRANSFORM F3D_STATIC_PLUGIN_TARGETS PREPEND "f3d-plugin-" )
175174
176- # target_link_libraries(libf3d PRIVATE ${F3D_VTK_MODULES} ${F3D_STATIC_PLUGIN_TARGETS})
177175target_link_libraries (libf3d
178- PUBLIC
179- VTK::CommonSystem
180- VTK::CommonColor
181- VTK::IOImage
182- VTK::InteractionWidgets
183- f3d::vtkext
184- PRIVATE
185- f3d::vtkextPrivate
186- ${F3D_STATIC_PLUGIN_TARGETS}
187- )
188-
176+ PUBLIC ${F3D_VTK_MODULES}
177+ PRIVATE f3d::vtkextPrivate ${F3D_STATIC_PLUGIN_TARGETS} )
189178
190179target_compile_options (libf3d PUBLIC ${f3d_compile_options_public} PRIVATE ${f3d_compile_options_private} )
191180target_link_options (libf3d PUBLIC ${f3d_link_options_public} )
Original file line number Diff line number Diff line change 1212#include " log.h"
1313#include " scene.h"
1414
15+ #include " F3DNodeInfo.h"
16+
1517#include < memory>
1618
1719namespace f3d
@@ -62,15 +64,15 @@ class scene_impl : public scene
6264 */
6365 void PrintImporterDescription (log::VerboseLevel level);
6466
67+ /* *
68+ * Get scene hierarchy nodes for display and control.
69+ * This is used internally to update the window.
70+ */
71+ std::vector<NodeInfo> GetSceneHierarchyNodes ();
72+
6573private:
6674 class internals ;
6775 std::unique_ptr<internals> Internals;
68-
69- public:
70- /* *
71- * Get scene hierarchy nodes for display and control
72- */
73- std::vector<NodeInfo> GetSceneHierarchyNodes () override ;
7476};
7577}
7678}
Original file line number Diff line number Diff line change 1515#include " log.h"
1616#include " window.h"
1717
18+ #include " F3DNodeInfo.h"
19+
1820#include < filesystem>
1921#include < memory>
2022#include < optional>
@@ -59,10 +61,16 @@ class window_impl : public window
5961 window& setWindowName (std::string_view windowName) override ;
6062 point3_t getWorldFromDisplay (const point3_t & displayPoint) const override ;
6163 point3_t getDisplayFromWorld (const point3_t & worldPoint) const override ;
62- void SetSceneHierarchy (const std::vector<NodeInfo>& hierarchy) override ;
6364
6465 // /@}
6566
67+ /* *
68+ * Implementation only API.
69+ * Set the scene hierarchy for display in UI.
70+ * This is called internally by the scene when content changes.
71+ */
72+ void SetSceneHierarchy (const std::vector<NodeInfo>& hierarchy);
73+
6674 /* *
6775 * Implementation only API.
6876 * Initialize the renderer by clearing it of all actors.
Original file line number Diff line number Diff line change 1212#include < vector>
1313// / @endcond
1414
15- #include " F3DNodeInfo.h"
16-
1715namespace f3d
1816{
1917/* *
@@ -186,17 +184,6 @@ class F3D_EXPORT scene
186184 */
187185 [[nodiscard]] virtual std::vector<std::string> getAnimationNames () = 0;
188186
189- protected:
190- // ! @cond
191- scene () = default ;
192- // virtual ~scene() = default;
193- scene (const scene& opt) = delete ;
194- scene (scene&& opt) = delete ;
195- scene& operator =(const scene& opt) = delete ;
196- scene& operator =(scene&& opt) = delete ;
197- // ! @endcond
198-
199- public:
200187 /* *
201188 * Get the scene hierarchy nodes for display and control.
202189 * Returns a vector of NodeInfo structures representing the actors in the scene.
Original file line number Diff line number Diff line change 88// / @cond
99#include < string>
1010// / @endcond
11- #include " F3DNodeInfo.h"
12-
13- #include < string>
14- #include < vector>
1511
1612namespace f3d
1713{
@@ -123,11 +119,6 @@ class F3D_EXPORT window
123119 */
124120 [[nodiscard]] virtual point3_t getDisplayFromWorld (const point3_t & worldPoint) const = 0;
125121
126- /* *
127- * Set the scene hierarchy for display in UI
128- */
129- virtual void SetSceneHierarchy (const std::vector<NodeInfo>& hierarchy) = 0;
130-
131122protected:
132123 // ! @cond
133124 window () = default ;
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class scene_impl::internals
9191 data->timer ->StartTimer ();
9292 }
9393
94- void Load (const std::vector<vtkSmartPointer<vtkImporter>>& importers)
94+ void Load (const std::vector<vtkSmartPointer<vtkImporter>>& importers, scene_impl* sceneImpl )
9595 {
9696 for (const vtkSmartPointer<vtkImporter>& importer : importers)
9797 {
@@ -165,6 +165,13 @@ class scene_impl::internals
165165 }
166166
167167 scene_impl::internals::DisplayAllInfo (this ->MetaImporter , this ->Window );
168+
169+ // Update the scene hierarchy in the window automatically
170+ if (sceneImpl)
171+ {
172+ auto hierarchy = sceneImpl->GetSceneHierarchyNodes ();
173+ this ->Window .SetSceneHierarchy (hierarchy);
174+ }
168175 }
169176
170177 static void DisplayImporterDescription (log::VerboseLevel level, vtkImporter* importer)
@@ -305,7 +312,7 @@ scene& scene_impl::add(const std::vector<fs::path>& filePaths)
305312 }
306313 log::debug (" " );
307314
308- this ->Internals ->Load (importers);
315+ this ->Internals ->Load (importers, this );
309316 return *this ;
310317}
311318
@@ -379,7 +386,7 @@ scene& scene_impl::add(const mesh_t& mesh)
379386 importer->SetInternalReader (vtkSource);
380387
381388 log::debug (" Loading 3D scene from memory" );
382- this ->Internals ->Load ({ importer });
389+ this ->Internals ->Load ({ importer }, this );
383390 return *this ;
384391}
385392
File renamed without changes.
You can’t perform that action at this time.
0 commit comments