markaren / threepp

C++20 port of three.js (r129)
MIT License
581 stars 50 forks source link

object name query in the scene: what is the default name of the auto object? #225

Closed asmwarrior closed 4 months ago

asmwarrior commented 4 months ago

Hi, I see some code below:

https://github.com/markaren/threepp/blob/258708f68cde3fbedbc8ae005e7eca1406fae4b0/examples/projects/Crane3R/Crane3R.cpp#L78-L98

Now, I see those objects were loaded by the below code:

https://github.com/markaren/threepp/blob/258708f68cde3fbedbc8ae005e7eca1406fae4b0/examples/projects/Crane3R/Crane3R.cpp#L99-L129

Does it mean that when I use a statement like auto part1, and later I add the variable part1 to the scene, the object part1 will have a default name of "part1"? So that I can query the object by searching the text string "part1"?

Thanks.

EDIT:

     part1->name = "part1"; 
     part2->name = "part2"; 
     part3->name = "part3"; 

Oh, I see the name field is set explicitly, so if I do not set the filed, what is the default name?

markaren commented 4 months ago

The default is the empty string.

asmwarrior commented 4 months ago

The default is the empty string.

OK, I see. Thanks.