2015-12-13 21:45:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
2021-07-18 14:06:48 +00:00
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2015-12-13 21:45:22 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2016-02-23 06:46:22 +00:00
|
|
|
#include <sstream>
|
|
|
|
#include <wx/log.h>
|
2016-01-12 07:18:11 +00:00
|
|
|
#include <wx/translation.h>
|
2016-02-23 06:46:22 +00:00
|
|
|
|
2015-12-13 21:45:22 +00:00
|
|
|
#include "plugins/ldr/3d/pluginldr3D.h"
|
|
|
|
|
|
|
|
#define PLUGIN_CLASS_3D "PLUGIN_3D"
|
|
|
|
#define PLUGIN_3D_MAJOR 1
|
|
|
|
#define PLUGIN_3D_MINOR 0
|
|
|
|
#define PLUGIN_3D_PATCH 0
|
2015-12-14 03:51:28 +00:00
|
|
|
#define PLUGIN_3D_REVISION 0
|
2015-12-13 21:45:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
KICAD_PLUGIN_LDR_3D::KICAD_PLUGIN_LDR_3D()
|
|
|
|
{
|
|
|
|
ok = false;
|
2021-07-18 14:06:48 +00:00
|
|
|
m_getNExtensions = nullptr;
|
|
|
|
m_getModelExtension = nullptr;
|
|
|
|
m_getNFilters = nullptr;
|
|
|
|
m_getFileFilter = nullptr;
|
|
|
|
m_canRender = nullptr;
|
|
|
|
m_load = nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KICAD_PLUGIN_LDR_3D::~KICAD_PLUGIN_LDR_3D()
|
|
|
|
{
|
|
|
|
Close();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( ok )
|
|
|
|
Close();
|
|
|
|
|
|
|
|
if( !open( aFullFileName, PLUGIN_CLASS_3D ) )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
{
|
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << "Failed to open plugin '" << aFullFileName.ToUTF8() << "'";
|
|
|
|
m_error = ostr.str();
|
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
|
|
|
|
ostr << " * [INFO] error: " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2015-12-13 21:45:22 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// the version checks passed and the base KICAD_PLUGIN functions have been linked;
|
|
|
|
// now we link the remaining functions expected by PLUGIN_3D and confirm that the
|
|
|
|
// plugin is loaded
|
|
|
|
LINK_ITEM( m_getNExtensions, PLUGIN_3D_GET_N_EXTENSIONS, "GetNExtensions" );
|
|
|
|
LINK_ITEM( m_getModelExtension, PLUGIN_3D_GET_MODEL_EXTENSION, "GetModelExtension" );
|
|
|
|
LINK_ITEM( m_getNFilters, PLUGIN_3D_GET_N_FILTERS, "GetNFilters" );
|
|
|
|
LINK_ITEM( m_getFileFilter, PLUGIN_3D_GET_FILE_FILTER, "GetFileFilter" );
|
|
|
|
LINK_ITEM( m_canRender, PLUGIN_3D_CAN_RENDER, "CanRender" );
|
|
|
|
LINK_ITEM( m_load, PLUGIN_3D_LOAD, "Load" );
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool fail = false;
|
2015-12-13 21:45:22 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( !m_getNExtensions )
|
|
|
|
{
|
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
wxString errmsg = "incompatible plugin (missing function 'GetNExtensions')";
|
|
|
|
ostr << errmsg.ToUTF8() << "\n";
|
|
|
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
|
|
fail = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !m_getModelExtension )
|
|
|
|
{
|
|
|
|
if( !fail )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
2021-07-18 14:06:48 +00:00
|
|
|
wxString errmsg = "incompatible plugin (missing function 'GetModelExtension')";
|
2016-02-23 06:46:22 +00:00
|
|
|
ostr << errmsg.ToUTF8() << "\n";
|
|
|
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2015-12-13 21:45:22 +00:00
|
|
|
fail = true;
|
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
else
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
wxString errmsg = "missing function 'GetModelExtension'";
|
|
|
|
ostr << errmsg.ToUTF8();
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
}
|
2015-12-13 21:45:22 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( !m_getNFilters )
|
|
|
|
{
|
|
|
|
if( !fail )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
wxString errmsg = "incompatible plugin (missing function 'GetNFilters')";
|
|
|
|
ostr << errmsg.ToUTF8() << "\n";
|
|
|
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
|
|
fail = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::ostringstream ostr;
|
|
|
|
wxString errmsg = "missing function 'GetNFilters'";
|
|
|
|
ostr << errmsg.ToUTF8();
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
}
|
2015-12-13 21:45:22 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( !m_getFileFilter )
|
|
|
|
{
|
|
|
|
if( !fail )
|
|
|
|
{
|
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
wxString errmsg = "incompatible plugin (missing function 'GetFileFilter')";
|
|
|
|
ostr << errmsg.ToUTF8() << "\n";
|
|
|
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
|
|
fail = true;
|
|
|
|
}
|
|
|
|
else
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
wxString errmsg = "missing function 'GetFileFilter'";
|
|
|
|
ostr << errmsg.ToUTF8();
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
}
|
2015-12-13 21:45:22 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( !m_canRender )
|
|
|
|
{
|
|
|
|
if( !fail )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
wxString errmsg = "incompatible plugin (missing function 'CanRender')";
|
|
|
|
ostr << errmsg.ToUTF8() << "\n";
|
|
|
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
|
|
fail = true;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::ostringstream ostr;
|
|
|
|
wxString errmsg = "missing function 'CanRender'";
|
|
|
|
ostr << errmsg.ToUTF8();
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
|
|
}
|
|
|
|
}
|
2015-12-13 21:45:22 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( !m_load )
|
|
|
|
{
|
|
|
|
if( !fail )
|
|
|
|
{
|
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
wxString errmsg = "incompatible plugin (missing function 'Load')";
|
|
|
|
ostr << errmsg.ToUTF8() << "\n";
|
|
|
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
|
|
}
|
|
|
|
else
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
wxString errmsg = "missing function 'Load'";
|
|
|
|
ostr << errmsg.ToUTF8();
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
}
|
2015-12-13 21:45:22 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2015-12-13 21:45:22 +00:00
|
|
|
|
|
|
|
if( !m_getNExtensions || !m_getModelExtension || !m_getNFilters
|
2021-07-18 14:06:48 +00:00
|
|
|
|| !m_getFileFilter || !m_canRender || !m_load )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
Close();
|
|
|
|
|
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << "Failed to open plugin '" << aFullFileName.ToUTF8() << "'; missing functions";
|
|
|
|
m_error = ostr.str();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KICAD_PLUGIN_LDR_3D::Close( void )
|
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2015-12-14 03:51:28 +00:00
|
|
|
if( ok )
|
|
|
|
{
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * [INFO] closing plugin";
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2015-12-14 03:51:28 +00:00
|
|
|
}
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2015-12-14 03:51:28 +00:00
|
|
|
|
2015-12-13 21:45:22 +00:00
|
|
|
ok = false;
|
2021-07-18 14:06:48 +00:00
|
|
|
m_getNExtensions = nullptr;
|
|
|
|
m_getModelExtension = nullptr;
|
|
|
|
m_getNFilters = nullptr;
|
|
|
|
m_getFileFilter = nullptr;
|
|
|
|
m_canRender = nullptr;
|
|
|
|
m_load = nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
close();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KICAD_PLUGIN_LDR_3D::GetLoaderVersion( unsigned char* Major, unsigned char* Minor,
|
2021-07-18 14:06:48 +00:00
|
|
|
unsigned char* Patch, unsigned char* Revision ) const
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
if( Major )
|
|
|
|
*Major = PLUGIN_3D_MAJOR;
|
|
|
|
|
|
|
|
if( Minor )
|
|
|
|
*Minor = PLUGIN_3D_MINOR;
|
|
|
|
|
|
|
|
if( Patch )
|
|
|
|
*Patch = PLUGIN_3D_PATCH;
|
|
|
|
|
2015-12-14 03:51:28 +00:00
|
|
|
if( Revision )
|
|
|
|
*Revision = PLUGIN_3D_REVISION;
|
|
|
|
|
2015-12-13 21:45:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( !ok && !reopen() )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( nullptr == m_getNExtensions )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
m_error = "[BUG] GetNExtensions is not linked";
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2015-12-13 21:45:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_getNExtensions();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char const* KICAD_PLUGIN_LDR_3D::GetModelExtension( int aIndex )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( !ok && !reopen() )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( nullptr == m_getModelExtension )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
m_error = "[BUG] GetModelExtension is not linked";
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m_getModelExtension( aIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KICAD_PLUGIN_LDR_3D::GetNFilters( void )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( !ok && !reopen() )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( nullptr == m_getNFilters )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
m_error = "[BUG] GetNFilters is not linked";
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2015-12-13 21:45:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_getNFilters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char const* KICAD_PLUGIN_LDR_3D::GetFileFilter( int aIndex )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( !ok && !reopen() )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( nullptr == m_getFileFilter )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
m_error = "[BUG] GetFileFilter is not linked";
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m_getFileFilter( aIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool KICAD_PLUGIN_LDR_3D::CanRender( void )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( !ok && !reopen() )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( nullptr == m_canRender )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
m_error = "[BUG] CanRender is not linked";
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2015-12-13 21:45:22 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_canRender();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCENEGRAPH* KICAD_PLUGIN_LDR_3D::Load( char const* aFileName )
|
|
|
|
{
|
|
|
|
m_error.clear();
|
|
|
|
|
|
|
|
if( !ok && !reopen() )
|
|
|
|
{
|
|
|
|
if( m_error.empty() )
|
|
|
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
if( nullptr == m_load )
|
2015-12-13 21:45:22 +00:00
|
|
|
{
|
|
|
|
m_error = "[BUG] Load is not linked";
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
#ifdef DEBUG
|
2016-02-23 06:46:22 +00:00
|
|
|
std::ostringstream ostr;
|
|
|
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
|
|
ostr << " * " << m_error;
|
|
|
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
2021-07-18 14:06:48 +00:00
|
|
|
#endif
|
2016-01-12 07:03:17 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2015-12-13 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m_load( aFileName );
|
|
|
|
}
|