Skip to content

Commit 41d8d30

Browse files
committed
address comments and remove SetRenderRequestCallback
1 parent 453a5dc commit 41d8d30

File tree

14 files changed

+22
-107
lines changed

14 files changed

+22
-107
lines changed

library/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set(F3D_VTK_MODULES
66
VTK::CommonColor
77
VTK::IOImage
88
VTK::InteractionWidgets
9-
f3d::vtkext
109
)
1110

1211
# Check modules
@@ -151,7 +150,7 @@ target_include_directories(libf3d
151150
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
152151
)
153152

154-
vtk_module_autoinit(TARGETS libf3d MODULES ${F3D_VTK_MODULES} f3d::vtkextPrivate)
153+
vtk_module_autoinit(TARGETS libf3d MODULES ${F3D_VTK_MODULES})
155154

156155
# The initialize function pointer of the static plugins must be added to the map of static plugins
157156
# in the factory constructor. When loading a plugin, there's a lookup into this map.
@@ -174,7 +173,7 @@ list(TRANSFORM F3D_STATIC_PLUGIN_TARGETS PREPEND "f3d-plugin-")
174173

175174
target_link_libraries(libf3d
176175
PUBLIC ${F3D_VTK_MODULES}
177-
PRIVATE f3d::vtkextPrivate ${F3D_STATIC_PLUGIN_TARGETS})
176+
PRIVATE f3d::vtkext f3d::vtkextPrivate ${F3D_STATIC_PLUGIN_TARGETS})
178177

179178
target_compile_options(libf3d PUBLIC ${f3d_compile_options_public} PRIVATE ${f3d_compile_options_private})
180179
target_link_options(libf3d PUBLIC ${f3d_link_options_public})

library/private/scene_impl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include "log.h"
1313
#include "scene.h"
1414

15-
#include "F3DNodeInfo.h"
16-
1715
#include <memory>
1816

1917
namespace f3d

library/public/scene.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <vector>
1313
/// @endcond
1414

