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 (C) 2015-2023 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
30#include <tool/tool_manager.h>
34#include <base_units.h>
35#include <bitmaps.h>
36#include <board.h>
38#include <dpi_scaling_common.h>
39#include <pgm_base.h>
40#include <project_pcb.h>
43#include <widgets/wx_infobar.h>
46
48 FOOTPRINT* aFootprint,
49 std::vector<FP_3DMODEL>* aParentModelList ) :
50 PANEL_PREVIEW_3D_MODEL_BASE( aParent, wxID_ANY ),
51 m_parentFrame( aFrame ),
52 m_previewPane( nullptr ),
53 m_infobar( nullptr ),
54 m_boardAdapter(),
55 m_currentCamera( m_trackBallCamera ),
56 m_trackBallCamera( 2 * RANGE_SCALE_3D )
57{
59
60 m_dummyBoard = new BOARD();
61
62 m_dummyBoard->SetProject( &aFrame->Prj(), true );
63
64 // This board will only be used to hold a footprint for viewing
65 m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
66
67 m_bodyStyleShowAll = true;
68
69 BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
71 dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
74 dummy_board_stackup.RemoveAll();
75 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
76
77 m_selected = -1;
78
79 m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
80
81 // Set the bitmap of 3D view buttons:
82 m_bpvTop->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_top ) );
83 m_bpvFront->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_front ) );
84 m_bpvBack->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_back ) );
85 m_bpvLeft->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_left ) );
86 m_bpvRight->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_right ) );
87 m_bpvBottom->SetBitmap( KiBitmapBundle( BITMAPS::axis3d_bottom ) );
88 m_bpvISO->SetBitmap( KiBitmapBundle( BITMAPS::ortho ) );
89 m_bpvBodyStyle->SetBitmap( KiBitmapBundle( BITMAPS::axis3d ) );
90 m_bpUpdate->SetBitmap( KiBitmapBundle( BITMAPS::reload ) );
91 m_bpSettings->SetBitmap( KiBitmapBundle( BITMAPS::options_3drender ) );
92
93 // Set the min and max values of spin buttons (mandatory on Linux)
94 // They are not used, so they are set to min and max 32 bits int values
95 // (the min and max values supported by a wxSpinButton)
96 // It avoids blocking the up or down arrows when reaching this limit after
97 // a few clicks.
98 wxSpinButton* spinButtonList[] =
99 {
103 };
104
105 for( wxSpinButton* button : spinButtonList )
106 button->SetRange(INT_MIN, INT_MAX );
107
108 m_parentModelList = aParentModelList;
109
110 m_dummyFootprint = new FOOTPRINT( *aFootprint );
112
113 // Ensure the footprint is shown like in Fp editor: rot 0, not flipped
114 // to avoid mistakes when setting the3D shape position/rotation
117
119
120
122
123 // Create the 3D canvas
124 m_previewPane = new EDA_3D_CANVAS( this,
125 OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
127
130 m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
131
132 loadSettings();
133
134 // Create the manager
136 m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
137
141
142 // Register tools
145
146 // Run the viewer control tool, it is supposed to be always active
147 m_toolManager->InvokeTool( "3DViewer.Control" );
148
149 m_infobar = new WX_INFOBAR( this );
151
152 m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
153 m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
154
155 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
156 {
157 Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
158 this );
159 }
160
161 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
162 wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
163 nullptr, this );
164
165#ifdef __WXOSX__
166 // Call layout once to get the proper button sizes after the bitmaps have been set
167 Layout();
168
169 // The rounded-button style used has a small border on the left/right sides.
170 // This is automatically fixed in wx for buttons with a bitmap < 20, but not
171 // when the bitmap is set to be 26x26.
172 wxSize borderFix = wxSize( 4, 4 );
173
174 m_bpvTop->SetMinSize( m_bpvTop->GetSize() + borderFix );
175 m_bpvFront->SetMinSize( m_bpvFront->GetSize() + borderFix );
176 m_bpvBack->SetMinSize( m_bpvBack->GetSize() + borderFix );
177 m_bpvLeft->SetMinSize( m_bpvLeft->GetSize() + borderFix );
178 m_bpvRight->SetMinSize( m_bpvRight->GetSize() + borderFix );
179 m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
180 m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
181 m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
182 m_bpSettings->SetMinSize( m_bpSettings->GetSize() + borderFix );
183#endif
184}
185
186
188{
189 // Restore the 3D viewer Render settings, that can be modified by the panel tools
192
193 delete m_dummyBoard;
194 delete m_previewPane;
195}
196
197
198void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
199{
200 if( !m_toolDispatcher )
201 aEvent.Skip();
202 else
204}
205
206
208{
209 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
210
211 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
212
213 const DPI_SCALING_COMMON dpi{ settings, this };
214 m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
215
216 // TODO(JE) use all control options
218
219 EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
220
221 if( cfg )
222 {
223 // Save the 3D viewer render settings, to restore it after closing the preview
225
226 m_boardAdapter.m_Cfg = cfg;
227
231
232 // Ensure the board body is always shown, and do not use the settings of the 3D viewer
240 }
241}
242
243
249static double rotationFromString( const wxString& aValue )
250{
252
253 if( rotation > MAX_ROTATION )
254 {
255 int n = KiROUND( rotation / MAX_ROTATION );
256 rotation -= MAX_ROTATION * n;
257 }
258 else if( rotation < -MAX_ROTATION )
259 {
260 int n = KiROUND( -rotation / MAX_ROTATION );
261 rotation += MAX_ROTATION * n;
262 }
263
264 return rotation;
265}
266
267
269{
270 return wxString::Format( wxT( "%.4f" ),
271 aValue );
272}
273
274
276{
277 return wxString::Format( wxT( "%.2f%s" ),
278 aValue,
279 EDA_UNIT_UTILS::GetText( EDA_UNITS::DEGREES ) );
280}
281
282
284{
285 // Convert from internal units (mm) to user units
286 if( m_userUnits == EDA_UNITS::INCHES )
287 aValue /= 25.4;
288 else if( m_userUnits == EDA_UNITS::MILS )
289 aValue /= 25.4 / 1e3;
290
291 return wxString::Format( wxT( "%.6f%s" ),
292 aValue,
294}
295
296
298{
299 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
300 {
301 m_selected = idx;
302 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
303
304 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
305 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
306 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
307 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
308 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
309
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 modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
356 modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
357 modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
358
360 xoff->GetValue() )
363 yoff->GetValue() )
366 zoff->GetValue() )
368
369 // Update the dummy footprint for the preview
370 UpdateDummyFootprint( false );
371 }
372}
373
374
375void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
376{
377 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
378 {
379 // Write settings back to the parent
380 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
381
382 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
383
384 // Update the dummy footprint for the preview
385 UpdateDummyFootprint( false );
386 }
387}
388
389
390void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
391{
392 // turn ON or OFF options to show the board body if OFF, soder paste, soldermask
393 // and board body are hidden, to allows a good view of the 3D model and its pads.
395
396 if( !cfg )
397 return;
398
400
406
408 m_previewPane->Refresh();
409}
410
411
412void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
413{
415 int thickness = bds.GetBoardThickness();
416
417 WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
418 thickness );
419
420 if( dlg.ShowModal() != wxID_OK )
421 return;
422
423 bds.SetBoardThickness( dlg.GetValue() );
424
426 boardStackup.RemoveAll();
427 boardStackup.BuildDefaultStackupList( &bds, 2 );
428
429 UpdateDummyFootprint( true );
430
432 m_previewPane->Refresh();
433}
434
435
436void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
437{
438 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
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 curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
448 textCtrl->GetValue() );
449
450 curr_value += ( SCALE_INCREMENT * aSign );
451 curr_value = std::max( 1/MAX_SCALE, curr_value );
452 curr_value = std::min( curr_value, MAX_SCALE );
453
454 textCtrl->SetValue( formatScaleValue( curr_value ) );
455}
456
457
458void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
459{
460 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
461 wxTextCtrl* textCtrl = xrot;
462
463 if( spinCtrl == m_spinYrot )
464 textCtrl = yrot;
465 else if( spinCtrl == m_spinZrot )
466 textCtrl = zrot;
467
468 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
469 textCtrl->GetValue() );
470
471 curr_value += ( ROTATION_INCREMENT * aSign );
472 curr_value = std::max( -MAX_ROTATION, curr_value );
473 curr_value = std::min( curr_value, MAX_ROTATION );
474
475 textCtrl->SetValue( formatRotationValue( curr_value ) );
476}
477
478
479void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
480{
481 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
482
483 wxTextCtrl * textCtrl = xoff;
484
485 if( spinCtrl == m_spinYoffset )
486 textCtrl = yoff;
487 else if( spinCtrl == m_spinZoffset )
488 textCtrl = zoff;
489
490 double step_mm = OFFSET_INCREMENT_MM;
491 double curr_value_mm =
493 textCtrl->GetValue() )
495
496 if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
497 {
498 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
499 }
500
501 curr_value_mm += ( step_mm * aSign );
502 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
503 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
504
505 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
506}
507
508
510{
511 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
512
513 double step = SCALE_INCREMENT;
514
515 if( event.ShiftDown( ) )
517
518 if( event.GetWheelRotation() >= 0 )
519 step = -step;
520
521 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
522 textCtrl->GetValue() );
523
524 curr_value += step;
525 curr_value = std::max( 1/MAX_SCALE, curr_value );
526 curr_value = std::min( curr_value, MAX_SCALE );
527
528 textCtrl->SetValue( formatScaleValue( curr_value ) );
529}
530
531
533{
534 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
535
536 double step = ROTATION_INCREMENT_WHEEL;
537
538 if( event.ShiftDown( ) )
540
541 if( event.GetWheelRotation() >= 0 )
542 step = -step;
543
544 double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
545 textCtrl->GetValue() );
546
547 curr_value += step;
548 curr_value = std::max( -MAX_ROTATION, curr_value );
549 curr_value = std::min( curr_value, MAX_ROTATION );
550
551 textCtrl->SetValue( formatRotationValue( curr_value ) );
552}
553
554
556{
557 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
558
559 double step_mm = OFFSET_INCREMENT_MM;
560
561 if( event.ShiftDown( ) )
562 step_mm = OFFSET_INCREMENT_MM_FINE;
563
564 if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
565 {
566 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
567
568 if( event.ShiftDown( ) )
569 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
570 }
571
572 if( event.GetWheelRotation() >= 0 )
573 step_mm = -step_mm;
574
576 textCtrl->GetValue() )
578
579 curr_value_mm += step_mm;
580 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
581 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
582
583 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
584}
585
586
587void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
588{
590 xoff->GetValue() )
593 yoff->GetValue() )
596 zoff->GetValue() )
598
599 PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
600 m_userUnits = frame->GetUserUnits();
601
602 xoff->SetValue( formatOffsetValue( xoff_mm ) );
603 yoff->SetValue( formatOffsetValue( yoff_mm ) );
604 zoff->SetValue( formatOffsetValue( zoff_mm ) );
605
606 aEvent.Skip();
607}
608
609
611{
612 m_dummyFootprint->Models().clear();
613
614 for( FP_3DMODEL& model : *m_parentModelList )
615 {
616 if( model.m_Show )
617 m_dummyFootprint->Models().push_back( model );
618 }
619
620 if( aReloadRequired )
622
624}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:64
bool m_IsPreviewer
true if we're in a 3D preview panel, false for the standard 3D viewer
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
EDA_3D_VIEWER_SETTINGS * m_Cfg
bool m_MousewheelPanning
Container for design settings for a BOARD object.
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
void SetBoardThickness(int aThickness)
void SetParentGroup(PCB_GROUP *aGroup)
Definition: board_item.h:90
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.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:276
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:855
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:288
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:192
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:766
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
EDA_3D_ACTIONS.
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
void SetProjectionMode(int aMode)
void SetInfoBar(WX_INFOBAR *aInfoBar)
Definition: eda_3d_canvas.h:79
void SetAnimationEnabled(bool aEnable)
Enable or disable camera animation when switching to a pre-defined view.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
void SetMovingSpeedMultiplier(int aMultiplier)
Set the camera animation moving speed multiplier option.
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
EDA_3D_CONTROLLER.
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2069
bool IsFlipped() const
Definition: footprint.h:351
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:202
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1937
VECTOR2I GetPosition() const override
Definition: footprint.h:206
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:98
double m_Opacity
Definition: footprint.h:99
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:97
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:96
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition: lset.cpp:904
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:911
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
Get a list of attributes to pass to wxGLCanvas.
Class PANEL_PREVIEW_3D_MODEL_BASE.
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
true if the board body is show
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 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
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.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Definition: project_pcb.cpp:77
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:165
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:167
ACTIONS * m_actions
Definition: tools_holder.h:166
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h:57
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
EDA_UNITS GetUserUnits() const
T y
Definition: vector3.h:63
T z
Definition: vector3.h:64
T x
Definition: vector3.h:62
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
An extension of WX_TEXT_ENTRY_DIALOG that uses UNIT_BINDER to request a dimension (e....
int GetValue()
Returns the value in internal units.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:437
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:565
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:110
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:127
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 ROTATION_INCREMENT_WHEEL_FINE
#define ROTATION_INCREMENT_WHEEL
#define SCALE_INCREMENT
#define OFFSET_INCREMENT_MM
#define ROTATION_INCREMENT
#define OFFSET_INCREMENT_MIL_FINE
#define SCALE_INCREMENT_FINE
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:119
const double IU_PER_MM
Definition: base_units.h:77
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85