Project Blender Mesh Tools add-on

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,696
Reaction score
1,353
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
@Blake, do you plan on adding documentation for the 2D panel stuff?
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
235
Reaction score
122
Points
58
Location
Lehi, Utah
@Blake, do you plan on adding documentation for the 2D panel stuff?

I will add a bit more to the github readme, but I won't go into depth. 2D and virtual cockpit development gets pretty deep. The plug-in is really not doing much other then tweaking some axis values so that the orientation of the 2d panel is the same as a VC (assuming you have the swap y-z axis setting set).

The blend file for my SR71r is setup for VC and 2D panel using this plugin if you want to see an actual example: https://github.com/BMCDad/orbiter-s.../Orbitersdk/samples/SR71R/Blender/SR71r.blend
 

Col Brubaker

Hoax Developer
Joined
May 21, 2011
Messages
82
Reaction score
40
Points
33
Location
Free Republic of Germany
Well, we are using it in Linux. But we have again problems with export and import. I can't import a mesh I exported before.
Matias Saibene has the same issue. Is your Blender Orbiter Master able to run in Linux? I tried several versions, even old with old add-ons.
 
Last edited:

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
235
Reaction score
122
Points
58
Location
Lehi, Utah
Well, we are using it in Linux. But We have again problems with export and import. I can't import a mesh I exported before.
Matias Saibene has the same issue. Is your Blender Orbiter Master able to run in Linux? I tried several versions, even old with old add-ons.
It should work fine under linux assuming you are running a recent version of Blender (I would suggest 3.5 as that's what I used for the latest that is in master).

File paths seem to be the sticky point between the various OSs. What errors are you getting?
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,057
Reaction score
649
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
It should work fine under linux assuming you are running a recent version of Blender (I would suggest 3.5 as that's what I used for the latest that is in master).

File paths seem to be the sticky point between the various OSs. What errors are you getting?
In my case I receive the following error:
Python:
Pyhton: Traceback (most recent call last):
        File "/home/matias/.config/blender/3.3/scripts/addons/orbiter-blender-2/_init_.py", line 207, in execute
            import_tools.import_mesh(config, path)
        File "/home/matias/.config/blender/3.3/scripts/addons/orbiter-blender-2/_init_.py", line 430, in import_mesh
            orbiter_path = os.path.join(*up[0:up.index('meshes')])
ValueError: 'meshes' is not in list
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
235
Reaction score
122
Points
58
Location
Lehi, Utah
In my case I receive the following error:
Python:
Pyhton: Traceback (most recent call last):
        File "/home/matias/.config/blender/3.3/scripts/addons/orbiter-blender-2/_init_.py", line 207, in execute
            import_tools.import_mesh(config, path)
        File "/home/matias/.config/blender/3.3/scripts/addons/orbiter-blender-2/_init_.py", line 430, in import_mesh
            orbiter_path = os.path.join(*up[0:up.index('meshes')])
ValueError: 'meshes' is not in list



The import assumes you are importing from a 'standard' orbiter folder structure from the 'meshes' folder. So, I would first try from a standard install and see if the import works. It does this so that it can find the textures involved. Orbiter makes similar assumptions, so the plugin follows that.

It could still be this is a Linux issue, I develop and test this under Windows, so as I said, sometimes there are differences in python os.path that trips things up. So first try importing from the 'orbiter/meshes' and see if that works.

I myself don't use the import functionality, so it could probably use more love.

Edit:
This should behave better if 'meshes' is not found, I have put in an issue in github and will take a look when I can. It will be a few weeks however since I am traveling.
 
Last edited:

Col Brubaker

Hoax Developer
Joined
May 21, 2011
Messages
82
Reaction score
40
Points
33
Location
Free Republic of Germany
Great. But please consider, that we have (for Gondos-reasons) ...home/USER/orbiter_test/Orbiter/Meshes...
I put my folders now elsewhere and give it a try. If it just needs the path.

Or perhaps there was a fly in your machine? :ROFLMAO:
 
Last edited:

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
235
Reaction score
122
Points
58
Location
Lehi, Utah
Great. But please consider, that we have (for Gondos-reasons) ...home/USER/orbiter_test/Orbiter/Meshes...
I put my folders now elsewhere and give it a try. If it just needs the path.

In theory that should work. It's looking for 'meshes' and trying to build the relative path from there. So, if that currently does not work, it should and I'll try to fix it.
 

Col Brubaker

Hoax Developer
Joined
May 21, 2011
Messages
82
Reaction score
40
Points
33
Location
Free Republic of Germany
But there has to be something else. Cause that way I can Import Mir.msh but not ISS.msh, just for example.
I was looking to open Atlantis for the wing profile. And that is real strange.

giphy.gif
 
Last edited:

Jordan

Active member
Joined
May 13, 2010
Messages
137
Reaction score
80
Points
43
Location
Germany
The problem arises because Windows does not differentiate between upper and lower case. Linux, on the other hand, does.

I can work around the problem by changing the lines 429 and 430 in the file "import_tools.py".

from
Code:
....
    up = [pp.lower() for pp in p.parts]
    orbiter_path = os.path.join(*up[0:up.index('meshes')])
....

to
Code:
....
    up = [pp for pp in p.parts]
    orbiter_path = os.path.join(*up[0:up.index('Meshes')])
....

and add the following on line 350
Code:
....
            src_tex=src_tex.replace("\\", "/" )
....

However, there is still a problem that the capitalization of the texture names is not correct for some. There is still a lot of manual work to be done. To do this, I start Blender in the terminal and with every attempt where a texture cannot be loaded, Blender shows an error in the terminal with the texture not found.

e.g. WARN: Texture file not found: Textur_xxx.dds

This is the name that is in the mesh file. Then I check whether the actual texture file has the same name and if not then I rename the file with what is entered in the mesh. Remember that the capitalization of both must be the same.

Or even easier, you open the mesh file in a text editor and compare at the end of the file whether all the texture names match the actual names of the texture files, if not you can then either change the names in the mesh file or rename the texture files so that the name matches.

By the way, I use Linux Mint, latest version
 
Last edited:

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
235
Reaction score
122
Points
58
Location
Lehi, Utah
Thanks Jordan. When I can I'll get a Linux system up where I can go through the whole workflow. I've never run it on Linux.
 

Trekkie

Starfleet Head of Ship Design
Addon Developer
Donator
Joined
Feb 6, 2016
Messages
350
Reaction score
89
Points
43
Location
Starfleet Ship Design Bureau
I'm surprised it installed. Minimum is Blender 2.81. Blender went through a major topology overhaul for 2.8, I would not expect this plug-in to work in older versions.
That said, if it was working and no longer is, I expect it is related to the change in how transforms are applied, but that is a guess. All I can recommend is to upgrade to a later version of Blender.
Took some time for me to get back to it but you were right and i got it working now, Thanks!
 

Jordan

Active member
Joined
May 13, 2010
Messages
137
Reaction score
80
Points
43
Location
Germany
#UPDATE Should Work in Textures and Textures2

Based on my last post, if you also add the following in the file "import_tools.py" starting at line 350, it should work automatically without having to rename the files, at least it does for me.

The problem with the capitalization of texture names should be solved. But some meshes have subfolders in Textures or Textures2 folders e.g. the ISS. If the capitalization of these folders is not the same, it won't work.

Code:
#by Jordan START:

            src_tex=src_tex.replace("\\", "/" )
            src_tex_tmp=src_tex[src_tex.rfind('/')+1:]

            src_tex_path=src_tex[:src_tex.rfind('/')+1]

            tmp_tex2_file = os.path.join(orbiter_path, "Textures2", src_tex_path)
            tmp_tex_file = os.path.join(orbiter_path, "Textures", src_tex_path)

            if os.path.exists(tmp_tex_file):
                texturelist = os.listdir(tmp_tex_file)

                y=0
                for x in range(len(texturelist)):
                    if texturelist[x].lower() == src_tex_tmp.lower():
                        y=x

            if os.path.exists(tmp_tex2_file):
                texturelist = os.listdir(tmp_tex2_file)

                y=0
                for x in range(len(texturelist)):
                    if texturelist[x].lower() == src_tex_tmp.lower():
                        y=x

            src_tex=src_tex_path+texturelist[y]
            y=0

#by Jordan END:
 
Last edited:

ThBaron

Donator
Donator
Joined
May 14, 2018
Messages
77
Reaction score
10
Points
23
Hello Blake, I would like to modify a mesh, which works fine in Orbiter 2016. I use a Windows PC, your current Blender Mesh Tool with Blender 3.6. Meshes and texture paths should not be the problem, other meshes can be imported, all in C:\Orbiter\Meshes and C:\Orbiter\Textures. The textures listed in the mesh file do not have subdirectories.
I get this Python report. I attach a ZIP with the files. Thanks, Thomas

Python:
Python: Traceback (most recent call last):
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\__init__.py", line 207, in execute
    import_tools.import_mesh(config, path)
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 459, in import_mesh
    groups, materials, textures = read_mesh_file(config, file_path)
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 437, in read_mesh_file
    raise error
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 431, in read_mesh_file
    groups.append(read_group(file))
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 167, in read_group
    new_group.verts.append(sc(file.readline()).split())
  File "D:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 7342: invalid continuation byte
 

Attachments

  • MLM.zip
    3.3 MB · Views: 6

Jordan

Active member
Joined
May 13, 2010
Messages
137
Reaction score
80
Points
43
Location
Germany
File "D:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 7342: invalid continuation byte[/CODE]
This is not a problem with the Blender mesh tools addon. Your problem is that the file was not saved correctly.
Try loading the file with a text editor and then saving it as UTF8.

Alternatively, take this file.
 

Attachments

  • MLM.msh.zip
    813.9 KB · Views: 1

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
235
Reaction score
122
Points
58
Location
Lehi, Utah
Hello Blake, I would like to modify a mesh, which works fine in Orbiter 2016. I use a Windows PC, your current Blender Mesh Tool with Blender 3.6. Meshes and texture paths should not be the problem, other meshes can be imported, all in C:\Orbiter\Meshes and C:\Orbiter\Textures. The textures listed in the mesh file do not have subdirectories.
I get this Python report. I attach a ZIP with the files. Thanks, Thomas

Python:
Python: Traceback (most recent call last):
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\__init__.py", line 207, in execute
    import_tools.import_mesh(config, path)
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 459, in import_mesh
    groups, materials, textures = read_mesh_file(config, file_path)
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 437, in read_mesh_file
    raise error
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 431, in read_mesh_file
    groups.append(read_group(file))
  File "C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\orbiter-blender-2\import_tools.py", line 167, in read_group
    new_group.verts.append(sc(file.readline()).split())
  File "D:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 7342: invalid continuation byte

Python does not seem to like how the 'foreign' characters are represented in the file.

LABEL BoîteChanfrein02

I just loaded the file into VSCode and saved it back out, then it worked. There is probably a way to tell python to handle that, I don't have time at the moment to track that down, so just resave that file and it should work.

edit: Thanks Jordan.
 

Marcin

Member
Joined
Mar 31, 2020
Messages
17
Reaction score
5
Points
18
I haven't .msh option in export tab but I have .msh in import tab.
Anyone had this issue?
 

Jordan

Active member
Joined
May 13, 2010
Messages
137
Reaction score
80
Points
43
Location
Germany
@Blake Can you add a checkbox to enable or disable adding name extension for the materials when importing meshes?
 
Top