Under the hood of Canvas: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 36: Line 36:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>
To selectively remove data from a Canvas, just put it into a separate top-level group - and use .hide() to make it invisible or .clear() to clear it out.
Note that you can also use these two in combination to selectively update those data structures - which helps reduce the updating overhead, i.e. no unnecessary reallocation taking place.
In summary, the Canvas system really is a scenegraph - so if you have something that you'd like to be able to hide/show, clear or change selectively, just put it into a separate group and use that group as the "handle" to deal with the whole shebang (it really is a osg::Group under the hood, i.e. an osg::Transform IIRC, which is a child class inheriting from ::Group)<ref>{{cite web
  |url    =  https://forum.flightgear.org/viewtopic.php?p=297688#p297688
  |title  =  <nowiki> Re: Nasal must go </nowiki>
  |author =  <nowiki> Hooray </nowiki>
  |date  =  Oct 29th, 2016
  |added  =  Oct 29th, 2016
  |script_version = 0.40
  }}</ref>


== Related ==
== Related ==
== References ==
== References ==
{{Appendix}}
{{Appendix}}

Navigation menu