Merge /mnt/panda3d

This commit is contained in:
rdb 2015-02-11 21:43:21 +01:00
commit 886890b02f
8 changed files with 1326 additions and 44 deletions

View File

@ -7,6 +7,8 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#include "dtoolbase.h"
#include <Python.h> #include <Python.h>
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
#include <wchar.h> #include <wchar.h>
@ -71,7 +73,7 @@ int main(int argc, char *argv[]) {
char *path = getenv("PATH"); char *path = getenv("PATH");
char *result = strtok(path, ";"); char *result = strtok(path, ";");
while (result != NULL) { while (result != NULL) {
struct stat st; struct stat st;
char *ppython = (char*) malloc(strlen(result) + 13); char *ppython = (char*) malloc(strlen(result) + 13);
strcpy(ppython, result); strcpy(ppython, result);
strcat(ppython, "\\ppython.exe"); strcat(ppython, "\\ppython.exe");
@ -79,13 +81,13 @@ int main(int argc, char *argv[]) {
Py_SetPythonHome(result); Py_SetPythonHome(result);
free(ppython); free(ppython);
break; break;
} }
result = strtok(NULL, ";"); result = strtok(NULL, ";");
free(ppython); free(ppython);
} }
#endif #endif
#endif #endif
Py_Initialize(); Py_Initialize();
if (Py_VerboseFlag) { if (Py_VerboseFlag) {

View File

@ -9,15 +9,15 @@
############################################################################## ##############################################################################
import os,sys,gc import os,sys,gc
from pandac.PandaModules import * from panda3d.core import *
class EggCacher: class EggCacher:
def __init__(self, args): def __init__(self, args):
maindir = Filename.fromOsSpecific(os.getcwd()).getFullpath() maindir = Filename.fromOsSpecific(os.getcwd()).getFullpath()
ExecutionEnvironment.setEnvironmentVariable("MAIN_DIR", maindir) ExecutionEnvironment.setEnvironmentVariable("MAIN_DIR", maindir)
self.bamcache = BamCache.getGlobalPtr() self.bamcache = BamCache.getGlobalPtr()
self.pandaloader = PandaLoader() self.pandaloader = Loader()
self.loaderopts = LoaderOptions() self.loaderopts = LoaderOptions(LoaderOptions.LF_no_ram_cache)
if (self.bamcache.getActive() == 0): if (self.bamcache.getActive() == 0):
print "The model cache is not currently active." print "The model cache is not currently active."
print "You must set a model-cache-dir in your config file." print "You must set a model-cache-dir in your config file."
@ -69,12 +69,12 @@ class EggCacher:
def processFiles(self, files): def processFiles(self, files):
total = 0 total = 0
for (path,size) in files: for (path, size) in files:
total += size total += size
progress = 0 progress = 0
for (path,size) in files: for (path,size) in files:
fn = Filename.fromOsSpecific(path) fn = Filename.fromOsSpecific(path)
cached = self.bamcache.lookup(fn,"bam") cached = self.bamcache.lookup(fn, "bam")
percent = (progress * 100) / total percent = (progress * 100) / total
report = path report = path
if (self.concise): report = os.path.basename(report) if (self.concise): report = os.path.basename(report)
@ -87,6 +87,4 @@ class EggCacher:
TexturePool.releaseAllTextures() TexturePool.releaseAllTextures()
progress += size progress += size
cacher = EggCacher(sys.argv[1:]) cacher = EggCacher(sys.argv[1:])

1276
makepanda/installer.nsi Executable file

File diff suppressed because it is too large Load Diff

View File

@ -6171,7 +6171,7 @@ except:
# #
########################################################################################## ##########################################################################################
def MakeInstallerNSIS(file, fullname, smdirectory, installdir): def MakeInstallerNSIS(file, title, installdir):
if (os.path.isfile(file)): if (os.path.isfile(file)):
os.remove(file) os.remove(file)
elif (os.path.isdir(file)): elif (os.path.isdir(file)):
@ -6199,7 +6199,7 @@ def MakeInstallerNSIS(file, fullname, smdirectory, installdir):
shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file) shutil.move("direct\\src\\plugin_installer\\p3d-setup.exe", file)
return return
print("Building "+fullname+" installer. This can take up to an hour.") print("Building "+title+" installer. This can take up to an hour.")
if (COMPRESSOR != "lzma"): if (COMPRESSOR != "lzma"):
print("Note: you are using zlib, which is faster, but lzma gives better compression.") print("Note: you are using zlib, which is faster, but lzma gives better compression.")
if (os.path.exists("nsis-output.exe")): if (os.path.exists("nsis-output.exe")):
@ -6210,19 +6210,13 @@ def MakeInstallerNSIS(file, fullname, smdirectory, installdir):
nsis_defs = { nsis_defs = {
'COMPRESSOR' : COMPRESSOR, 'COMPRESSOR' : COMPRESSOR,
'NAME' : fullname, 'TITLE' : title,
'SMDIRECTORY' : smdirectory,
'INSTALLDIR' : installdir, 'INSTALLDIR' : installdir,
'OUTFILE' : os.path.join(psource, 'nsis-output.exe'), 'OUTFILE' : os.path.join(psource, 'nsis-output.exe'),
'LICENSE' : os.path.join(panda, 'LICENSE'), 'LICENSE' : os.path.join(panda, 'LICENSE'),
'LANGUAGE' : "English", 'BUILT' : panda,
'RUNTEXT' : "Visit the Panda Manual", 'SOURCE' : psource,
'IBITMAP' : "panda-install.bmp",
'UBITMAP' : "panda-install.bmp",
'PANDA' : panda,
'PYVER' : SDK["PYTHONVERSION"][6:9], 'PYVER' : SDK["PYTHONVERSION"][6:9],
'PANDACONF' : os.path.join(panda, 'etc'),
'PSOURCE' : psource,
'PYEXTRAS' : os.path.join(os.path.abspath(GetThirdpartyBase()), 'win-extras'), 'PYEXTRAS' : os.path.join(os.path.abspath(GetThirdpartyBase()), 'win-extras'),
'REGVIEW' : regview, 'REGVIEW' : regview,
} }
@ -6236,7 +6230,7 @@ def MakeInstallerNSIS(file, fullname, smdirectory, installdir):
for item in nsis_defs.items(): for item in nsis_defs.items():
cmd += ' -D%s="%s"' % item cmd += ' -D%s="%s"' % item
cmd += ' "%s"' % (os.path.join(psource, 'direct', 'src', 'directscripts', 'packpanda.nsi')) cmd += ' "%s"' % (os.path.join(psource, 'makepanda', 'installer.nsi'))
oscmd(cmd) oscmd(cmd)
os.rename("nsis-output.exe", file) os.rename("nsis-output.exe", file)
@ -6761,14 +6755,14 @@ try:
if (GetOptimize() <= 2): dbg = "-dbg" if (GetOptimize() <= 2): dbg = "-dbg"
if GetTargetArch() == 'x64': if GetTargetArch() == 'x64':
if (RUNTIME): if (RUNTIME):
MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64") MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64")
else: else:
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64") MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION+"-x64")
else: else:
if (RUNTIME): if (RUNTIME):
MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+".exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION) MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+".exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION)
else: else:
MakeInstallerNSIS("Panda3D-"+VERSION+dbg+".exe", "Panda3D", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION) MakeInstallerNSIS("Panda3D-"+VERSION+dbg+".exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION)
elif (target == 'linux'): elif (target == 'linux'):
MakeInstallerLinux() MakeInstallerLinux()
elif (target == 'darwin'): elif (target == 'darwin'):

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -343,11 +343,11 @@ try_load_file(const Filename &pathname, const LoaderOptions &options,
return result; return result;
} }
} }
}
if (loader_cat.is_debug()) { if (loader_cat.is_debug()) {
loader_cat.debug() loader_cat.debug()
<< "Model " << pathname << " not found in cache.\n"; << "Model " << pathname << " not found in cache.\n";
}
} }
bool cache_only = (options.get_flags() & LoaderOptions::LF_cache_only) != 0; bool cache_only = (options.get_flags() & LoaderOptions::LF_cache_only) != 0;

