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 // Restore the 3D viewer Render settings, that can be modified by the panel tools
197 if( m_boardAdapter.m_Cfg )
198 m_boardAdapter.m_Cfg->m_Render = m_initialRender;
199
200 delete m_dummyBoard;
201 delete m_previewPane;
202}
203
204
205void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
206{
207 if( !m_toolDispatcher )
208 aEvent.Skip();
209 else
210 m_toolDispatcher->DispatchWxEvent( aEvent );
211}
212
213
215{
216 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
217
218 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
219
220 // TODO(JE) use all control options
221 m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
222
224 {
225 // Save the 3D viewer render settings, to restore it after closing the preview
226 m_initialRender = cfg->m_Render;
227
228 m_boardAdapter.m_Cfg = cfg;
229
230 m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
231 m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
232 m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
233 }
234}
235
236
242static double rotationFromString( const wxString& aValue )
243{
245 aValue );
246
247 if( rotation > MAX_ROTATION )
248 {
249 int n = KiROUND( rotation / MAX_ROTATION );
250 rotation -= MAX_ROTATION * n;
251 }
252 else if( rotation < -MAX_ROTATION )
253 {
254 int n = KiROUND( -rotation / MAX_ROTATION );
255 rotation += MAX_ROTATION * n;
256 }
257
258 return rotation;
259}
260
261
263{
264 return wxString::Format( wxT( "%.4f" ),
265 aValue );
266}
267
268
270{
271 // Sigh. Did we really need differentiated +/- 0.0?
272 if( aValue == -0.0 )
273 aValue = 0.0;
274
275 return wxString::Format( wxT( "%.2f%s" ),
276 aValue,
278}
279
280
282{
283 // Convert from internal units (mm) to user units
285 aValue /= 25.4;
286 else if( m_userUnits == EDA_UNITS::MILS )
287 aValue /= 25.4 / 1e3;
288
289 return wxString::Format( wxT( "%.6f%s" ),
290 aValue,
292}
293
294
296{
297 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
298 {
299 m_selected = idx;
300 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
301
302 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
303 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
304 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
305 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
306 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
307
308 // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI
309 // to match the rest of KiCad
310 xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) );
311 yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) );
312 zrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.z ) );
313
314 xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
315 yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
316 zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
317
318 m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
319 }
320 else
321 {
322 m_selected = -1;
323
324 xscale->ChangeValue( wxEmptyString );
325 yscale->ChangeValue( wxEmptyString );
326 zscale->ChangeValue( wxEmptyString );
327
328 xrot->ChangeValue( wxEmptyString );
329 yrot->ChangeValue( wxEmptyString );
330 zrot->ChangeValue( wxEmptyString );
331
332 xoff->ChangeValue( wxEmptyString );
333 yoff->ChangeValue( wxEmptyString );
334 zoff->ChangeValue( wxEmptyString );
335
336 m_opacity->SetValue( 100 );
337 }
338}
339
340
341void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
342{
343 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
344 {
345 // Write settings back to the parent
346 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
347
349 pcbIUScale, EDA_UNITS::UNSCALED, xscale->GetValue() );
351 pcbIUScale, EDA_UNITS::UNSCALED, yscale->GetValue() );
353 pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
354
355 // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI
356 // to match the rest of KiCad
357 modelInfo->m_Rotation.x = -rotationFromString( xrot->GetValue() );
358 modelInfo->m_Rotation.y = -rotationFromString( yrot->GetValue() );
359 modelInfo->m_Rotation.z = -rotationFromString( zrot->GetValue() );
360
362 xoff->GetValue() )
363 / pcbIUScale.IU_PER_MM;
365 yoff->GetValue() )
366 / pcbIUScale.IU_PER_MM;
368 zoff->GetValue() )
369 / pcbIUScale.IU_PER_MM;
370
371 // Update the dummy footprint for the preview
372 UpdateDummyFootprint( false );
373 onModify();
374 }
375}
376
377
378void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
379{
380 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
381 {
382 // Write settings back to the parent
383 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
384
385 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
386
387 // Update the dummy footprint for the preview
388 UpdateDummyFootprint( false );
389 onModify();
390 }
391}
392
393
394void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
395{
396 // turn ON or OFF options to show the board body if OFF, solder paste, soldermask
397 // and board body are hidden, to allows a good view of the 3D model and its pads.
399
400 if( !cfg )
401 return;
402
404
405 m_previewPane->ReloadRequest();
406 m_previewPane->Refresh();
407}
408
409
410void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
411{
412 BOARD_DESIGN_SETTINGS bds = m_dummyBoard->GetDesignSettings();
413 int thickness = bds.GetBoardThickness();
414
415 WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
416 thickness );
417
418 if( dlg.ShowModal() != wxID_OK )
419 return;
420
421 bds.SetBoardThickness( dlg.GetValue() );
422
423 BOARD_STACKUP& boardStackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
424 boardStackup.RemoveAll();
425 boardStackup.BuildDefaultStackupList( &bds, 2 );
426
427 UpdateDummyFootprint( true );
428
429 m_previewPane->ReloadRequest();
430 m_previewPane->Refresh();
431}
432
433
434void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
435{
436 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
437
438 wxCHECK( spinCtrl, /* void */ );
439
440 wxTextCtrl * textCtrl = xscale;
441
442 if( spinCtrl == m_spinYscale )
443 textCtrl = yscale;
444 else if( spinCtrl == m_spinZscale )
445 textCtrl = zscale;
446
447 double step = SCALE_INCREMENT;
448
449 if( wxGetMouseState().ShiftDown( ) )
451
453 textCtrl->GetValue() );
454
455 curr_value += ( step * aSign );
456 curr_value = std::max( 1/MAX_SCALE, curr_value );
457 curr_value = std::min( curr_value, MAX_SCALE );
458
459 textCtrl->SetValue( formatScaleValue( curr_value ) );
460}
461
462
463void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
464{
465 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( aEvent.GetEventObject() );
466
467 wxCHECK( spinCtrl, /* void */ );
468
469 wxTextCtrl* textCtrl = xrot;
470
471 if( spinCtrl == m_spinYrot )
472 textCtrl = yrot;
473 else if( spinCtrl == m_spinZrot )
474 textCtrl = zrot;
475
476 double step = ROTATION_INCREMENT;
477
478 if( wxGetMouseState().ShiftDown( ) )
480
482 textCtrl->GetValue() );
483
484 curr_value += ( step * aSign );
485 curr_value = std::max( -MAX_ROTATION, curr_value );
486 curr_value = std::min( curr_value, MAX_ROTATION );
487
488 textCtrl->SetValue( formatRotationValue( curr_value ) );
489}
490
491
492void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
493{
494 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
495
496 wxCHECK( spinCtrl, /* void */ );
497
498 wxTextCtrl * textCtrl = xoff;
499
500 if( spinCtrl == m_spinYoffset )
501 textCtrl = yoff;
502 else if( spinCtrl == m_spinZoffset )
503 textCtrl = zoff;
504
505 double step_mm = OFFSET_INCREMENT_MM;
506
507 if( wxGetMouseState().ShiftDown( ) )
508 step_mm = OFFSET_INCREMENT_MM_FINE;
509
511 {
512 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
513
514 if( wxGetMouseState().ShiftDown( ) )
515 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000;;
516 }
517
519 textCtrl->GetValue() )
520 / pcbIUScale.IU_PER_MM;
521
522 curr_value_mm += ( step_mm * aSign );
523 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
524 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
525
526 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
527}
528
529
531{
532 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
533
534 wxCHECK( textCtrl, /* void */ );
535
536 double step = SCALE_INCREMENT;
537
538 if( event.ShiftDown( ) )
540
541 if( event.GetWheelRotation() >= 0 )
542 step = -step;
543
545 textCtrl->GetValue() );
546
547 curr_value += step;
548 curr_value = std::max( 1/MAX_SCALE, curr_value );
549 curr_value = std::min( curr_value, MAX_SCALE );
550
551 textCtrl->SetValue( formatScaleValue( curr_value ) );
552}
553
554
556{
557 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
558
559 wxCHECK( textCtrl, /* void */ );
560
561 double step = ROTATION_INCREMENT;
562
563 if( event.ShiftDown( ) )
565
566 if( event.GetWheelRotation() >= 0 )
567 step = -step;
568
570 textCtrl->GetValue() );
571
572 curr_value += step;
573 curr_value = std::max( -MAX_ROTATION, curr_value );
574 curr_value = std::min( curr_value, MAX_ROTATION );
575
576 textCtrl->SetValue( formatRotationValue( curr_value ) );
577}
578
579
581{
582 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
583
584 wxCHECK( textCtrl, /* void */ );
585
586 double step_mm = OFFSET_INCREMENT_MM;
587
588 if( event.ShiftDown( ) )
589 step_mm = OFFSET_INCREMENT_MM_FINE;
590
592 {
593 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
594
595 if( event.ShiftDown( ) )
596 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
597 }
598
599 if( event.GetWheelRotation() >= 0 )
600 step_mm = -step_mm;
601
603 textCtrl->GetValue() )
604 / pcbIUScale.IU_PER_MM;
605
606 curr_value_mm += step_mm;
607 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
608 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
609
610 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
611}
612
613
614void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
615{
617 xoff->GetValue() )
618 / pcbIUScale.IU_PER_MM;
620 yoff->GetValue() )
621 / pcbIUScale.IU_PER_MM;
623 zoff->GetValue() )
624 / pcbIUScale.IU_PER_MM;
625
626 PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
627 m_userUnits = frame->GetUserUnits();
628
629 xoff->SetValue( formatOffsetValue( xoff_mm ) );
630 yoff->SetValue( formatOffsetValue( yoff_mm ) );
631 zoff->SetValue( formatOffsetValue( zoff_mm ) );
632
633 aEvent.Skip();
634}
635
636
637void PANEL_PREVIEW_3D_MODEL::onPanelShownEvent( wxCommandEvent& aEvent )
638{
639 if( m_spaceMouse )
640 {
641 m_spaceMouse->SetFocus( static_cast<bool>( aEvent.GetInt() ) );
642 }
643
644 aEvent.Skip();
645}
646
647
649{
650 m_dummyFootprint->Models().clear();
651
652 for( FP_3DMODEL& model : *m_parentModelList )
653 {
654 if( model.m_Show )
655 m_dummyFootprint->Models().push_back( model );
656 }
657
658 if( aReloadRequired )
659 m_previewPane->ReloadRequest();
660
661 m_previewPane->Request_refresh();
662}
663
664
666{
667 m_dummyBoard->SetEmbeddedFilesDelegate( aDelegate );
668}
669
670
672{
673 KIWAY_HOLDER* kiwayHolder = dynamic_cast<KIWAY_HOLDER*>( wxGetTopLevelParent( this ) );
674
675 if( kiwayHolder && kiwayHolder->GetType() == KIWAY_HOLDER::DIALOG )
676 static_cast<DIALOG_SHIM*>( kiwayHolder )->OnModify();
677}
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:309
#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:576
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:913
see class PGM_BASE
T * GetAppSettings(const char *aFilename)