Merge pull request #981 from rhabacker/3.6-add-plugin-env-support
Add support for showing environment variables provided by osg plugins
This commit is contained in:
commit
6b95718d65
@ -40,6 +40,7 @@ class ReaderWriterInfo : public osg::Referenced
|
|||||||
ReaderWriter::FormatDescriptionMap protocols;
|
ReaderWriter::FormatDescriptionMap protocols;
|
||||||
ReaderWriter::FormatDescriptionMap extensions;
|
ReaderWriter::FormatDescriptionMap extensions;
|
||||||
ReaderWriter::FormatDescriptionMap options;
|
ReaderWriter::FormatDescriptionMap options;
|
||||||
|
ReaderWriter::FormatDescriptionMap environment;
|
||||||
ReaderWriter::Features features;
|
ReaderWriter::Features features;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -63,6 +63,9 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
|||||||
/** Return which list of file extensions supported by ReaderWriter. */
|
/** Return which list of file extensions supported by ReaderWriter. */
|
||||||
virtual const FormatDescriptionMap& supportedOptions() const { return _supportedOptions; }
|
virtual const FormatDescriptionMap& supportedOptions() const { return _supportedOptions; }
|
||||||
|
|
||||||
|
/** Return which list of file environment variables supported by ReaderWriter. */
|
||||||
|
virtual const FormatDescriptionMap& supportedEnvironment() const { return _supportedEnvironment; }
|
||||||
|
|
||||||
/** Return true if ReaderWriter accepts specified file extension.*/
|
/** Return true if ReaderWriter accepts specified file extension.*/
|
||||||
virtual bool acceptsExtension(const std::string& /*extension*/) const;
|
virtual bool acceptsExtension(const std::string& /*extension*/) const;
|
||||||
|
|
||||||
@ -282,11 +285,15 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
|||||||
* Please note, this should usually only be used internally by subclasses of ReaderWriter. */
|
* Please note, this should usually only be used internally by subclasses of ReaderWriter. */
|
||||||
void supportsOption(const std::string& opt, const std::string& description);
|
void supportsOption(const std::string& opt, const std::string& description);
|
||||||
|
|
||||||
|
/** Specify env string as a supported environment string. */
|
||||||
|
void supportsEnvironment(const std::string& opt, const std::string& description);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
FormatDescriptionMap _supportedProtocols;
|
FormatDescriptionMap _supportedProtocols;
|
||||||
FormatDescriptionMap _supportedExtensions;
|
FormatDescriptionMap _supportedExtensions;
|
||||||
FormatDescriptionMap _supportedOptions;
|
FormatDescriptionMap _supportedOptions;
|
||||||
|
FormatDescriptionMap _supportedEnvironment;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ bool osgDB::queryPlugin(const std::string& fileName, ReaderWriterInfoList& infoL
|
|||||||
rwi->protocols = rw->supportedProtocols();
|
rwi->protocols = rw->supportedProtocols();
|
||||||
rwi->extensions = rw->supportedExtensions();
|
rwi->extensions = rw->supportedExtensions();
|
||||||
rwi->options = rw->supportedOptions();
|
rwi->options = rw->supportedOptions();
|
||||||
|
rwi->environment = rw->supportedEnvironment();
|
||||||
rwi->features = rw->supportedFeatures();
|
rwi->features = rw->supportedFeatures();
|
||||||
|
|
||||||
infoList.push_back(rwi.get());
|
infoList.push_back(rwi.get());
|
||||||
@ -153,6 +154,13 @@ bool osgDB::outputPluginDetails(std::ostream& out, const std::string& fileName)
|
|||||||
if (fdm_itr->first.length()>longestOptionLength) longestOptionLength = fdm_itr->first.length();
|
if (fdm_itr->first.length()>longestOptionLength) longestOptionLength = fdm_itr->first.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(fdm_itr = info.environment.begin();
|
||||||
|
fdm_itr != info.environment.end();
|
||||||
|
++fdm_itr)
|
||||||
|
{
|
||||||
|
if (fdm_itr->first.length()>longestOptionLength) longestOptionLength = fdm_itr->first.length();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int padLength = longestOptionLength+4;
|
unsigned int padLength = longestOptionLength+4;
|
||||||
|
|
||||||
for(fdm_itr = info.protocols.begin();
|
for(fdm_itr = info.protocols.begin();
|
||||||
@ -175,6 +183,13 @@ bool osgDB::outputPluginDetails(std::ostream& out, const std::string& fileName)
|
|||||||
{
|
{
|
||||||
out<<" options : "<<padwithspaces(fdm_itr->first, padLength)<<fdm_itr->second<<std::endl;
|
out<<" options : "<<padwithspaces(fdm_itr->first, padLength)<<fdm_itr->second<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(fdm_itr = info.environment.begin();
|
||||||
|
fdm_itr != info.environment.end();
|
||||||
|
++fdm_itr)
|
||||||
|
{
|
||||||
|
out<<" environment: "<<padwithspaces(fdm_itr->first, padLength)<<fdm_itr->second<<std::endl;
|
||||||
|
}
|
||||||
out<<" }"<<std::endl;
|
out<<" }"<<std::endl;
|
||||||
}
|
}
|
||||||
out<<"}"<<std::endl<<std::endl;
|
out<<"}"<<std::endl<<std::endl;
|
||||||
|
@ -128,6 +128,11 @@ void ReaderWriter::supportsOption(const std::string& fmt, const std::string& des
|
|||||||
_supportedOptions[fmt] = description;
|
_supportedOptions[fmt] = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReaderWriter::supportsEnvironment(const std::string& fmt, const std::string& description)
|
||||||
|
{
|
||||||
|
_supportedEnvironment[fmt] = description;
|
||||||
|
}
|
||||||
|
|
||||||
ReaderWriter::Features ReaderWriter::supportedFeatures() const
|
ReaderWriter::Features ReaderWriter::supportedFeatures() const
|
||||||
{
|
{
|
||||||
int features = FEATURE_NONE;
|
int features = FEATURE_NONE;
|
||||||
|
@ -388,11 +388,12 @@ ReaderWriterCURL::ReaderWriterCURL()
|
|||||||
|
|
||||||
supportsExtension("curl","Pseudo file extension, used to select curl plugin.");
|
supportsExtension("curl","Pseudo file extension, used to select curl plugin.");
|
||||||
supportsExtension("*","Passes all read files to other plugins to handle actual model loading.");
|
supportsExtension("*","Passes all read files to other plugins to handle actual model loading.");
|
||||||
supportsOption("OSG_CURL_PROXY","Specify the http proxy.");
|
|
||||||
supportsOption("OSG_CURL_PROXYPORT","Specify the http proxy port.");
|
supportsEnvironment("OSG_CURL_PROXY","Specify the http proxy.");
|
||||||
supportsOption("OSG_CURL_CONNECTTIMEOUT","Specify the connection timeout duration in seconds [default = 0 = not set].");
|
supportsEnvironment("OSG_CURL_PROXYPORT","Specify the http proxy port.");
|
||||||
supportsOption("OSG_CURL_TIMEOUT","Specify the timeout duration of the whole transfer in seconds [default = 0 = not set].");
|
supportsEnvironment("OSG_CURL_CONNECTTIMEOUT","Specify the connection timeout duration in seconds [default = 0 = not set].");
|
||||||
supportsOption("OSG_CURL_SSL_VERIFYPEER","Specify ssl verification peer [default = 1 = set].");
|
supportsEnvironment("OSG_CURL_TIMEOUT","Specify the timeout duration of the whole transfer in seconds [default = 0 = not set].");
|
||||||
|
supportsEnvironment("OSG_CURL_SSL_VERIFYPEER","Specify ssl verification peer [default = 1 = set].");
|
||||||
}
|
}
|
||||||
|
|
||||||
ReaderWriterCURL::~ReaderWriterCURL()
|
ReaderWriterCURL::~ReaderWriterCURL()
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
ReaderWriterTXP()
|
ReaderWriterTXP()
|
||||||
{
|
{
|
||||||
supportsExtension("txp","Terrapage txp format");
|
supportsExtension("txp","Terrapage txp format");
|
||||||
|
supportsEnvironment("OSG_TXP_DEFAULT_MAX_ANISOTROPY", "default value to use when setting up textures");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* className() const
|
virtual const char* className() const
|
||||||
|
Loading…
Reference in New Issue
Block a user