version: dark_sylinc-ogremeshy-f64906340568.tar.gz
Issue #1
After deleting old version and intalling the latest one--
dark_sylinc-ogremeshy-f64906340568.tar.gz
and following the compiling text doc,
sudo make rootinstall for Ubuntu LInux,then run ogremeshy, it silently failed again.
In order to find the reason, I found no ~/.ogremeshy created. After look in to the makefile, I found the reason
Because there is no mkdir -p $(HOME)/.ogremeshy in
rootinstall section, so
no ~/.ogremeshy is created!!!
But if I use
make install It can create ~/.ogremeshy with the owner set to home user but the next command
su root -c make rootinstall will not work because we don't have root password. If I use
sudo make install then it will set the owner of ~/.ogremeshy to root
As long as
sudo is used, it will set the owner of ~/.ogremeshy to root, but
without sudo ,we don't have the right to copy files to system folders. That's the problem. (ps. I learned that '.ogremesh' is generated in make install process not by running the bin file.)
Issue #2
After manually add ~/.ogremeshy or set the owner to home user, the program can run!!!
But wait!!! It can run only when I
cd /opt/ogremeshy and run it from that folder, or run it in the Linux_Release folder.
If I type
ogremeshy to run it in other folders, it will complain the following message then exit:
I did have these files in /opt/ogremeshy/Resources/Icons/32x32!
I guess the
ln command can't resolve the working directory issue.
Issue #3
If I run the program from /opt/ogremeshy, I can avoid issue 2, but as I mentioned earlier:
It only loads meshes and resources in home directory. Even if I use the file browser to choose location, it still try loads the files from home, if it cannot find them, it fails, I guess.
The following code is from
wxOgreMeshViewerMainFrameImpl.cpp
Code: Select all
void MeshyMainFrameImpl::openMeshDialog()
{
wxFileDialog openFileDialog( this, _("Open mesh file"), wxString( m_lastOpenMeshDir.c_str(),
wxConvUTF8 ),
wxT(""), wxT("*.mesh"), wxFD_OPEN|wxFD_FILE_MUST_EXIST, wxDefaultPosition);
if( openFileDialog.ShowModal() == wxID_OK )
{
m_lastOpenMeshDir = openFileDialog.GetDirectory().mb_str();
// print mesh path, it echos only home path not the true path the mesh is in
std::cout<< "file path:"<<std::string( m_lastOpenMeshDir ) << std::endl; //I add this line to test
openMesh( m_lastOpenMeshDir, std::string( openFileDialog.GetFilename().mb_str() ) );
}
}
My mesh is in the /home/guidry/programming/cpp/CAI09/media/models
But the program tries to load the mesh in /home/guidry/ and of course can't find it, and fails.
After taking a look at
wxWigets doc pages:
wxString GetDirectory() Returns the default directory.
wxString GetFilename() Returns the default filename.
wxString GetPath() Returns the full path (directory and filename) of the selected file.
I wonder the reason maybe at
openFileDialog.GetDirectory(), the default directory may not be the folder you choose, at least for wxWigets2.8.12 on Ubuntu.
Why not use
GetPath() instead?
Only one meter away from hitting the target to cross platforms! Keep going!! Thank you!!
Below is the video of my running the program, it silently fails if I want to load a file from other than the /home/guidry folder.
[youtube]Fdbf5V_0RPc[/youtube]
I tried to modify the code in the ]wxOgreMeshViewerMainFrameImpl.cpp to the following:
Code: Select all
void MeshyMainFrameImpl::openMeshDialog()
{
wxFileDialog openFileDialog( this, _("Open mesh file"), wxString( m_lastOpenMeshDir.c_str(),
wxConvUTF8 ),
wxT(""), wxT("*.mesh"), wxFD_OPEN|wxFD_FILE_MUST_EXIST, wxDefaultPosition);
wxString path_filename;
std::string filename;
if( openFileDialog.ShowModal() == wxID_OK ) {
path_filename = openFileDialog.GetPath();
size_t sep = path_filename.find_last_of(wxT("/\\"));
m_lastOpenMeshDir = std::string(path_filename.Left(sep).mb_str());
filename=std::string(path_filename.Right(path_filename.Len()-sep-1).mb_str());
std::cout<<sep<<"full path name"<<std::string(path_filename.mb_str())<<" dir:"<<m_lastOpenMeshDir<<" name:"<<filename<<std::endl;
openMesh( m_lastOpenMeshDir, filename );
}
}
and
Code: Select all
void MeshyMainFrameImpl::loadResourcesCfgDialog()
{
wxFileDialog openFileDialog( this, _("Open resources.cfg file to parse"), m_lastOpenResCfgDir, wxT(""),
wxT("*.cfg"), wxFD_OPEN|wxFD_FILE_MUST_EXIST, wxDefaultPosition );
wxString path_filename;
if( openFileDialog.ShowModal() == wxID_OK )
{
path_filename = openFileDialog.GetPath();
size_t sep = path_filename.find_last_of(wxT("/\\"));
m_lastOpenResCfgDir = path_filename.Left(sep);
loadResourcesCfg(path_filename);
}
}
Now the issue #3 gets resolved on Ubuntu, please take a look at the following video:
[youtube]GXvgk-aMkwc[/youtube]