Project Blender Mesh Tools add-on

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
Its probably doable, but not straight forward. We would also need a rule for the collections themselves. The order you see them on the screen is likely determined by the Outliner editor, and may or may not be the order they exist in the data collection. Which itself is not associated with a scene. You need to link them together.

So, what is probably feasible would be to sort by the collections in a scene, with the collections sorted by name (use the 01_xx trick) and then within the collection the objects would be sorted based on the 'Sort Mode' dropdown.

If you have access to github, go there and add it as an issue (https://github.com/BMCDad/orbiter-blender/issues) When I can dig into the code a bit more I can add some notes there about what is possible.

I'm currently working on 2D panel support, so as soon as I have that up I'll take a look.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
Orbiter animation? You can tell it to output an include file that includes the position of individual objects. That would give you a VECTOR3 of the objects location in the mesh's coordinate system.

What are you trying to do?
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,055
Reaction score
642
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Orbiter animation? You can tell it to output an include file that includes the position of individual objects. That would give you a VECTOR3 of the objects location in the mesh's coordinate system.

What are you trying to do?
I'm writing an Orbiter module (.dll, .so) and I need the coordinates of the mesh to animate correctly with C++.
I am going to try your solution (the include file) and I am going to try to animate the mesh.
https://www.orbiter-forum.com/threads/orbiter-screenshot-thread.8/page-425#post-610669

I have tried your solution and now it produces an include file but I don't see the coordinates of the mesh:
C++:
// Auto generated code file.  Blender: 3.6.0  Blender Tools: (2, 0, 12)
// Date: Mon Aug  7 13:40:05 2023


#include "orbitersdk.h"

#ifndef __Luna3_H
#define __Luna3_H

namespace bl
{

// Scene Luna3

  namespace Luna3
  {
    const DWORD TXIDX_Metal_dds = 1;
    const DWORD TXIDX_PanelesSolares_dds = 2;
    const DWORD TXIDX_PanelesSolares2_dds = 3;
    const DWORD TXIDX_PanelesSolares3_dds = 4;
    constexpr auto MESH_NAME = "Luna3";

    const UINT 00_Lenscover1Id = 0;
    const UINT 010_MassSpectrometerId = 1;
    const UINT 011_Solar_panels1Id = 2;
    const UINT 012_Solar_panels2Id = 3;
    const UINT 013_SolarPanels3Id = 4;
    const UINT 01_Lenscover2Id = 5;
    const UINT 02_Antennas1Id = 6;
    const UINT 03_CylinderId = 7;
    const UINT 04_Cylinder.001Id = 8;
    const UINT 05_Cylinder.003Id = 9;
    const UINT 06_DetailsId = 10;
    const UINT 07_LensesId = 11;
    const UINT 08_LensframeId = 12;
    const UINT 09_Main_bodyId = 13;

  }

}
#endif
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
C++ can not have identifiers starting with a number btw.
Blender might allow that, but C++ doesn't
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
Give your object names an alpha prefix if you want to sort by name, as mentioned. In Blender, in the Object Properties, under the Orbiter Object Panel, select 'Include Position'. That will output the object position in the include file.

Also, when you copy an object you will get the .001 etc. That will also cause problems with C++, so after copying an object, make sure to give it a valid name (your 04_Cylinder.001Id etc).

You can also place an 'Empty' in Blender and then tell it to output that position. That is a good way to get a position for a point where there is no object. I use this for animation rotation points, view points, etc.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
New version 2.1.1

Jordan, this should address your normals issues. Please test and let me know.

This version does alter how transforms are handled a bit to try and properly handle normals. As I cannot test extensively, please try this out and let me know if you have issues. Keep the old zip file handy if you have issues that break your models.

This also adds 2D panel mesh support. I added that to finally implement a 2D panel for my SR71r addon. I hope to get that up soon as well. Documentation for that will come soon I hope. In short, create a new scene and layout your panel in the Z-X plane such that the upper left corner of the panel is at the origin. The panel will 'hang' down from the X axis.

Thanks to thomasantony for the MAC temp folder code. MAC users, let me know if there are issues.

Enjoy.
 

Jordan

Active member
Joined
May 13, 2010
Messages
136
Reaction score
80
Points
43
Location
Germany
New version 2.1.1

Jordan, this should address your normals issues. Please test and let me know.

This version does alter how transforms are handled a bit to try and properly handle normals. As I cannot test extensively, please try this out and let me know if you have issues. Keep the old zip file handy if you have issues that break your models.

This also adds 2D panel mesh support. I added that to finally implement a 2D panel for my SR71r addon. I hope to get that up soon as well. Documentation for that will come soon I hope. In short, create a new scene and layout your panel in the Z-X plane such that the upper left corner of the panel is at the origin. The panel will 'hang' down from the X axis.

Thanks to thomasantony for the MAC temp folder code. MAC users, let me know if there are issues.

Enjoy.
Thanks Blake, I tested V2.1.1 and it works perfectly.
I work on the NASSP VC and there are many switches, rotarys etc where the mesh of each one is the same, so just one mesh with multiple instances so I can make a change to that obejct that affects them all.
Before that I had a workaround that required several steps. That was a dangerous one. Save the Blend file before the changes. Apply Modifiers, Make each instance Real Object, Apply Rotation, then Build the Mesh and hope not to save accidentally the Blend file inbeetwen, and lose all your work.
 

Felix24

Active member
Joined
May 13, 2010
Messages
245
Reaction score
95
Points
43
Would it be possible to use Blender's built-in render enable/disable buttons (the little camera icon next to each object) in the Outliner part of the interface? It would be handy if we wanted to disable objects from the mesh output for whatever reason, in the same way that it's already possible to disable objects from rendering.

If this is already possible through some other way, I apologize in advance!
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
Would it be possible to use Blender's built-in render enable/disable buttons (the little camera icon next to each object) in the Outliner part of the interface? It would be handy if we wanted to disable objects from the mesh output for whatever reason, in the same way that it's already possible to disable objects from rendering.

If this is already possible through some other way, I apologize in advance!

I'll take a look, that is not a bad idea. That actually should be fairly simple to implement assuming that visibility property is part of the object and not part of the context.
 

Jordan

Active member
Joined
May 13, 2010
Messages
136
Reaction score
80
Points
43
Location
Germany
Would it be possible to use Blender's built-in render enable/disable buttons (the little camera icon next to each object) in the Outliner part of the interface? It would be handy if we wanted to disable objects from the mesh output for whatever reason, in the same way that it's already possible to disable objects from rendering.

If this is already possible through some other way, I apologize in advance!
You can use "Export Selected" and Select the Objects you want to be in the mesh.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
Would it be possible to use Blender's built-in render enable/disable buttons (the little camera icon next to each object) in the Outliner part of the interface? It would be handy if we wanted to disable objects from the mesh output for whatever reason, in the same way that it's already possible to disable objects from rendering.

If this is already possible through some other way, I apologize in advance!

New release just put up that should provide this. It was pretty easy to add, and also provides a resolution to an issue I was running into in my 2D panel development, so thanks for the suggestion.

In the Blender outliner, its the far right icon (the camera). You can still hide objects in a scene and they will be exported, I do this all the time to focus work. This provides a way to create an object which remains visible in the view, but will not export. Similar to an Empty (which I also use a lot), but since these objects can be more complex, they may prove more useful. Any size and position data you requested for the include file will still be included.
 

Vortice

Member
Joined
Nov 2, 2013
Messages
9
Reaction score
12
Points
18
First of all thanks for your hard work.

When you talk about 2D Panel mesh support are you refering to the "artistic" side of the panel (shapes, colors, and so on)? Or are you refering to the "software" side like buttons implementations, animations and something like that?

Sorry for my maybe "basic" questions but I'm a bit lost in this development world of Orbiter.
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
First of all thanks for your hard work.

When you talk about 2D Panel mesh support are you refering to the "artistic" side of the panel (shapes, colors, and so on)? Or are you refering to the "software" side like buttons implementations, animations and something like that?

Sorry for my maybe "basic" questions but I'm a bit lost in this development world of Orbiter.

I'm probably referring to what you are calling "artistic". In Blender you create the 'shapes' of your vessel or cockpit. The same is true for 2D panels, only you are dealing with two dimensions instead of three. Also in Blender you assign the texture that controls the color and appearance of that shape. The texture itself is created in a graphics application like Photoshop or Gimp.

The Blender plugin will output a C++ include file but that only contains data about the 'shapes' in the file. The smarts you give the shapes will be provided by the add-in module (the code) that controls the behavior of your vessel.

Orbiter development has a pretty steep learning curve, but it is a lot of fun when you start figuring it out.
 

Vortice

Member
Joined
Nov 2, 2013
Messages
9
Reaction score
12
Points
18
I'm probably referring to what you are calling "artistic". In Blender you create the 'shapes' of your vessel or cockpit. The same is true for 2D panels, only you are dealing with two dimensions instead of three. Also in Blender you assign the texture that controls the color and appearance of that shape. The texture itself is created in a graphics application like Photoshop or Gimp.

The Blender plugin will output a C++ include file but that only contains data about the 'shapes' in the file. The smarts you give the shapes will be provided by the add-in module (the code) that controls the behavior of your vessel.

Orbiter development has a pretty steep learning curve, but it is a lot of fun when you start figuring it out.

Thank you for the information.

Now I have a better understanding of this new feature of your module. Apart of this I was able to export meshes without problems to Orbiter. The first time I saw your module I said "WHAT?!" haha.

Good evening!
 

Blake

Addon Developer
Addon Developer
Joined
Mar 9, 2009
Messages
233
Reaction score
121
Points
58
Location
Lehi, Utah
im getting an error i have never had before...

View attachment 34340

Blender 2.79 version, any idea what i am doing wrong?

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.
 

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.
ill check that!
 
Top