53 std::vector<FP_3DMODEL>* aParentModelList ) :
55 m_parentFrame( aFrame ),
56 m_previewPane( nullptr ),
59 m_currentCamera( m_trackBallCamera ),
102 wxSpinButton* spinButtonList[] =
109 for( wxSpinButton* button : spinButtonList )
110 button->SetRange(INT_MIN, INT_MAX );
163 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
169 aFrame->Connect( EDA_EVT_UNITS_CHANGED,
200 wxCHECK_RET(
m_previewPane, wxT(
"Cannot load settings to null canvas" ) );
228 cfg->m_Render.use_board_editor_copper_colors =
false;
259 return wxString::Format( wxT(
"%.4f" ),
270 return wxString::Format( wxT(
"%.2f%s" ),
282 aValue /= 25.4 / 1e3;
284 return wxString::Format( wxT(
"%.6f%s" ),
319 xscale->ChangeValue( wxEmptyString );
320 yscale->ChangeValue( wxEmptyString );
321 zscale->ChangeValue( wxEmptyString );
323 xrot->ChangeValue( wxEmptyString );
324 yrot->ChangeValue( wxEmptyString );
325 zrot->ChangeValue( wxEmptyString );
327 xoff->ChangeValue( wxEmptyString );
328 yoff->ChangeValue( wxEmptyString );
329 zoff->ChangeValue( wxEmptyString );
437 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
439 wxTextCtrl * textCtrl =
xscale;
448 if( wxGetMouseState().ShiftDown( ) )
452 textCtrl->GetValue() );
454 curr_value += ( step * aSign );
455 curr_value = std::max( 1/
MAX_SCALE, curr_value );
456 curr_value = std::min( curr_value,
MAX_SCALE );
464 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
465 wxTextCtrl* textCtrl =
xrot;
474 if( wxGetMouseState().ShiftDown( ) )
478 textCtrl->GetValue() );
480 curr_value += ( step * aSign );
490 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
492 wxTextCtrl * textCtrl =
xoff;
501 if( wxGetMouseState().ShiftDown( ) )
508 if( wxGetMouseState().ShiftDown( ) )
513 textCtrl->GetValue() )
516 curr_value_mm += ( step_mm * aSign );
517 curr_value_mm = std::max( -
MAX_OFFSET, curr_value_mm );
518 curr_value_mm = std::min( curr_value_mm,
MAX_OFFSET );
526 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
530 if( event.ShiftDown( ) )
533 if( event.GetWheelRotation() >= 0 )
537 textCtrl->GetValue() );
540 curr_value = std::max( 1/
MAX_SCALE, curr_value );
541 curr_value = std::min( curr_value,
MAX_SCALE );
549 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
553 if( event.ShiftDown( ) )
556 if( event.GetWheelRotation() >= 0 )
560 textCtrl->GetValue() );
572 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
576 if( event.ShiftDown( ) )
583 if( event.ShiftDown( ) )
587 if( event.GetWheelRotation() >= 0 )
591 textCtrl->GetValue() )
594 curr_value_mm += step_mm;
595 curr_value_mm = std::max( -
MAX_OFFSET, curr_value_mm );
596 curr_value_mm = std::min( curr_value_mm,
MAX_OFFSET );
646 if( aReloadRequired )
constexpr EDA_IU_SCALE pcbIUScale
constexpr EDA_IU_SCALE unityScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
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
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)
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.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Implement a canvas based on a wxGLCanvas.
void SetProjectionMode(int aMode)
void SetInfoBar(WX_INFOBAR *aInfoBar)
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.
VECTOR3D m_Offset
3D model offset (mm)
VECTOR3D m_Rotation
3D model rotation (degrees)
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
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.
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
static const wxGLAttributes GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode, bool aAlpha=false)
Get a list of attributes to pass to wxGLCanvas.
Class PANEL_PREVIEW_3D_MODEL_BASE.
wxSpinButton * m_spinYrot
wxSpinButton * m_spinZrot
STD_BITMAP_BUTTON * m_bpvFront
wxSpinButton * m_spinXscale
wxSpinButton * m_spinYscale
wxSpinButton * m_spinXrot
wxBoxSizer * m_SizerPanelView
wxSpinButton * m_spinZoffset
wxStaticText * m_previewLabel
STD_BITMAP_BUTTON * m_bpvLeft
wxSpinButton * m_spinXoffset
wxSpinButton * m_spinYoffset
STD_BITMAP_BUTTON * m_bpSettings
STD_BITMAP_BUTTON * m_bpvRight
STD_BITMAP_BUTTON * m_bpvBodyStyle
STD_BITMAP_BUTTON * m_bpvBack
wxSpinButton * m_spinZscale
STD_BITMAP_BUTTON * m_bpUpdate
STD_BITMAP_BUTTON * m_bpvTop
STD_BITMAP_BUTTON * m_bpvISO
STD_BITMAP_BUTTON * m_bpvBottom
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...
~PANEL_PREVIEW_3D_MODEL()
wxString formatScaleValue(double aValue)
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)
void loadSettings()
Load 3D relevant settings from the user configuration.
NL_FOOTPRINT_PROPERTIES_PLUGIN * m_spaceMouse
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)
BOARD_ADAPTER m_boardAdapter
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
PCB_BASE_FRAME * m_parentFrame
EDA_3D_CANVAS * m_previewPane
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
FOOTPRINT * m_dummyFootprint
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.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual COMMON_SETTINGS * GetCommonSettings() const
virtual SETTINGS_MANAGER & GetSettingsManager() const
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
EDA_UNITS GetUserUnits() const
A modified version of the wxInfoBar class that allows us to:
An extension of WX_TEXT_ENTRY_DIALOG that uses UNIT_BINDER to request a dimension (e....
int GetValue()
Returns the value in internal units.
static constexpr EDA_ANGLE ANGLE_0
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.
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 cogl_att_list class.
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.
#define OFFSET_INCREMENT_MM_FINE
#define OFFSET_INCREMENT_MIL
#define ROTATION_INCREMENT_FINE
#define OFFSET_INCREMENT_MM
#define ROTATION_INCREMENT
#define OFFSET_INCREMENT_MIL_FINE
#define SCALE_INCREMENT_FINE
PGM_BASE & Pgm()
The global Program "get" accessor.
bool show_soldermask_bottom