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
32#include <tool/tool_manager.h>
36#include <base_units.h>
37#include <bitmaps.h>
38#include <board.h>
40#include <dpi_scaling_common.h>
41#include <lset.h>
42#include <pgm_base.h>
43#include <project_pcb.h>
46#include <widgets/wx_infobar.h>
50
51#ifndef __linux__
53#else
55#endif
56
58 FOOTPRINT* aFootprint,
59 std::vector<FP_3DMODEL>* aParentModelList ) :
61 m_parentFrame( aFrame ),
62 m_previewPane( nullptr ),
63 m_infobar( nullptr ),
67{
68 m_userUnits = m_parentFrame->GetUserUnits();
69
70 m_dummyBoard = new BOARD();
71
72 m_dummyBoard->SetProject( &aFrame->Prj(), true );
73 m_dummyBoard->SetEmbeddedFilesDelegate( aFrame->GetBoard() );
74
75 // This board will only be used to hold a footprint for viewing
76 m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
77
78 BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
79 BOARD_DESIGN_SETTINGS& dummy_bds = m_dummyBoard->GetDesignSettings();
80 dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
82 BOARD_STACKUP& dummy_board_stackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
83 dummy_board_stackup.RemoveAll();
84 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
85
86 m_selected = -1;
87
88 m_previewLabel->SetFont( KIUI::GetStatusFont( this ) );
89
90 // Set the bitmap of 3D view buttons:
97 m_bpvISO->SetBitmap( KiBitmapBundle( BITMAPS::ortho ) );
101
102 // Set the min and max values of spin buttons (mandatory on Linux)
103 // They are not used, so they are set to min and max 32 bits int values
104 // (the min and max values supported by a wxSpinButton)
105 // It avoids blocking the up or down arrows when reaching this limit after
106 // a few clicks.
107 wxSpinButton* spinButtonList[] =
108 {
112 };
113
114 for( wxSpinButton* button : spinButtonList )
115 button->SetRange(INT_MIN, INT_MAX );
116
117 m_parentModelList = aParentModelList;
118
119 m_dummyFootprint = new FOOTPRINT( *aFootprint );
120 m_dummyFootprint->SetParentGroup( nullptr );
121
122 // Ensure the footprint is shown like in Fp editor: rot 0, not flipped
123 // to avoid mistakes when setting the3D shape position/rotation
124 if( m_dummyFootprint->IsFlipped() )
126
127 m_dummyFootprint->SetOrientation( ANGLE_0 );
128
129
131
132 // Create the 3D canvas
133 m_previewPane = new EDA_3D_CANVAS( this,
136 PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
137
138 try
139 {
140#ifndef __linux__
141 m_spaceMouse = std::make_unique<NL_FOOTPRINT_PROPERTIES_PLUGIN>( m_previewPane );
142#else
143 m_spaceMouse = std::make_unique<SPNAV_VIEWER_PLUGIN>( m_previewPane );
144#endif
145 m_spaceMouse->SetFocus( true );
146 }
147 catch( const std::system_error& e )
148 {
149 wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
150 }
151
152 m_boardAdapter.SetBoard( m_dummyBoard );
153 m_boardAdapter.m_IsBoardView = false;
154
155 // Force display 3D models, regardless the 3D viewer options.
156 m_boardAdapter.m_IsPreviewer = true;
157
158 loadSettings();
159
160 // Create the manager
162 m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
163
166 m_previewPane->SetEventDispatcher( m_toolDispatcher );
167
168 // Register tools
169 m_toolManager->RegisterTool( new EDA_3D_CONTROLLER );
170 m_toolManager->InitTools();
171
172 // Run the viewer control tool, it is supposed to be always active
173 m_toolManager->InvokeTool( "3DViewer.Control" );
174
175 m_infobar = new WX_INFOBAR( this );
176 m_previewPane->SetInfoBar( m_infobar );
177
178 m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
179 m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
180
181 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
182 {
183 Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
184 this );
185 }
186
187 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
188 wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL::onUnitsChanged ),
189 nullptr, this );
190
191 Bind( wxCUSTOM_PANEL_SHOWN_EVENT, &PANEL_PREVIEW_3D_MODEL::onPanelShownEvent, this );
192}
193
194
196{
197 // Shutdown all running tools
198 if( m_toolManager )
199 m_toolManager->ShutdownAllTools();
200
201 // Restore the 3D viewer Render settings, that can be modified by the panel tools
202 if( m_boardAdapter.m_Cfg )
203 m_boardAdapter.m_Cfg->m_Render = m_initialRender;
204
205 delete m_dummyBoard;
206 delete m_previewPane;
207}
208
209
210void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
211{
212 if( !m_toolDispatcher )
213 aEvent.Skip();
214 else
215 m_toolDispatcher->DispatchWxEvent( aEvent );
216}
217
218
220{
221 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
222
223 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
224
225 // TODO(JE) use all control options
226 m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
227
229 {
230 // Save the 3D viewer render settings, to restore it after closing the preview
231 m_initialRender = cfg->m_Render;
232
233 m_boardAdapter.m_Cfg = cfg;
234
235 m_previewPane->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
236 m_previewPane->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
237 m_previewPane->SetProjectionMode( cfg->m_Camera.projection_mode );
238 }
239}
240
241
247static double rotationFromString( const wxString& aValue )
248{
250 aValue );
251
252 if( rotation > MAX_ROTATION )
253 {
254 int n = KiROUND( rotation / MAX_ROTATION );
255 rotation -= MAX_ROTATION * n;
256 }
257 else if( rotation < -MAX_ROTATION )
258 {
259 int n = KiROUND( -rotation / MAX_ROTATION );
260 rotation += MAX_ROTATION * n;
261 }
262
263 return rotation;
264}
265
266
268{
269 return wxString::Format( wxT( "%.4f" ),
270 aValue );
271}
272
273
275{
276 // Sigh. Did we really need differentiated +/- 0.0?
277 if( aValue == -0.0 )
278 aValue = 0.0;
279
280 return wxString::Format( wxT( "%.2f%s" ),
281 aValue,
283}
284
285
287{
288 // Convert from internal units (mm) to user units
290 aValue /= 25.4;
291 else if( m_userUnits == EDA_UNITS::MILS )
292 aValue /= 25.4 / 1e3;
293
294 return wxString::Format( wxT( "%.6f%s" ),
295 aValue,
297}
298
299
301{
302 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
303 {
304 m_selected = idx;
305 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
306
307 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
308 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
309 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
310 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
311 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
312
313 // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI
314 // to match the rest of KiCad
315 xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) );
316 yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) );
317 zrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.z ) );
318
319 xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
320 yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
321 zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
322
323 m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
324 }
325 else
326 {
327 m_selected = -1;
328
329 xscale->ChangeValue( wxEmptyString );
330 yscale->ChangeValue( wxEmptyString );
331 zscale->ChangeValue( wxEmptyString );
332
333 xrot->ChangeValue( wxEmptyString );
334 yrot->ChangeValue( wxEmptyString );
335 zrot->ChangeValue( wxEmptyString );
336
337 xoff->ChangeValue( wxEmptyString );
338 yoff->ChangeValue( wxEmptyString );
339 zoff->ChangeValue( wxEmptyString );
340
341 m_opacity->SetValue( 100 );
342 }
343}
344
345
346static wxString evaluateTextCtrlFormula( const wxString& aValue )
347{
348 // NUMERIC_EVALUATOR doesn't handle UTF-8 multi-byte characters properly,
349 // so skip evaluation if the string contains non-ASCII characters (e.g., degree symbols)
350 for( wxUniChar c : aValue )
351 {
352 if( !c.IsAscii() )
353 return aValue;
354 }
355
356 // Attempt to evaluate formula; if successful return result, otherwise return original
358
359 if( eval.Process( aValue ) )
360 return eval.Result();
361
362 return aValue;
363}
364
365
366void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
367{
368 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
369 {
370 // Write settings back to the parent
371 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
372
379
380 // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI
381 // to match the rest of KiCad
382 modelInfo->m_Rotation.x = -rotationFromString( evaluateTextCtrlFormula( xrot->GetValue() ) );
383 modelInfo->m_Rotation.y = -rotationFromString( evaluateTextCtrlFormula( yrot->GetValue() ) );
384 modelInfo->m_Rotation.z = -rotationFromString( evaluateTextCtrlFormula( zrot->GetValue() ) );
385
387 evaluateTextCtrlFormula( xoff->GetValue() ) )
388 / pcbIUScale.IU_PER_MM;
390 evaluateTextCtrlFormula( yoff->GetValue() ) )
391 / pcbIUScale.IU_PER_MM;
393 evaluateTextCtrlFormula( zoff->GetValue() ) )
394 / pcbIUScale.IU_PER_MM;
395
396 // Update the dummy footprint for the preview
397 UpdateDummyFootprint( false );
398 onModify();
399 }
400}
401
402
403void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
404{
405 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
406 {
407 // Write settings back to the parent
408 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
409
410 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
411
412 // Update the dummy footprint for the preview
413 UpdateDummyFootprint( false );
414 onModify();
415 }
416}
417
418
419void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event )
420{
421 // turn ON or OFF options to show the board body if OFF, solder paste, soldermask
422 // and board body are hidden, to allows a good view of the 3D model and its pads.
424
425 if( !cfg )
426 return;
427
429
430 m_previewPane->ReloadRequest();
431 m_previewPane->Refresh();
432}
433
434
435void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
436{
437 BOARD_DESIGN_SETTINGS bds = m_dummyBoard->GetDesignSettings();
438 int thickness = bds.GetBoardThickness();
439
440 WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "3D Preview Options" ), _( "Board thickness:" ),
441 thickness );
442
443 if( dlg.ShowModal() != wxID_OK )
444 return;
445
446 bds.SetBoardThickness( dlg.GetValue() );
447
448 BOARD_STACKUP& boardStackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
449 boardStackup.RemoveAll();
450 boardStackup.BuildDefaultStackupList( &bds, 2 );
451
452 UpdateDummyFootprint( true );
453
454 m_previewPane->ReloadRequest();
455 m_previewPane->Refresh();
456}
457
458
459void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
460{
461 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
462
463 wxCHECK( spinCtrl, /* void */ );
464
465 wxTextCtrl * textCtrl = xscale;
466
467 if( spinCtrl == m_spinYscale )
468 textCtrl = yscale;
469 else if( spinCtrl == m_spinZscale )
470 textCtrl = zscale;
471
472 double step = SCALE_INCREMENT;
473
474 if( wxGetMouseState().ShiftDown( ) )
476
478 textCtrl->GetValue() );
479
480 curr_value += ( step * aSign );
481 curr_value = std::max( 1/MAX_SCALE, curr_value );
482 curr_value = std::min( curr_value, MAX_SCALE );
483
484 textCtrl->SetValue( formatScaleValue( curr_value ) );
485}
486
487
488void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
489{
490 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( aEvent.GetEventObject() );
491
492 wxCHECK( spinCtrl, /* void */ );
493
494 wxTextCtrl* textCtrl = xrot;
495
496 if( spinCtrl == m_spinYrot )
497 textCtrl = yrot;
498 else if( spinCtrl == m_spinZrot )
499 textCtrl = zrot;
500
501 double step = ROTATION_INCREMENT;
502
503 if( wxGetMouseState().ShiftDown( ) )
505
507 textCtrl->GetValue() );
508
509 curr_value += ( step * aSign );
510 curr_value = std::max( -MAX_ROTATION, curr_value );
511 curr_value = std::min( curr_value, MAX_ROTATION );
512
513 textCtrl->SetValue( formatRotationValue( curr_value ) );
514}
515
516
517void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
518{
519 wxSpinButton* spinCtrl = dynamic_cast<wxSpinButton*>( event.GetEventObject() );
520
521 wxCHECK( spinCtrl, /* void */ );
522
523 wxTextCtrl * textCtrl = xoff;
524
525 if( spinCtrl == m_spinYoffset )
526 textCtrl = yoff;
527 else if( spinCtrl == m_spinZoffset )
528 textCtrl = zoff;
529
530 double step_mm = OFFSET_INCREMENT_MM;
531
532 if( wxGetMouseState().ShiftDown( ) )
533 step_mm = OFFSET_INCREMENT_MM_FINE;
534
536 {
537 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
538
539 if( wxGetMouseState().ShiftDown( ) )
540 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000;;
541 }
542
544 textCtrl->GetValue() )
545 / pcbIUScale.IU_PER_MM;
546
547 curr_value_mm += ( step_mm * aSign );
548 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
549 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
550
551 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
552}
553
554
556{
557 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
558
559 wxCHECK( textCtrl, /* void */ );
560
561 double step = SCALE_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( 1/MAX_SCALE, curr_value );
574 curr_value = std::min( curr_value, MAX_SCALE );
575
576 textCtrl->SetValue( formatScaleValue( curr_value ) );
577}
578
579
581{
582 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
583
584 wxCHECK( textCtrl, /* void */ );
585
586 double step = ROTATION_INCREMENT;
587
588 if( event.ShiftDown( ) )
590
591 if( event.GetWheelRotation() >= 0 )
592 step = -step;
593
595 textCtrl->GetValue() );
596
597 curr_value += step;
598 curr_value = std::max( -MAX_ROTATION, curr_value );
599 curr_value = std::min( curr_value, MAX_ROTATION );
600
601 textCtrl->SetValue( formatRotationValue( curr_value ) );
602}
603
604
606{
607 wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( event.GetEventObject() );
608
609 wxCHECK( textCtrl, /* void */ );
610
611 double step_mm = OFFSET_INCREMENT_MM;
612
613 if( event.ShiftDown( ) )
614 step_mm = OFFSET_INCREMENT_MM_FINE;
615
617 {
618 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
619
620 if( event.ShiftDown( ) )
621 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
622 }
623
624 if( event.GetWheelRotation() >= 0 )
625 step_mm = -step_mm;
626
628 textCtrl->GetValue() )
629 / pcbIUScale.IU_PER_MM;
630
631 curr_value_mm += step_mm;
632 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
633 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
634
635 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
636}
637
638
639void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
640{
642 xoff->GetValue() )
643 / pcbIUScale.IU_PER_MM;
645 yoff->GetValue() )
646 / pcbIUScale.IU_PER_MM;
648 zoff->GetValue() )
649 / pcbIUScale.IU_PER_MM;
650
651 PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( aEvent.GetClientData() );
652 m_userUnits = frame->GetUserUnits();
653
654 xoff->SetValue( formatOffsetValue( xoff_mm ) );
655 yoff->SetValue( formatOffsetValue( yoff_mm ) );
656 zoff->SetValue( formatOffsetValue( zoff_mm ) );
657
658 aEvent.Skip();
659}
660
661
662void PANEL_PREVIEW_3D_MODEL::onPanelShownEvent( wxCommandEvent& aEvent )
663{
664 if( m_spaceMouse )
665 {
666 m_spaceMouse->SetFocus( static_cast<bool>( aEvent.GetInt() ) );
667 }
668
669 aEvent.Skip();
670}
671
672
674{
675 m_dummyFootprint->Models().clear();
676
678 {
679 if( model.m_Show )
680 m_dummyFootprint->Models().push_back( model );
681 }
682
683 if( aReloadRequired )
684 m_previewPane->ReloadRequest();
685
686 m_previewPane->Request_refresh();
687}
688
689
691{
692 m_dummyBoard->SetEmbeddedFilesDelegate( aDelegate );
693}
694
695
697{
698 KIWAY_HOLDER* kiwayHolder = dynamic_cast<KIWAY_HOLDER*>( wxGetTopLevelParent( this ) );
699
700 if( kiwayHolder && kiwayHolder->GetType() == KIWAY_HOLDER::DIALOG )
701 static_cast<DIALOG_SHIM*>( kiwayHolder )->OnModify();
702}
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:120
double m_Opacity
Definition footprint.h:121
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition footprint.h:119
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition footprint.h:118
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
wxString Result() const
bool Process(const wxString &aString)
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:547
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 wxString evaluateTextCtrlFormula(const wxString &aValue)
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.
see class PGM_BASE
T * GetAppSettings(const char *aFilename)
KIBIS_MODEL * model