Jump to content

scene.pick, mesh names, FBX Exporter


ProfessorF
 Share

Recommended Posts

Okay, so I exported a house interior created in Maya using FBX Exporter. This is what the scene looks like in Babylon.js:

post-5799-0-06017400-1388450591.png

 

I use scene.pick to select objects in the room for turning on and off (like lights).  

 

Problem: *everything* I select is named: #0 or #N (where N is 0,1, 2...)

 

For example, if I click on the TV and use

 

picked = scene.pick(...) to get the mesh, then picked.pickedMesh.name is "#0" 

 

Solution: To get the actual name of the mesh, I need to do:

 

picked.pickedMesh.parent.name, which returns "TV_A", which is correct.

 

DIGGING

 

The culprit is in the XNAExporter.cs.  A dummy mesh is created with the correct name TV_A, but then the actual meshes are created with the names: #0, #1, etc...  Here is the line that does it:

 

                    mesh.AddPart(indexName.ToString(), vertices.ToList(), indices.Select(i => (int)i).ToList());
 
This line is in two places, BUT if this were changed to:
 
                    mesh.AddPart(modelMesh.Name+"#"+ indexName.ToString(), vertices.ToList(), indices.Select(i => (int)i).ToList());
 
 
Then scene.pick could return TV_A#0, TV_A#1, etc.  <== This is easier to check than having to go to the parent.
 
QUESTIONS
 
1) Does the Blender exporter have the same behavior?  If so, I think that should be changed too.
2) Could you change the code in XNAExporter.cs (two places) to pre-pend the mesh name before the #N?
 
Thanks,
 
- Nick
 

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...