KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_preview_3d_model.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 2015 Cirilo Bernardo <[email protected]>
6 * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
31#include <tool/tool_manager.h>
35#include <base_units.h>
36#include <bitmaps.h>
37#include <board.h>
39#include <dpi_scaling_common.h>
40#include <lset.h>
41#include <pgm_base.h>
42#include <project_pcb.h>
45#include <widgets/wx_infobar.h>
49
50#ifndef __linux__
52#else
54#endif
55
57 FOOTPRINT* aFootprint,
58 std::vector<FP_3DMODEL>* aParentModelList ) :
60 m_parentFrame( aFrame ),
61 m_previewPane( nullptr ),
62 m_infobar( nullptr ),
66{
67 m_userUnits = m_parentFrame->GetUserUnits();
68
69 m_dummyBoard = new BOARD();
70
71 m_dummyBoard->SetProject( &aFrame->Prj(), true );
72 m_dummyBoard->SetEmbeddedFilesDelegate( aFrame->GetBoard() );
73
74 // This board will only be used to hold a footprint for viewing
75 m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
76
77 BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
78 BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
79 dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
81 BOARD_STACKUP& dummy_board_stackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
82 dummy_board_stackup.RemoveAll();
83 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
84
85 m_selected = -1;
86
87 m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
88
89 // Set the bitmap of 3D view buttons:
96 m_bpvISO->SetBitmap( KiBitmapBundle( BITMAPS::ortho ) );
100
101 // Set the min and max values of spin buttons (mandatory on Linux)
102 // They are not used, so they are set to min and max 32 bits int values
103 // (the min and max values supported by a wxSpinButton)
104 // It avoids blocking the up or down arrows when reaching this limit after
105 // a few clicks.
106 wxSpinButton* spinButtonList[] =
107 {
111 };
112
113 for( wxSpinButton* button : spinButtonList )
114 button->SetRange(INT_MIN, INT_MAX );
115
116 m_parentModelList = aParentModelList;
117
118 m_dummyFootprint = new FOOTPRINT( *aFootprint );
119 m_dummyFootprint->SetParentGroup( nullptr );
120
121 // Ensure the footprint is shown like in Fp editor: rot 0, not flipped
122 // to avoid mistakes when setting the3D shape position/rotation
123 if( m_dummyFootprint->IsFlipped() )
125
126 m_dummyFootprint->SetOrientation( ANGLE_0 );
127
128
130
131 // Create the 3D canvas
132 m_previewPane = new EDA_3D_CANVAS( this,
135 PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
136
137 try
138 {
139#ifndef __linux__
140 m_spaceMouse = std::make_unique<NL_FOOTPRINT_PROPERTIES_PLUGIN>( m_previewPane );
141#else
142 m_spaceMouse = std::make_unique<SPNAV_VIEWER_PLUGIN>( m_previewPane );
143#endif
144 m_spaceMouse->SetFocus( true );
145 }
146 catch( const std::system_error& e )
147 {
148 wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
149 }
150
151 m_boardAdapter.SetBoard( m_dummyBoard );
152 m_boardAdapter.m_IsBoardView = false;
153
154 // Force display 3D models, regardless the 3D viewer options.
155 m_boardAdapter.m_IsPreviewer = true;
156
157 loadSettings();
158
159 // Create the manager
161 m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
162
165 m_previewPane->SetEventDispatcher( m_toolDispatcher );
166
167 // Register tools
168 m_toolManager->RegisterTool( new EDA_3D_CONTROLLER );
169 m_toolManager->InitTools();
170
171 // Run the viewer control tool, it is supposed to be always active
172 m_toolManager->InvokeTool( "3DViewer.Control" );
173
174 m_infobar = new WX_INFOBAR( this );
175 m_previewPane->SetInfoBar( m_infobar );
176
177 m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
178 m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
179
180 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
181 {
182 Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
183 this );
184 }
185
186 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
187 wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
188 nullptr, this );
189
190 Bind( wxCUSTOM_PANEL_SHOWN_EVENT, &PANEL_PREVIEW_3D_MODEL::onPanelShownEvent, this );
191}
192
193
195{
196 // Shutdown all running tools
197 if( m_toolManager )
198 m_toolManager->ShutdownAllTools();
199
200 // Restore the 3D viewer Render settings, that can be modified by the panel tools
201 if( m_boardAdapter.m_Cfg )
202 m_boardAdapter.m_Cfg->m_Render = m_initialRender;
203
204 delete m_dummyBoard;
205 delete m_previewPane;
206}
207
208
209void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
210{
211 if( !m_toolDispatcher )
212 aEvent.Skip();
213 else
214 m_toolDispatcher->DispatchWxEvent( aEvent );
215}
216
217
219{
220 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
221
222 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
223
224 // TODO(JE) use all control options
225 m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
226
228 {
229 // Save the 3D viewer render settings, to restore it after closing the preview
230 m_initialRender = cfg->m_Render;
231
232 m_boardAdapter.m_Cfg = cfg;
233
234 m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
235 m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
236 m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
237 }
238}
239
240
246static double rotationFromString( const wxString& aValue )
247{
249 aValue );
250
251 if( rotation > MAX_ROTATION )
252 {
253 int n = KiROUND( rotation / MAX_ROTATION );
254 rotation -= MAX_ROTATION * n;
255 }
256 else if( rotation < -MAX_ROTATION )
257 {
258 int n = KiROUND( -rotation / MAX_ROTATION );
259 rotation += MAX_ROTATION * n;
260 }
261
262 return rotation;
263}
264
265
267{
268 return wxString::Format( wxT( "%.4f" ),
269 aValue );
270}
271
272
274{
275 // Sigh. Did we really need differentiated +/- 0.0?
276 if( aValue == -0.0 )
277 aValue = 0.0;
278
279 return wxString::Format( wxT( "%.2f%s" ),
280 aValue,
282}
283
284
286{
287 // Convert from internal units (mm) to user units
289 aValue /= 25.4;
290 else if( m_userUnits == EDA_UNITS::MILS )
291 aValue /= 25.4 / 1e3;
292
293 return wxString::Format( wxT( "%.6f%s" ),
294 aValue,
296}
297
298
300{
301 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
302 {
303 m_selected = idx;
304 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
305
306 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
307 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
308 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
309 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
310 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
311
312 // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI
313 // to match the rest of KiCad
314 xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) );
315 yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) );
316 zrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.z ) );
317
318 xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
319 yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
320 zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
321
322 m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
323 }
324 else
325 {
326 m_selected = -1;
327
328 xscale->ChangeValue( wxEmptyString );
329 yscale->ChangeValue( wxEmptyString );
330 zscale->ChangeValue( wxEmptyString );
331
332 xrot->ChangeValue( wxEmptyString );
333 yrot->ChangeValue( wxEmptyString );
334 zrot->ChangeValue( wxEmptyString );
335
336 xoff->ChangeValue( wxEmptyString );
337 yoff->ChangeValue( wxEmptyString );
338 zoff->ChangeValue( wxEmptyString );
339
340 m_opacity->SetValue( 100 );
341 }
342}
343
344
345void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
346{
347 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
348 {
349 // Write settings back to the parent
350 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
351
353 pcbIUScale, EDA_UNITS::UNSCALED, xscale->GetValue() );
355 pcbIUScale, EDA_UNITS::UNSCALED, yscale->GetValue() );
357 pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
358
359 // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI
360 // to match the rest of KiCad
361 modelInfo->m_Rotation.x = -rotationFromString( xrot->GetValue() );
362 modelInfo->m_Rotation.y = -rotationFromString( yrot->GetValue() );
363 modelInfo->m_Rotation.z = -rotationFromString( zrot->GetValue() );
364
366 xoff->GetValue() )
367 / pcbIUScale.IU_PER_MM;
369 yoff->GetValue() )
370 / pcbIUScale.IU_PER_MM;
372 zoff->GetValue() )
373 / pcbIUScale.IU_PER_MM;
374
375 // Update the dummy footprint for the preview
376 UpdateDummyFootprint( false );
377 onModify();
378 }
379}
380
381
382void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
383{
384 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
385 {
386 // Write settings back to the parent
387 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
388
389 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
390
391 // Update the dummy footprint for the preview
392 UpdateDummyFootprint( false );
393 onModify();
394 }
395}
396
397
398void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
399{
400 // turn ON or OFF options to show the board body if OFF, solder paste, soldermask
401 // and board body are hidden, to allows a good view of the 3D model and its pads.
403
404 if( !cfg )
405 return;
406
408
409 m_previewPane->ReloadRequest();
410 m_previewPane->Refresh();
411}
412
413
414void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
415{
416 BOARD_DESIGN_SETTINGS bds = m_dummyBoard->GetDesignSettings();
417 int thickness = bds.GetBoardThickness();
418
419 WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
420 thickness );
421
422 if( dlg.ShowModal() != wxID_OK )
423 return;
424
425 bds.SetBoardThickness( dlg.GetValue() );
426
427 BOARD_STACKUP& boardStackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
428 boardStackup.RemoveAll();
429 boardStackup.BuildDefaultStackupList( &bds, 2 );
430
431 UpdateDummyFootprint( true );
432
433 m_previewPane->ReloadRequest();
434 m_previewPane->Refresh();
435}
436
437
438void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
439{
440 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
441
442 wxCHECK( spinCtrl, /* void */ );
443
444 wxTextCtrl * textCtrl = xscale;
445
446 if( spinCtrl == m_spinYscale )
447 textCtrl = yscale;
448 else if( spinCtrl == m_spinZscale )
449 textCtrl = zscale;
450
451 double step = SCALE_INCREMENT;
452
453 if( wxGetMouseState().ShiftDown( ) )
455
457 textCtrl->GetValue() );
458
459 curr_value += ( step * aSign );
460 curr_value = std::max( 1/MAX_SCALE, curr_value );
461 curr_value = std::min( curr_value, MAX_SCALE );
462
463 textCtrl->SetValue( formatScaleValue( curr_value ) );
464}
465
466
467void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
468{
469 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( aEvent.GetEventObject() );
470
471 wxCHECK( spinCtrl, /* void */ );
472
473 wxTextCtrl* textCtrl = xrot;
474
475 if( spinCtrl == m_spinYrot )
476 textCtrl = yrot;
477 else if( spinCtrl == m_spinZrot )
478 textCtrl = zrot;
479
480 double step = ROTATION_INCREMENT;
481
482 if( wxGetMouseState().ShiftDown( ) )
484
486 textCtrl->GetValue() );
487
488 curr_value += ( step * aSign );
489 curr_value = std::max( -MAX_ROTATION, curr_value );
490 curr_value = std::min( curr_value, MAX_ROTATION );
491
492 textCtrl->SetValue( formatRotationValue( curr_value ) );
493}
494
495
496void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
497{
498 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
499
500 wxCHECK( spinCtrl, /* void */ );
501
502 wxTextCtrl * textCtrl = xoff;
503
504 if( spinCtrl == m_spinYoffset )
505 textCtrl = yoff;
506 else if( spinCtrl == m_spinZoffset )
507 textCtrl = zoff;
508
509 double step_mm = OFFSET_INCREMENT_MM;
510
511 if( wxGetMouseState().ShiftDown( ) )
512 step_mm = OFFSET_INCREMENT_MM_FINE;
513
515 {
516 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
517
518 if( wxGetMouseState().ShiftDown( ) )
519 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000;;
520 }
521
523 textCtrl->GetValue() )
524 / pcbIUScale.IU_PER_MM;
525
526 curr_value_mm += ( step_mm * aSign );
527 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
528 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
529
530 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
531}
532
533
535{
536 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
537
538 wxCHECK( textCtrl, /* void */ );
539
540 double step = SCALE_INCREMENT;
541
542 if( event.ShiftDown( ) )
544
545 if( event.GetWheelRotation() >= 0 )
546 step = -step;
547
549 textCtrl->GetValue() );
550
551 curr_value += step;
552 curr_value = std::max( 1/MAX_SCALE, curr_value );
553 curr_value = std::min( curr_value, MAX_SCALE );
554
555 textCtrl->SetValue( formatScaleValue( curr_value ) );
556}
557
558
560{
561 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
562
563 wxCHECK( textCtrl, /* void */ );
564
565 double step = ROTATION_INCREMENT;
566
567 if( event.ShiftDown( ) )
569
570 if( event.GetWheelRotation() >= 0 )
571 step = -step;
572
574 textCtrl->GetValue() );
575
576 curr_value += step;
577 curr_value = std::max( -MAX_ROTATION, curr_value );
578 curr_value = std::min( curr_value, MAX_ROTATION );
579
580 textCtrl->SetValue( formatRotationValue( curr_value ) );
581}
582
583
585{
586 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
587
588 wxCHECK( textCtrl, /* void */ );
589
590 double step_mm = OFFSET_INCREMENT_MM;
591
592 if( event.ShiftDown( ) )
593 step_mm = OFFSET_INCREMENT_MM_FINE;
594
596 {
597 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
598
599 if( event.ShiftDown( ) )
600 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
601 }
602
603 if( event.GetWheelRotation() >= 0 )
604 step_mm = -step_mm;
605
607 textCtrl->GetValue() )
608 / pcbIUScale.IU_PER_MM;
609
610 curr_value_mm += step_mm;
611 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
612 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
613
614 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
615}
616
617
618void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
619{
621 xoff->GetValue() )
622 / pcbIUScale.IU_PER_MM;
624 yoff->GetValue() )
625 / pcbIUScale.IU_PER_MM;
627 zoff->GetValue() )
628 / pcbIUScale.IU_PER_MM;
629
630 PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
631 m_userUnits = frame->GetUserUnits();
632
633 xoff->SetValue( formatOffsetValue( xoff_mm ) );
634 yoff->SetValue( formatOffsetValue( yoff_mm ) );
635 zoff->SetValue( formatOffsetValue( zoff_mm ) );
636
637 aEvent.Skip();
638}
639
640
641void PANEL_PREVIEW_3D_MODEL::onPanelShownEvent( wxCommandEvent& aEvent )
642{
643 if( m_spaceMouse )
644 {
645 m_spaceMouse->SetFocus( static_cast<bool>( aEvent.GetInt() ) );
646 }
647
648 aEvent.Skip();
649}
650
651
653{
654 m_dummyFootprint->Models().clear();
655
657 {
658 if( model.m_Show )
659 m_dummyFootprint->Models().push_back( model );
660 }
661
662 if( aReloadRequired )
663 m_previewPane->ReloadRequest();
664
665 m_previewPane->Request_refresh();
666}
667
668
670{
671 m_dummyBoard->SetEmbeddedFilesDelegate( aDelegate );
672}
673
674
676{
677 KIWAY_HOLDER* kiwayHolder = dynamic_cast<KIWAY_HOLDER*>( wxGetTopLevelParent( this ) );
678
679 if( kiwayHolder && kiwayHolder->GetType() == KIWAY_HOLDER::DIALOG )
680 static_cast<DIALOG_SHIM*>( kiwayHolder )->OnModify();
681}
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:112
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:115
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
@ show_board_body
@ options_3drender
@ FPHOLDER
Definition board.h:314
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:990
Container for design settings for a BOARD object.
void SetEnabledLayers(const LSET &aMask)
Change the bit-mask of enabled layers to aMask.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
void SetBoardThickness(int aThickness)
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition dialog_shim.h:68
int ShowModal() override
EDA_3D_ACTIONS.
Implement a canvas based on a wxGLCanvas.
Handle view actions for various 3D canvases.
VECTOR3D m_Offset
3D model offset (mm)
Definition footprint.h:119
double m_Opacity
Definition footprint.h:120
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition footprint.h:118
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition footprint.h:117
A mix in class which holds the location of a wxWindow's KIWAY.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
HOLDER_TYPE GetType() const
static const LSET & FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition lset.cpp:705
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition lset.cpp:712
static const wxGLAttributes GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode, bool aAlpha=false)
Get a list of attributes to pass to wxGLCanvas.
PANEL_PREVIEW_3D_MODEL_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxString formatOffsetValue(double aValue)
void onMouseWheelRot(wxMouseEvent &event) override
void View3DSettings(wxCommandEvent &event) override
void onOpacitySlider(wxCommandEvent &event) override
void setBodyStyleView(wxCommandEvent &event) override
void onMouseWheelScale(wxMouseEvent &event) override
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender
The 3d viewer Render initial settings (must be saved and restored)
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
wxString formatScaleValue(double aValue)
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)
void loadSettings()
Load 3D relevant settings from the user configuration.
void OnMenuEvent(wxMenuEvent &aEvent)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
void onUnitsChanged(wxCommandEvent &aEvent)
void doIncrementOffset(wxSpinEvent &aEvent, double aSign)
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
void doIncrementScale(wxSpinEvent &aEvent, double aSign)
void updateOrientation(wxCommandEvent &event) override
It will receive the events from editing the fields.
wxString formatRotationValue(double aValue)
void onMouseWheelOffset(wxMouseEvent &event) override
std::unique_ptr< NL_FOOTPRINT_PROPERTIES_PLUGIN > m_spaceMouse
void onPanelShownEvent(wxCommandEvent &aEvent)
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
std::vector< FP_3DMODEL > * m_parentModelList
EDA_UNITS m_userUnits
Index into m_parentInfoList.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:537
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
ACTIONS * m_actions
Master controller class:
EDA_UNITS GetUserUnits() const
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:76
An extension of WX_TEXT_ENTRY_DIALOG that uses UNIT_BINDER to request a dimension (e....
int GetValue()
Return the value in internal units.
#define _(s)
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
Definition mirror.h:29
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue to a double.
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
declaration of the nl_footprint_properties_plugin class
Declaration of the cogl_att_list class.
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.
#define MAX_SCALE
#define MAX_ROTATION
#define MAX_OFFSET
#define OFFSET_INCREMENT_MM_FINE
#define OFFSET_INCREMENT_MIL
#define SCALE_INCREMENT
#define ROTATION_INCREMENT_FINE
#define OFFSET_INCREMENT_MM
#define ROTATION_INCREMENT
#define OFFSET_INCREMENT_MIL_FINE
#define SCALE_INCREMENT_FINE
#define PANEL_PREVIEW_3D_MODEL_ID
PGM_BASE & Pgm()
The global program "get" accessor.
Definition pgm_base.cpp:946
see class PGM_BASE
T * GetAppSettings(const char *aFilename)
KIBIS_MODEL * model