View File

@ -43,7 +43,7 @@ BamCache() :
_index_stale_since(0) _index_stale_since(0)
{ {
ConfigVariableFilename model_cache_dir ConfigVariableFilename model_cache_dir
("model-cache-dir", Filename(), ("model-cache-dir", Filename(),
PRC_DESC("The full path to a directory, local to this computer, in which " PRC_DESC("The full path to a directory, local to this computer, in which "
"model and texture files will be cached on load. If a directory " "model and texture files will be cached on load. If a directory "
"name is specified here, files may be loaded from the cache " "name is specified here, files may be loaded from the cache "
@ -51,7 +51,7 @@ BamCache() :
"especially if you are loading egg files instead of bam files, " "especially if you are loading egg files instead of bam files, "
"or if you are loading models from a shared network drive. " "or if you are loading models from a shared network drive. "
"If this is the empty string, no cache will be used.")); "If this is the empty string, no cache will be used."));
ConfigVariableInt model_cache_flush ConfigVariableInt model_cache_flush
("model-cache-flush", 30, ("model-cache-flush", 30,
PRC_DESC("This is the amount of time, in seconds, between automatic " PRC_DESC("This is the amount of time, in seconds, between automatic "
@ -138,7 +138,7 @@ set_root(const Filename &root) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: BamCache::lookup // Function: BamCache::lookup
// Access: Published // Access: Published
// Description: Looks up a file in the cache. // Description: Looks up a file in the cache.
// //
// If the file is cacheable, then regardless of whether // If the file is cacheable, then regardless of whether
// the file is found in the cache or not, this returns a // the file is found in the cache or not, this returns a
@ -163,7 +163,7 @@ lookup(const Filename &source_filename, const string &cache_extension) {
consider_flush_index(); consider_flush_index();
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
Filename source_pathname(source_filename); Filename source_pathname(source_filename);
source_pathname.make_absolute(vfs->get_cwd()); source_pathname.make_absolute(vfs->get_cwd());
@ -200,7 +200,7 @@ store(BamCacheRecord *record) {
if (_read_only) { if (_read_only) {
return false; return false;
} }
consider_flush_index(); consider_flush_index();
#ifndef NDEBUG #ifndef NDEBUG
@ -231,7 +231,7 @@ store(BamCacheRecord *record) {
emergency_read_only(); emergency_read_only();
return false; return false;
} }
if (!dout.write_header(_bam_header)) { if (!dout.write_header(_bam_header)) {
util_cat.error() util_cat.error()
<< "Unable to write to " << temp_pathname << "\n"; << "Unable to write to " << temp_pathname << "\n";
@ -247,7 +247,7 @@ store(BamCacheRecord *record) {
vfs->delete_file(temp_pathname); vfs->delete_file(temp_pathname);
return false; return false;
} }
TypeRegistry *type_registry = TypeRegistry::ptr(); TypeRegistry *type_registry = TypeRegistry::ptr();
TypeHandle texture_type = type_registry->find_type("Texture"); TypeHandle texture_type = type_registry->find_type("Texture");
if (record->get_data()->is_of_type(texture_type)) { if (record->get_data()->is_of_type(texture_type)) {
@ -257,14 +257,14 @@ store(BamCacheRecord *record) {
// Any other kinds of objects write texture references. // Any other kinds of objects write texture references.
writer.set_file_texture_mode(BamWriter::BTM_fullpath); writer.set_file_texture_mode(BamWriter::BTM_fullpath);
} }
if (!writer.write_object(record)) { if (!writer.write_object(record)) {
util_cat.error() util_cat.error()
<< "Unable to write object to " << temp_pathname << "\n"; << "Unable to write object to " << temp_pathname << "\n";
vfs->delete_file(temp_pathname); vfs->delete_file(temp_pathname);
return false; return false;
} }
if (!writer.write_object(record->get_data())) { if (!writer.write_object(record->get_data())) {
util_cat.error() util_cat.error()
<< "Unable to write object data to " << temp_pathname << "\n"; << "Unable to write object data to " << temp_pathname << "\n";
@ -354,7 +354,7 @@ flush_index() {
emergency_read_only(); emergency_read_only();
return; return;
} }
// Now atomically write the name of this index file to the index // Now atomically write the name of this index file to the index
// reference file. // reference file.
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
@ -385,6 +385,16 @@ flush_index() {
check_cache_size(); check_cache_size();
} }
////////////////////////////////////////////////////////////////////
// Function: BamCache::list_index
// Access: Published
// Description: Writes the contents of the index to standard output.
////////////////////////////////////////////////////////////////////
void BamCache::
list_index(ostream &out, int indent_level) const {
_index->write(out, indent_level);
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: BamCache::read_index // Function: BamCache::read_index
// Access: Private // Access: Private

View File

@ -73,13 +73,15 @@ PUBLISHED:
INLINE void set_read_only(bool ro); INLINE void set_read_only(bool ro);
INLINE bool get_read_only() const; INLINE bool get_read_only() const;
PT(BamCacheRecord) lookup(const Filename &source_filename, PT(BamCacheRecord) lookup(const Filename &source_filename,
const string &cache_extension); const string &cache_extension);
bool store(BamCacheRecord *record); bool store(BamCacheRecord *record);
void consider_flush_index(); void consider_flush_index();
void flush_index(); void flush_index();
void list_index(ostream &out, int indent_level = 0) const;
INLINE static BamCache *get_global_ptr(); INLINE static BamCache *get_global_ptr();
private: private:
@ -96,7 +98,7 @@ private:
void check_cache_size(); void check_cache_size();
void emergency_read_only(); void emergency_read_only();
static BamCacheIndex *do_read_index(const Filename &index_pathname); static BamCacheIndex *do_read_index(const Filename &index_pathname);
static bool do_write_index(const Filename &index_pathname, const BamCacheIndex *index); static bool do_write_index(const Filename &index_pathname, const BamCacheIndex *index);
@ -105,7 +107,7 @@ private:
PT(BamCacheRecord) read_record(const Filename &source_pathname, PT(BamCacheRecord) read_record(const Filename &source_pathname,
const Filename &cache_filename, const Filename &cache_filename,
int pass); int pass);
static PT(BamCacheRecord) do_read_record(const Filename &cache_pathname, static PT(BamCacheRecord) do_read_record(const Filename &cache_pathname,
bool read_data); bool read_data);
static string hash_filename(const string &filename); static string hash_filename(const string &filename);