formatting

This commit is contained in:
Dave Schuyler 2003-10-23 03:17:34 +00:00
parent 1cbf9ece5f
commit f0b627a5e4
6 changed files with 120 additions and 108 deletions

View File

@ -17,14 +17,17 @@ class Loader:
# special methods # special methods
def __init__(self, base): def __init__(self, base):
"""__init__(self) """
Loader constructor""" Loader constructor
"""
self.base = base self.base = base
self.loader = PandaLoader() self.loader = PandaLoader()
# model loading funcs # model loading funcs
def loadModel(self, modelPath, fMakeNodeNamesUnique = 0): def loadModel(self, modelPath, fMakeNodeNamesUnique = 0):
"""loadModel(self, string) """
modelPath is a string.
Attempt to load a model from given file path, return Attempt to load a model from given file path, return
a nodepath to the model if successful or None otherwise.""" a nodepath to the model if successful or None otherwise."""
assert(Loader.notify.debug("Loading model: %s" % (modelPath) )) assert(Loader.notify.debug("Loading model: %s" % (modelPath) ))
@ -40,7 +43,9 @@ class Loader:
return nodePath return nodePath
def loadModelOnce(self, modelPath): def loadModelOnce(self, modelPath):
"""loadModelOnce(self, string) """
modelPath is a string.
Attempt to load a model from modelPool, if not present Attempt to load a model from modelPool, if not present
then attempt to load it from disk. Return a nodepath to then attempt to load it from disk. Return a nodepath to
the model if successful or None otherwise""" the model if successful or None otherwise"""
@ -94,7 +99,9 @@ class Loader:
return None return None
def loadModelNode(self, modelPath): def loadModelNode(self, modelPath):
"""loadModelNode(self, string) """
modelPath is a string.
This is like loadModelOnce in that it loads a model from the This is like loadModelOnce in that it loads a model from the
modelPool, but it does not then instance it to hidden and it modelPool, but it does not then instance it to hidden and it
returns a Node instead of a NodePath. This is particularly returns a Node instead of a NodePath. This is particularly
@ -111,7 +118,8 @@ class Loader:
return ModelPool.loadModel(modelPath) return ModelPool.loadModel(modelPath)
def unloadModel(self, modelPath): def unloadModel(self, modelPath):
"""unloadModel(self, string) """
modelPath is a string.
""" """
assert(Loader.notify.debug("Unloading model: %s" % (modelPath))) assert(Loader.notify.debug("Unloading model: %s" % (modelPath)))
ModelPool.releaseModel(modelPath) ModelPool.releaseModel(modelPath)
@ -124,7 +132,8 @@ class Loader:
minFilter = None, magFilter = None, minFilter = None, magFilter = None,
anisotropicDegree = None, anisotropicDegree = None,
lineHeight = None): lineHeight = None):
"""loadFont(self, string) """
modelPath is a string.
This loads a special model as a TextFont object, for rendering This loads a special model as a TextFont object, for rendering
text with a TextNode. A font file must be either a special text with a TextNode. A font file must be either a special
@ -193,7 +202,9 @@ class Loader:
# texture loading funcs # texture loading funcs
def loadTexture(self, texturePath, alphaPath = None): def loadTexture(self, texturePath, alphaPath = None):
"""loadTexture(self, string) """
texturePath is a string.
Attempt to load a texture from the given file path using Attempt to load a texture from the given file path using
TexturePool class. Returns None if not found""" TexturePool class. Returns None if not found"""
@ -210,8 +221,6 @@ class Loader:
return texture return texture
def unloadTexture(self, texture): def unloadTexture(self, texture):
"""unloadTexture(self, texture)
"""
assert(Loader.notify.debug("Unloading texture: %s" % (texture) )) assert(Loader.notify.debug("Unloading texture: %s" % (texture) ))
TexturePool.releaseTexture(texture) TexturePool.releaseTexture(texture)

View File

