Pview option to read from stdin

Registered by rdb

In my opinion its an idea to have an option to make pview read the egg or bam file from stdin, simply by specifying "-" as the filename. With this it can be useful to directly pipe a converter or exporter's output to pview.

Blueprint information

Not started
Needs approval
Series goal:
Milestone target:

Related branches



(treeform) thats cool i also posted some of python command line egg tools i use for my models
could come in handy as a global set of command line egg tools to do stuff.

(drwr) The Loader already provides an interface to load from any istream: you can call Loader::load_bam_stream(cin) to read a bam file from stdin, for instance. And there are similar interfaces on most of the other systems within Panda; for instance you can use EggData::read_stream(cin) to read an egg file from stdin. The thing that we don't have is a high-level way to switch automatically into the appropriate subsystem. For instance, there's Loader::load_sync() to load an arbitrary filename, which automatically loads either a bam file or an egg file (or whatever else) as appropriate, but there's no way to do this with an istream. And that's not surprising, because we make the determination of which subsystem to call based on the filename extension. Not all of these streams have a magic number, so it would be difficult to determine automatically what kind of data was being supplied, whether it was an egg file, a bam file, or some other kind of file.

If we wanted to provide this functionality to pview, we would probably just limit it to egg files (or later, to dae files). And this means writing custom code in pview to invoke EggData, rather than hooking it into the Loader somehow.

(rdb) Ah, OK. Shouldn't we add this on the LoaderFileTypeEgg level, or even on the EggData level? (the read function would check if the filename is "-" and then call the appropriate method to read from cin.)


Work Items

This blueprint contains Public information 
Everyone can see this information.