Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Asobo unique ID option at export #144

Closed
BrianDeVos opened this issue May 4, 2022 · 14 comments
Closed

Support Asobo unique ID option at export #144

BrianDeVos opened this issue May 4, 2022 · 14 comments

Comments

@BrianDeVos
Copy link

Current Behavior

Currently models exported using the Blender plugin cannot easily be used for model merging unless the ID is manually added via text editor.

Model does not have the 'ASOBO_unique_id' extension: 'vfs://topkit-simulations-737-classic/SimObjects/Airplanes/topkit-simulations-737-classic/model/base_external_lod00.gltf'.
While merging:
vfs://topkit-simulations-737-classic/SimObjects/Airplanes/topkit-simulations-737-classic/model/base_external_lod00.gltf
vfs://topkit-simulations-737-classic/SimObjects/Airplanes/topkit-simulations-737-classic/modelAttachments/merge_external_lod00.gltf

Model does not have the 'ASOBO_unique_id' extension: 'vfs://topkit-simulations-737-classic/SimObjects/Airplanes/topkit-simulations-737-classic/modelAttachments/merge_external_lod00.gltf'.
While merging:
vfs://topkit-simulations-737-classic/SimObjects/Airplanes/topkit-simulations-737-classic/model/base_external_lod00.gltf
vfs://topkit-simulations-737-classic/SimObjects/Airplanes/topkit-simulations-737-classic/modelAttachments/merge_external_lod00.gltf

Hopefully this can be added, thanks in advance!

Expected Behavior

If everything works as it should (and if I fully understand the process), this should merge the models in sim and display both to add things like liveries.

Steps To Reproduce

  1. Export a base model with a certain node name e.g: x0_fuselage
  2. Export a model to add to the existing model as a new GLTF, also including a node with the same name "x0_fuselage"
  3. Merge model in the base model xml file using the element:
<LOD minSize="150" ModelFile="base_external_lod00.gltf">
	<MergeModel>..\modelAttachments\merge_external_lod00.gltf</MergeModel>
</LOD>
  1. Build package results in the errors above

Environment

- OS: Windows 10
- Blender: 3.0.0
- glTF-Blender-IO-MSFS: 1.1.6

Anything else?

No response

@ghost
Copy link

ghost commented May 5, 2022

indeed this has a maximum priority ...I'm on it

@ghost
Copy link

ghost commented May 5, 2022

@BrianDavos please let me know if this solve the issue so I can merge the PR

@BrianDeVos
Copy link
Author

@lpierabella there's a spelling mistake, it should be ASOBO_unique_id, not ASOBO_uniqueID.
image

When changing that in the source GLTF file it still does not compile since the bones I am using do not get their own unique ID, just the armature.
image

Thank you so much for getting to this so fast!

@BrianDeVos
Copy link
Author

Added to that, a possibility to add a custom unique ID to specified objects would be really beneficial. So when exporting with the option enabled, objects with a custom unique ID will use that custom ID while objects without a custom ID would get one on export.

Also, because bones can have the same name on export (apparently), there would be a need for a unique ID for every object, otherwise the packagebuilder will throw an error citing a non unique ID is used.

@ghost
Copy link

ghost commented May 6, 2022

I fixed the typo and added the support for bones

@ghost
Copy link

ghost commented May 6, 2022

Added to that, a possibility to add a custom unique ID to specified objects would be really beneficial. So when exporting with the option enabled, objects with a custom unique ID will use that custom ID while objects without a custom ID would get one on export.

Also, because bones can have the same name on export (apparently), there would be a need for a unique ID for every object, otherwise the packagebuilder will throw an error citing a non unique ID is used.

I'm not sure about this, I could easily add a per object property that allows setting manually the unique_id, however from the documentation the nodes and bones names in blender seems to be granted as unique.
How can you have two bones with the same name?

@BrianDeVos
Copy link
Author

BrianDeVos commented May 6, 2022

For some reason bones can have the same name as long as they're in different armatures. I have multiple armatures that each have bones with the exact same name.
image

Edit: So to elaborate some more, these don't get renamed on exporting the gltf from blender, however they do get renamed when building the package. But that leads to them not having a unique ID as it's still the same as the original name which was used multiple times.
image

@ghost
Copy link

ghost commented May 6, 2022

I see, isn't it better to manage the uniqueID directly by renaming the bone?
Or do you think is better to add a custom property in the object section?

@BrianDeVos
Copy link
Author

It would of course be better to rename bones to a more unique name indeed.

However, when exporting a model that you want to be merged by the simulator, the unique ID has to be truly unique, while the node name has to be the same as the node you want to merge with (This seems very vaguely documented in the SDK. As I read it, it should happen the other way around). This means, if every id has to be unique but the node name has to be the same to be merged, customising the unique ID would be beneficial to the user.

What I currently have working in sim is the following are the following nodes which are merged:

MAIN MODEL

{
            "extensions" : {
                "ASOBO_unique_id" : {
                    "id" : "x0_fuselage_no_eyebrows"
                }
            },
            "extras" : {
                "ant_landscape" : {},
                "fsx_anim_tag" : "",
                "fsx_anim_length" : "0"
            },
            "mesh" : 16,
            "name" : "x0_fuselage_no_eyebrows"
        }

SUBMODEL

{
            "extensions" : {
                "ASOBO_unique_id" : {
                    "id" : "x0_fuselage_no_eyebrows_merge"
                }
            },
            "mesh" : 0,
            "name" : "x0_fuselage_no_eyebrows"
        }

So as you can see, the node name is the same, while the ID is truly unique. On the other hand, when I now change the node name to something different the merging process doesn't happen. Additionally when I switch it around, so node name different and unique ID the same I get an error. I get the same error if the node name and the unique ID are the same.

So for external users to merge anything with a model, the unique ID has to be changeable.

@ghost
Copy link

ghost commented May 6, 2022

I see, I'll add a unique_id property per object
The behavior will be like in max if not specified the uniqueID is by default the name of the object otherwise the specified uniqueID in the object section has the priority

@BrianDeVos
Copy link
Author

You are an absolute legend! Thanks so much for the insanely fast changes you made. Aside from the things I mentioned, everything fully functions and I can no merge models in sim!

@ghost
Copy link

ghost commented May 6, 2022

my last push should solve the issue...let me know

@BrianDeVos
Copy link
Author

It fully functions as expected, thanks for the support!

@ghost
Copy link

ghost commented May 9, 2022

I'm closing as this is done in #145

@ghost ghost closed this as completed May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant