chilipeppr / widget-3dviewer

The amazing 3D viewer that is the centerpiece of ChiliPeppr. It knows how to parse Gcode to show it as a 3D representation. Has a simulator built in for the tool path. Also has numerous pubsub signals defined to enable 3rd party tools to inject 3D objects into the viewer.
16 stars 41 forks source link

Question about Toolhead and info text #17

Open ameennihad opened 6 years ago

ameennihad commented 6 years ago

Is it possible for a widget to tell 3dviewer widget to hide/show Toolhead and info text?

I tried changing the visible property of some item from this.obj3d.parent.children with no success. Where this.obj3d.parent is the scene object.

chilipeppr commented 6 years ago

Yeah, that should work with doing obj3d.parent.children. You may have to call a refresh method though. I don't remember. You could also just fully take the object out of the tree structure, but then you gotta make sure that doesn't introduce weird behavior. You could look at the code in the 3D viewer to renders the toolhead or extents text to see if there's any refresh code you could borrow.

chilipeppr commented 6 years ago

Did you do a wakeAnimate afterwards to see the refresh?

chilipeppr commented 6 years ago

If you need some new pubsub exposed out of the 3D viewer, I could get a pull request processed quickly for you. Maybe just expose 2 new pubsubs for toolhead and extents text that let you toggle hide/show.

ameennihad commented 6 years ago

I don't believe this.obj3d.parent.children is a good approach, because; if I'm not wrong; toolhead and extents text are added to the scene after the other widget creates its 3d objects. A better approach is to create new pubsub for that, it might take some time before I make a PR for that, at the moment I just disable those object from my fork of 3dviewer widget.