15+
#include "F3DNodeInfo.h"
16+
1517
namespace f3d
1618
{
1719
/**

library/src/scene_impl.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ scene& scene_impl::add(std::byte* buffer, std::size_t size)
362362
}
363363

364364
log::debug("\nLoading stream");
365-
this->Internals->Load({ importer });
365+
this->Internals->Load({ importer }, this);
366366
return *this;
367367
}
368368

library/src/window_impl.cxx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -760,16 +760,6 @@ void window_impl::SetCachePath(const fs::path& cachePath)
760760
void window_impl::SetInteractor(interactor_impl* interactor)
761761
{
762762
this->Internals->Interactor = interactor;
763-
764-
// Set up render request callback on the UI actor
765-
// This allows the UI to safely request renders from within the render loop
766-
if (interactor)
767-
{
768-
this->Internals->Renderer->SetRenderRequestCallback([interactor]()
769-
{
770-
interactor->requestRender();
771-
});
772-
}
773763
}
774764

775765
//----------------------------------------------------------------------------

vtkext/private/module/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ vtk_module_add_module(f3d::vtkextPrivate
138138
PRIVATE_HEADERS ${private_headers}
139139
)
140140

141+
vtk_module_include(f3d::vtkextPrivate
142+
PUBLIC
143+
"${F3D_SOURCE_DIR}/library/public")
144+
141145
if(MSVC)
142146
vtk_module_definitions(f3d::vtkextPrivate PRIVATE _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS _CRT_SECURE_NO_WARNINGS)
143147
endif()

vtkext/private/module/vtkF3DImguiActor.cxx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include "vtkF3DImguiVS.h"
99

1010
#include <vtkImageData.h>
11-
#include <vtkInformation.h>
12-
#include <vtkInformationIntegerKey.h>
1311
#include <vtkObjectFactory.h>
1412
#include <vtkOpenGLBufferObject.h>
1513
#include <vtkOpenGLRenderWindow.h>
@@ -45,8 +43,6 @@
4543
#include <sstream>
4644
#include <string>
4745

48-
vtkInformationKeyMacro(vtkF3DImguiActor, USER_VISIBILITY, Integer);
49-
5046
namespace
5147
{
5248
constexpr float LOGO_DISPLAY_WIDTH = 256.f;
@@ -419,19 +415,6 @@ void vtkF3DImguiActor::RenderNode(NodeInfo* node)
419415
NodeVisibilityState[node->prop] = visible;
420416
node->prop->SetVisibility(visible ? 1 : 0);
421417
node->prop->Modified();
422-
423-
// Mark this prop as user-controlled
424-
vtkInformation* info = node->prop->GetPropertyKeys();
425-
if (!info)
426-
{
427-
info = vtkInformation::New();
428-
node->prop->SetPropertyKeys(info);
429-
info->Delete();
430-
}
431-
info->Set(vtkF3DImguiActor::USER_VISIBILITY(), visible ? 1 : 0);
432-
433-
// Request a render to update the scene
434-
this->VisibilityChangedThisFrame = true;
435418
}
436419

437420
ImGui::PopID();
@@ -1005,9 +988,6 @@ void vtkF3DImguiActor::StartFrame(vtkOpenGLRenderWindow* renWin)
1005988
io.DisplaySize = ImVec2(static_cast<float>(size[0]), static_cast<float>(size[1]));
1006989

1007990
this->Pimpl->Initialize(renWin);
1008-
1009-
// Reset the visibility change flag at the start of each frame
1010-
this->VisibilityChangedThisFrame = false;
1011991

1012992
ImGui::NewFrame();
1013993
}
@@ -1017,12 +997,6 @@ void vtkF3DImguiActor::EndFrame(vtkOpenGLRenderWindow* renWin)
1017997
{
1018998
ImGui::Render();
1019999
this->Pimpl->RenderDrawData(renWin, ImGui::GetDrawData());
1020-
1021-
// If visibility changed, request a render to update the scene
1022-
if (this->VisibilityChangedThisFrame && this->RenderRequestCallback)
1023-
{
1024-
this->RenderRequestCallback();
1025-
}
10261000
}
10271001

10281002

vtkext/private/module/vtkF3DImguiActor.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@
1616
class vtkOpenGLRenderWindow;
1717
class vtkWindow;
1818

19-
class vtkInformationIntegerKey;
20-
2119
class vtkF3DImguiActor : public vtkF3DUIActor
2220
{
2321
public:
2422
static vtkF3DImguiActor* New();
2523
vtkTypeMacro(vtkF3DImguiActor, vtkF3DUIActor);
26-
27-
// Information key to track user-controlled visibility
28-
static vtkInformationIntegerKey* USER_VISIBILITY();
2924

3025
/**
3126
* Initialize the UI actor resources
@@ -53,9 +48,6 @@ class vtkF3DImguiActor : public vtkF3DUIActor
5348
// Track visibility state for each node
5449
std::unordered_map<vtkProp*, bool> NodeVisibilityState;
5550

56-
// Flag to trigger render when visibility changes
57-
bool VisibilityChangedThisFrame = false;
58-
5951
/**
6052
* Called at the beginning of the rendering step
6153
* Initialize the imgui context if needed and setup a new frame

vtkext/private/module/vtkF3DMetaImporter.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,15 +719,15 @@ std::vector<NodeInfo> vtkF3DMetaImporter::GetActorHierarchy()
719719
{
720720
std::vector<NodeInfo> nodes;
721721

722-
// Get scene hierarchy for GLTF files (where names are stored)
722+
// Get scene hierarchy from importers that support it
723723
vtkDataAssembly* hierarchy = this->GetSceneHierarchy();
724724
std::map<int, std::string> actorIndexNameMap;
725725

726-
// If we have a scene hierarchy (GLTF file), extract names from it
726+
// If we have a scene hierarchy, extract names from it
727727
if (hierarchy)
728728
{
729729
// Build a map of actor indices to their names from the hierarchy
730-
// Since GLTF doesn't store explicit actor_id attributes, we map leaf mesh nodes sequentially
730+
// Map leaf mesh nodes sequentially to actor indices
731731
int meshCounter = 0;
732732
std::function<void(int)> traverseHierarchy = [&](int nodeId) {
733733
const char* nodeName = hierarchy->GetNodeName(nodeId);
@@ -770,10 +770,10 @@ std::vector<NodeInfo> vtkF3DMetaImporter::GetActorHierarchy()
770770
node.prop = actor;
771771

772772
// Try to get a meaningful name for the actor
773-
// Priority: DataAssembly (GLTF hierarchy) > Actor ObjectName > Mapper input name > Generic
773+
// Priority: DataAssembly hierarchy > Actor ObjectName > Mapper input name > Generic
774774
std::string actorName;
775775

776-
// First, check if we have a name from the GLTF scene hierarchy
776+
// First, check if we have a name from the scene hierarchy
777777
auto it = actorIndexNameMap.find(actorIndex);
778778
if (it != actorIndexNameMap.end())
779779
{

0 commit comments

Comments
 (0)