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

Clean up after use #36

Closed
ShaneTex opened this issue Aug 11, 2020 · 9 comments
Closed

Clean up after use #36

ShaneTex opened this issue Aug 11, 2020 · 9 comments
Assignees
Labels
🍏 feature New feature or request 🙏 suggestion Suggestion to consider
Milestone

Comments

@ShaneTex
Copy link

I have in my process a way to load new models on demand, but there will be a set for each location via xml, is there a way to clean up or dispose of all models, prior to loading new ones? I did see a way to completed dispose of tb, but only if you you navigating away from the site, is there a way to keep it clean as you go, and only clean up sets of models.

@jscastro76 jscastro76 added 🍏 feature New feature or request 🙏 suggestion Suggestion to consider labels Aug 11, 2020
@jscastro76 jscastro76 added this to the v2.0.5. milestone Aug 11, 2020
@jscastro76
Copy link
Owner

You can remove now the models one by one using tb.remove. I’m gonna try to solve this one and #35 at the same time with the method tb.clear, I’ve been testing with different loop methods and I will do a while (tb.world.children.length > 0) and in the loop do a tb.remove(model).
I tried with for, forEach and traverse and all of them are not suitable to remove items in the collection that is being looped, so while would be my best bet

@ShaneTex
Copy link
Author

@jscastro76 That sounds great, thanks

@ShaneTex
Copy link
Author

@jscastro76 Also, is there a way to turn off the wireframe around a model, but still be able to select, and highlight, etc.

@jscastro76
Copy link
Owner

@jscastro76 Also, is there a way to turn off the wireframe around a model, but still be able to select, and highlight, etc.

you can set obj.boundingBox and obj.boundingBoxShadow to null once the object is loaded. I have a pending issue open #3 to make the color of these bounding boxes configurable

@ShaneTex
Copy link
Author

Gotcha, sould would I use this to remove or clean all:
while (tb.world.children.length > 0) {
tb.remove(tb.world.children[0]);
}

@ShaneTex
Copy link
Author

On the bounding box, thanks that is great

@jscastro76
Copy link
Owner

Gotcha, sould would I use this to remove or clean all:
while (tb.world.children.length > 0) {
tb.remove(tb.world.children[0]);
}

I'm working quickly to deliver v.2.0.5 with these changes done, so you will only need to call tb.setStyle instead of map.setStyle.

On the bounding box, thanks that is great

I have no time to add issue #3 for this release, so you should set those to null in every object loaded, so I would do something like this...

tb.loadObj(options, function (model) {
	model.setCoords(originCoords);
	model.boundingBox = null; //this removes the yellow/green box
	model.boundingBoxShadow = null; //this removes the black floor projection box
	tb.add(model);
})

@ShaneTex
Copy link
Author

Awesome, will do.

@ShaneTex
Copy link
Author

that works perfectly

@jscastro76 jscastro76 self-assigned this Aug 12, 2020
jscastro76 added a commit that referenced this issue Aug 14, 2020
Enhacements: #28, #30, #31, #33, #34, #36, #37
Bugs: #32, #35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍏 feature New feature or request 🙏 suggestion Suggestion to consider
Projects
None yet
Development

No branches or pull requests

2 participants