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,12 +31,14 @@
namespace Config { namespace Config {
class EXPCL_DTOOLCONFIG ConfigTable { class EXPCL_DTOOLCONFIG ConfigTable {
private: private:
static ConfigTable* _instance; static ConfigTable* _instance;
public:
public:
typedef SymbolEnt SymEnt; typedef SymbolEnt SymEnt;
typedef vector_SymbolEnt Symbol; typedef vector_SymbolEnt Symbol;
private:
private:
typedef std::map<ConfigString, Symbol> SymbolTable; typedef std::map<ConfigString, Symbol> SymbolTable;
typedef std::map<ConfigString, SymbolTable> TableMap; typedef std::map<ConfigString, SymbolTable> TableMap;
SymbolTable unqualified; SymbolTable unqualified;
@ -79,9 +81,11 @@ class EXPCL_DTOOLCONFIG ConfigTable {
INLINE void CommandStubDefault(); INLINE void CommandStubDefault();
void MicroConfig(); void MicroConfig();
void GetData(); void GetData();
protected:
protected:
ConfigTable() : _initializing(true) {} ConfigTable() : _initializing(true) {}
public:
public:
static ConfigTable* Instance(); static ConfigTable* Instance();
bool AmInitializing(); bool AmInitializing();
static bool TrueOrFalse(const ConfigString& in, bool def = false); static bool TrueOrFalse(const ConfigString& in, bool def = false);

View File

@ -63,10 +63,7 @@ EXPCL_DTOOLCONFIG extern int total_num_get;
template <class GetConfig> template <class GetConfig>
class Config { class Config {
protected: public:
static void ConfigFunc();
static void Flag(bool);
public:
Config(); Config();
~Config(); ~Config();
static bool AmInitializing(); static bool AmInitializing();
@ -77,13 +74,16 @@ class Config {
static ConfigString Get(const ConfigString sym); static ConfigString Get(const ConfigString sym);
static ConfigTable::Symbol& GetAll(const ConfigString, static ConfigTable::Symbol& GetAll(const ConfigString,
ConfigTable::Symbol&); ConfigTable::Symbol&);
PUBLISHED: PUBLISHED:
static bool GetBool(const ConfigString sym, bool def = false); static bool GetBool(const ConfigString sym, bool def = false);
static int GetInt(const ConfigString sym, int def = 0); static int GetInt(const ConfigString sym, int def = 0);
static float GetFloat(const ConfigString sym, float def = 0.); static float GetFloat(const ConfigString sym, float def = 0.);
static double GetDouble(const ConfigString sym, double def = 0.); static double GetDouble(const ConfigString sym, double def = 0.);
static ConfigString GetString(const ConfigString sym, static ConfigString GetString(const ConfigString sym,
const ConfigString def = ""); const ConfigString def = "");
protected:
static void ConfigFunc();
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;