| 155 | } |
| 156 | |
| 157 | void VisualizerImpl::initializeTools() { |
| 158 | if (tools_initialized_) { |
| 159 | LOG_TRACE("Tools already initialized, skipping"); |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | tool_context_ = std::make_unique<ToolContext>( |
| 164 | rendering_manager_.get(), |
| 165 | scene_manager_.get(), |
| 166 | &viewport_, |
| 167 | window_manager_->getWindow()); |
| 168 | |
| 169 | // Connect tool context to input controller |
| 170 | if (input_controller_) { |
| 171 | input_controller_->setToolContext(tool_context_.get()); |
| 172 | } |
| 173 | |
| 174 | align_tool_ = std::make_shared<tools::AlignTool>(); |
| 175 | if (!align_tool_->initialize(*tool_context_)) { |
| 176 | LOG_ERROR("Failed to initialize align tool"); |
| 177 | align_tool_.reset(); |
| 178 | } else if (input_controller_) { |
| 179 | input_controller_->setAlignTool(align_tool_); |
| 180 | } |
| 181 | |
| 182 | selection_tool_ = std::make_shared<tools::SelectionTool>(); |
| 183 | if (!selection_tool_->initialize(*tool_context_)) { |
| 184 | LOG_ERROR("Failed to initialize selection tool"); |
| 185 | selection_tool_.reset(); |
| 186 | } else if (input_controller_) { |
| 187 | input_controller_->setSelectionTool(selection_tool_); |
| 188 | } |
| 189 | |
| 190 | tools_initialized_ = true; |
| 191 | } |
| 192 | |
| 193 | void VisualizerImpl::setupPythonBridge() { |
| 194 | python::set_visualizer(this); |
nothing calls this directly
no test coverage detected