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

[GLTF Exporter] Access the current nodes logical index in gather_node_hook #2401

Open
windowslucker1121 opened this issue Nov 14, 2024 · 0 comments

Comments

@windowslucker1121
Copy link

Hey there,
im developed a gltf schema and now wanted to use blender to export tgat schema. (swithc away from our current export program)
The development for the schema is in a kinda advanced state and also used in a productive manner, so changing it is not really an option here.

Just a little background information:

A Exporter in another tool writes the extension already and its working fairly well.

{
  "extensions": {
    "myExtension": {
      "machines": [
        {
          "gltf_root_machine_id": [
            0,
            162
          ],
          "nodeTypes": [
            {
              "nodeSettings": {...},
              "nodeType": "Module",
              "node_id": 0
            },
            {
              "nodeSettings": {...},
              "nodeType": "Visibility",
              "node_id": 1
            },
            {
              "nodeSettings": {...},
              "nodeType": "Axis",
              "node_id": 2
            },
            {
              "nodeType": "CoordinateSystem",
              "node_id": 353
            }
          ]
        }
      ]
    }
  },
  "asset": {
    "copyright": "",
    "generator": "SharpGLTF 1.0.0",
    "version": "2.0"
  }
  "nodes": [...],
  "mehes": [...],
,.......

As this little dump hopefully shows - im keeping the information outside to the "real" 3d data and the scene itself (yes we could maybe have written the data to the node itself, but that was not an option to us - we wanted to hold the data completely seperat).

Im currently writing the addon to be able to configure (and export) the schema inside blender and im asking myself the question, how would i find the logical index of the node, to be able to write it to the extension via the hooks provided here:

gather_node_hook(self, gltf2_node, blender_object, export_settings)

I debugged already all of the parameters of the hooks function within VS Code, but i cant seem to find a way to access the Nodes Index, the root its attached to or anything relatated to the whole GLTF model.

I am now assuming that the gltf2_node which is passed to the "gather_node_hook" function is currently in a "building" state and has not been added to the Root Tree?

So my questions are:

  • How can i access the nodes Logical Index (which position the Node is in the Nodes array)?
  • Is there a way for me to create Nodes "adhoc" inside that function?
  • Is there a way to access the parent node?
  • if none of the above is possible, do you have possible solutions for this?

Thanks in advance and im looking forward to some ideas!
Greetings

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