@ -19,7 +19,7 @@
#ifndef CONFIGTABLE_H #ifndef CONFIGTABLE_H
#define CONFIGTABLE_H #define CONFIGTABLE_H
#include <dtoolbase.h> #include "dtoolbase.h"
#include "config_setup.h" #include "config_setup.h"
#include "config_dconfig.h" #include "config_dconfig.h"
@ -31,66 +31,70 @@
namespace Config { namespace Config {
class EXPCL_DTOOLCONFIG ConfigTable { class EXPCL_DTOOLCONFIG ConfigTable {
private: private:
static ConfigTable* _instance; static ConfigTable* _instance;
public:
typedef SymbolEnt SymEnt;
typedef vector_SymbolEnt Symbol;
private:
typedef std::map<ConfigString, Symbol> SymbolTable;
typedef std::map<ConfigString, SymbolTable> TableMap;
SymbolTable unqualified;
TableMap qualified;
bool _initializing;
bool configdbg;
bool readargs;
bool readenvs;
ConfigString pathsep;
ConfigString filesep;
ConfigString configname;
ConfigString configsuffix;
ConfigString configargs;
ConfigString configpath;
ConfigString configcmt;
ConfigString argsuffix;
ConfigString commandstub;
static void CropString(ConfigString& S); public:
void DeComment(ConfigString& S); typedef SymbolEnt SymEnt;
bool IsComment(const ConfigString&); typedef vector_SymbolEnt Symbol;
static void UpCase(ConfigString&);
ConfigString NextWord(const ConfigString& S); private:
ConfigString PopNextWord(ConfigString& S); typedef std::map<ConfigString, Symbol> SymbolTable;
void ParseConfigFile(istream&, const ConfigString&); typedef std::map<ConfigString, SymbolTable> TableMap;
void ReadConfigFile(); SymbolTable unqualified;
void ParseCommandEnv(ConfigString&, const ConfigString&); TableMap qualified;
void ParseArgs(); bool _initializing;
INLINE void ConfigDbgDefault(); bool configdbg;
INLINE void ReadArgsDefault(); bool readargs;
INLINE void ReadEnvsDefault(); bool readenvs;
INLINE void PathSepDefault(); ConfigString pathsep;
INLINE void FileSepDefault(); ConfigString filesep;
INLINE void ConfigNameDefault(); ConfigString configname;
INLINE void ConfigSuffixDefault(); ConfigString configsuffix;
INLINE void ConfigArgsDefault(); ConfigString configargs;
INLINE void ConfigPathDefault(); ConfigString configpath;
INLINE void ConfigCmtDefault(); ConfigString configcmt;
INLINE void ArgSuffixDefault(); ConfigString argsuffix;
INLINE void CommandStubDefault(); ConfigString commandstub;
void MicroConfig();
void GetData(); static void CropString(ConfigString& S);
protected: void DeComment(ConfigString& S);
ConfigTable() : _initializing(true) {} bool IsComment(const ConfigString&);
public: static void UpCase(ConfigString&);
static ConfigTable* Instance(); ConfigString NextWord(const ConfigString& S);
bool AmInitializing(); ConfigString PopNextWord(ConfigString& S);
static bool TrueOrFalse(const ConfigString& in, bool def = false); void ParseConfigFile(istream&, const ConfigString&);
bool Defined(const ConfigString& sym, const ConfigString qual=""); void ReadConfigFile();
SymEnt Get(const ConfigString& sym, const ConfigString qual = ""); void ParseCommandEnv(ConfigString&, const ConfigString&);
const Symbol& GetSym(const ConfigString& sym, void ParseArgs();
const ConfigString qual = ""); INLINE void ConfigDbgDefault();
INLINE ConfigString GetConfigPath() const; INLINE void ReadArgsDefault();
INLINE bool IsConfigDbg() { return configdbg; }; INLINE void ReadEnvsDefault();
INLINE void PathSepDefault();
INLINE void FileSepDefault();
INLINE void ConfigNameDefault();
INLINE void ConfigSuffixDefault();
INLINE void ConfigArgsDefault();
INLINE void ConfigPathDefault();
INLINE void ConfigCmtDefault();
INLINE void ArgSuffixDefault();
INLINE void CommandStubDefault();
void MicroConfig();
void GetData();
protected:
ConfigTable() : _initializing(true) {}
public:
static ConfigTable* Instance();
bool AmInitializing();
static bool TrueOrFalse(const ConfigString& in, bool def = false);
bool Defined(const ConfigString& sym, const ConfigString qual="");
SymEnt Get(const ConfigString& sym, const ConfigString qual = "");
const Symbol& GetSym(const ConfigString& sym,
const ConfigString qual = "");
INLINE ConfigString GetConfigPath() const;
INLINE bool IsConfigDbg() { return configdbg; };
}; };
#include "configTable.I" #include "configTable.I"

View File

@ -63,27 +63,27 @@ EXPCL_DTOOLCONFIG extern int total_num_get;
template <class GetConfig> template <class GetConfig>
class Config { class Config {
protected: public:
static void ConfigFunc(); Config();
static void Flag(bool); ~Config();
public: static bool AmInitializing();
Config(); static ConfigString Name();
~Config(); static bool Flag();
static bool AmInitializing(); static void Init();
static ConfigString Name(); static bool Defined(const ConfigString& sym);
static bool Flag(); static ConfigString Get(const ConfigString sym);
static void Init(); static ConfigTable::Symbol& GetAll(const ConfigString,
static bool Defined(const ConfigString& sym); ConfigTable::Symbol&);
static ConfigString Get(const ConfigString sym); PUBLISHED:
static ConfigTable::Symbol& GetAll(const ConfigString, static bool GetBool(const ConfigString sym, bool def = false);
ConfigTable::Symbol&); static int GetInt(const ConfigString sym, int def = 0);
PUBLISHED: static float GetFloat(const ConfigString sym, float def = 0.);
static bool GetBool(const ConfigString sym, bool def = false); static double GetDouble(const ConfigString sym, double def = 0.);
static int GetInt(const ConfigString sym, int def = 0); static ConfigString GetString(const ConfigString sym,
static float GetFloat(const ConfigString sym, float def = 0.); const ConfigString def = "");
static double GetDouble(const ConfigString sym, double def = 0.); protected:
static ConfigString GetString(const ConfigString sym, static void ConfigFunc();
const ConfigString def = ""); static void Flag(bool);
}; };
// Implementation follows // Implementation follows

View File

@ -56,8 +56,9 @@ NotifyCategory(const string &fullname, const string &basename,
if (!config_name.empty()) { if (!config_name.empty()) {
string severity_name; string severity_name;
if (!config_notify.AmInitializing()) if (!config_notify.AmInitializing()) {
severity_name = config_notify.GetString(config_name, ""); severity_name = config_notify.GetString(config_name, "");
}
if (!severity_name.empty()) { if (!severity_name.empty()) {
// The user specified a particular severity for this category at // The user specified a particular severity for this category at
// config time. Use it. // config time. Use it.

View File

@ -16,20 +16,20 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include <bamReader.h> #include "bamReader.h"
#include <bamWriter.h> #include "bamWriter.h"
#include <boundingLine.h> #include "boundingLine.h"
#include <boundingSphere.h> #include "boundingSphere.h"
#include <datagram.h> #include "datagram.h"
#include <datagramIterator.h> #include "datagramIterator.h"
#include <geom.h> #include "geom.h"
#include <geomLinestrip.h> #include "geomLinestrip.h"
#include <geomNode.h> #include "geomNode.h"
#include <pointerToArray.h> #include "pointerToArray.h"
#include <lens.h> #include "lens.h"
#include <lensNode.h> #include "lensNode.h"
#include <renderRelation.h> #include "renderRelation.h"
#include <transformTransition.h> #include "transformTransition.h"
#include "collisionEntry.h" #include "collisionEntry.h"
#include "collisionHandler.h" #include "collisionHandler.h"

View File

@ -76,7 +76,6 @@ handle_entries() {
<< get_type() << " doesn't know about " << get_type() << " doesn't know about "
<< *from_node << ", disabling.\n"; << *from_node << ", disabling.\n";
okflag = false; okflag = false;
} else { } else {
ColliderDef &def = (*ci).second; ColliderDef &def = (*ci).second;
if (!def.is_valid()) { if (!def.is_valid()) {
@ -84,7 +83,6 @@ handle_entries() {
<< "Removing invalid collider " << *from_node << " from " << "Removing invalid collider " << *from_node << " from "
<< get_type() << "\n"; << get_type() << "\n";
_colliders.erase(ci); _colliders.erase(ci);
} else { } else {
// Get the maximum height for all collisions with this node. // Get the maximum height for all collisions with this node.
bool got_max = false; bool got_max = false;