Commit ba9d1ea2 authored by hrchilds's avatar hrchilds
Browse files

Update from April 30, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@233 18c085ea-50e0-402c-830e-de6fd14e8384
parent 7276807a
......@@ -97,6 +97,41 @@ def applyFunctionToFrames(func, nframes, conversionargs):
filesPerThread = 1
applyFunctionToNFrames(func, filesPerThread, nframes, conversionargs)
###############################################################################
# Function: CopyFile
#
# Purpose: This function copies a file to another file on disk.
#
# Programmer: Brad Whitlock
# Date: Mon Apr 26 16:20:14 PST 2004
#
# Modifications:
#
###############################################################################
def CopyFile(srcName, destName, allowLinks):
fileCopied = 0
# If we want to create a symlink instead of copying, try it now.
if allowLinks:
try:
os.symlink(imgname, linkname)
fileCopied = 1
except:
# The OS module does not have symlink
fileCopied = 0
# Try copying the file if a symlink could not be made.
if fileCopied == 0:
try:
if os.name == "nt":
os.system("copy %s %s" % (srcName, destName))
else:
os.system("cp %s %s" % (srcName, destName))
except:
print "Could not copy %s to %s" % (srcName, destName)
###############################################################################
# Function: removeFilesHelper
#
......@@ -236,6 +271,9 @@ class MakeMovie:
# Hank Childs, Wed Mar 31 08:44:34 PST 2004
# Added frames per second.
#
# Brad Whitlock, Thu Apr 22 09:18:20 PDT 2004
# Added frameStart and frameEnd.
#
###########################################################################
def __init__(self):
......@@ -262,6 +300,8 @@ class MakeMovie:
self.outputFormat = self.OUTPUT_PPM
self.numFrames = 0
self.frameStep = 1
self.frameStart = 0
self.frameEnd = -1
self.xres = 512
self.yres = 512
self.tmpDir = os.curdir
......@@ -291,6 +331,9 @@ class MakeMovie:
# Hank Childs, Wed Mar 31 08:44:34 PST 2004
# Added -fps.
#
# Brad Whitlock, Thu Apr 22 09:18:20 PDT 2004
# Added frameStart and frameEnd.
#
###########################################################################
def PrintUsage(self):
......@@ -346,6 +389,10 @@ class MakeMovie:
print " -framestep step The number of frames to advance when going to "
print " the next frame."
print ""
print " -start frame The frame that we want to start at."
print ""
print " -end frame The frame that we want to end at."
print ""
print " -output moviename The output option lets you set the name of "
print " your movie."
print ""
......@@ -429,6 +476,9 @@ class MakeMovie:
# Hank Childs, Wed Mar 31 08:44:34 PST 2004
# Parse -fps.
#
# Brad Whitlock, Thu Apr 22 09:18:20 PDT 2004
# Added frameStart and frameEnd.
#
###########################################################################
def ProcessArguments(self):
......@@ -501,7 +551,7 @@ class MakeMovie:
if((i+1) < len(sys.argv)):
try:
self.frameStep = int(sys.argv[i+1])
if(self.frameStep < 0):
if(self.frameStep < 1):
self.frameStep = 1
except ValueError:
self.frameStep = 1
......@@ -510,6 +560,32 @@ class MakeMovie:
else:
self.PrintUsage()
sys.exit(-1)
elif(sys.argv[i] == "-start"):
if((i+1) < len(sys.argv)):
try:
self.frameStart = int(sys.argv[i+1])
if(self.frameStart < 0):
self.frameStart = 0
except ValueError:
self.frameStart = 0
print "A bad value was provided for frame start. Using a frame step of 0."
i = i + 1
else:
self.PrintUsage()
sys.exit(-1)
elif(sys.argv[i] == "-end"):
if((i+1) < len(sys.argv)):
try:
self.frameEnd = int(sys.argv[i+1])
if(self.frameEnd < 0):
self.frameEnd = 0
except ValueError:
self.frameEnd = 0
print "A bad value was provided for frame end. Using a frame end of 0."
i = i + 1
else:
self.PrintUsage()
sys.exit(-1)
elif(sys.argv[i] == "-output"):
if((i+1) < len(sys.argv)):
self.movieBase = sys.argv[i+1]
......@@ -724,6 +800,9 @@ class MakeMovie:
# I changed the animation methods so they animate using the active
# time slider.
#
# Brad Whitlock, Thu Apr 22 09:25:06 PDT 2004
# I added support for using a user-specified start, end frame.
#
###########################################################################
def GenerateFrames(self):
......@@ -748,11 +827,20 @@ class MakeMovie:
if(GetWindowInformation().cameraViewMode == 0):
ToggleCameraViewMode()
# Figure out a good value for the frameEnd.
if self.frameEnd == -1:
self.frameEnd = TimeSliderGetNStates() - 1
# If the start and end are reversed, put them in the right order.
if self.frameEnd < self.frameStart:
tmp = self.frameEnd
self.frameEnd = self.frameStart
self.frameStart = tmp
# Save an image for each frame in the animation.
self.numFrames = 0
i = 0
i = self.frameStart
drawThePlots = 0
while(i < TimeSliderGetNStates()):
while(i <= self.frameEnd):
if(SetTimeSliderState(i) == 0):
drawThePlots = 1
print "There was an error when trying to set the "\
......@@ -794,9 +882,20 @@ class MakeMovie:
# Hank Childs, Wed Mar 31 08:50:48 PST 2004
# Backed off compression even more. Allow for fps to be set as well.
#
# Brad Whitlock, Mon Apr 26 16:42:39 PST 2004
# I moved the code to symlink files into a method that copies files or
# symlinks them depending on what the operating system can do.
#
###########################################################################
def EncodeMPEGMovie(self):
# Tell the user about MPEGs on Windows.
if os.name == "nt":
print "The Windows version of VisIt does not come with an MPEG"
print "encoding program. You can use your own MPEG software to"
print "make a movie from the frames in %s" % self.tmpDir
return 0
retval = 0
self.Debug("EncodeMPEGMovie")
paramFile = "%s-mpeg_encode-params" % self.movieBase
......@@ -822,12 +921,14 @@ class MakeMovie:
# Now create symbolic links to the images at that pad rate.
linkbase = self.frameBase+"link"
linkindex = 0
doSymlink = "symlink" in dir(os)
for i in range(self.numFrames):
imgname=self.frameBase+"%04d.ppm" %(i)
imgname=self.tmpDir+self.slash+self.frameBase+"%04d.ppm" %(i)
for j in range(pad_rate):
linkname=self.tmpDir+"/"+linkbase+"%04d.ppm"%(linkindex)
linkindex += 1
os.symlink(imgname, linkname)
linkname=self.tmpDir+self.slash+linkbase+"%04d.ppm"%(linkindex)
linkindex = linkindex + 1
CopyFile(imgname, linkname, doSymlink)
nframes=pad_rate*self.numFrames
f = open(paramFile, "w")
......@@ -858,15 +959,15 @@ class MakeMovie:
r = os.system(command)
# Remove the param file.
#RemoveFile(paramFile);
RemoveFile(paramFile);
# Remove the symbolic links.
linkindex = 0
for i in range(self.numFrames):
for j in range(pad_rate):
linkname=self.tmpDir+"/"+linkbase+"%04d.ppm"%(linkindex)
#RemoveFile(linkname)
linkindex += 1
linkname=self.tmpDir+self.slash+linkbase+"%04d.ppm"%(linkindex)
RemoveFile(linkname)
linkindex = linkindex + 1
retval = (r == 0)
except IOError:
......
......@@ -272,7 +272,11 @@ CreateMessageStrings(char **lists, int *count, int nl)
// Jeremy Meredith, Thu Jun 26 10:28:28 PDT 2003
// Added the '#' wildcard.
//
// Brad Whitlock, Fri Apr 30 16:13:50 PST 2004
// I made it case insensitive on Windows.
//
// ****************************************************************************
bool
WildcardStringMatch(const string &p, const string &s)
{
......@@ -280,6 +284,28 @@ WildcardStringMatch(const string &p, const string &s)
return WildcardStringMatch(p.c_str(), s.c_str());
}
#if defined(_WIN32)
inline bool
CaseInsensitiveCompare(char p, char s)
{
bool p_uc = (p >= 'A' && p <= 'Z');
bool p_lc = (p >= 'a' && p <= 'z');
bool s_uc = (s >= 'A' && s <= 'Z');
bool s_lc = (s >= 'a' && s <= 'z');
bool retval;
if((p_uc || p_lc) && (s_uc || s_lc))
{
char pi = p_uc ? (p - 'A') : (p - 'a');
char si = s_uc ? (s - 'A') : (s - 'a');
retval = (pi == si);
}
else
retval = (p == s);
return retval;
}
#endif
bool
WildcardStringMatch(const char *p, const char *s)
{
......@@ -302,7 +328,12 @@ WildcardStringMatch(const char *p, const char *s)
// and consume one char
if ( *p == '?' ||
(*p == '#' && *s >= '0' && *s <= '9') ||
*p == *s)
#if defined(_WIN32)
CaseInsensitiveCompare(*p, *s)
#else
*p == *s
#endif
)
{
return WildcardStringMatch(&p[1], &s[1]);
}
......
......@@ -88,6 +88,9 @@ void CheckPermissions(const char *);
// Hank Childs, Mon Mar 22 09:43:33 PST 2004
// Added the ability for a format to be specified.
//
// Brad Whitlock, Fri Apr 30 16:05:42 PST 2004
// I made extension comparison be case insensitive on Windows.
//
// ****************************************************************************
avtDatabase *
......@@ -190,11 +193,19 @@ avtDatabaseFactory::FileList(const char * const * filelist, int filelistN,
{
ext = string(".") + extensions[j];
}
#if defined(_WIN32)
if (file.length() >= ext.length())
{
string fileExt(file.substr(file.length() - ext.length()));
foundMatch = (_stricmp(fileExt.c_str(), ext.c_str()) == 0);
}
#else
if (file.length() >= ext.length() &&
file.substr(file.length() - ext.length()) == ext)
{
foundMatch = true;
}
#endif
}
//
......
# Copyright 2000 - 2003
# Copyright 2000 - 2004
# The Regents of the University of California.
# All rights reserved.
#
......@@ -221,11 +221,11 @@ CPPFLAGS= -I@tmpinc@ @ENGINE_CPPFLAGS@ @CPPFLAGS@ \
COMMONLIBS=-L../../lib -lplugin -lviswindow -lplotter -lmir -lavtview \
-lavtwriter -lvisit_vtk -llightweight_visit_vtk \
-lenginerpc -lutility -lmisc -lcomm -lstate \
-lengineparstate_ser -ldbatts -lavtexceptions -lparser
-ldbatts -lavtexceptions -lparser
SERLIBS=$(COMMONLIBS) -lavtmath_ser -ldatabase_ser -lquery_ser \
-lexpressions_ser -lavtfilters_ser -lpipeline_ser \
@VTKQT_LIBS@ $(VTK_LIBS) $(X_LIBS) \
-lengineparstate_ser @VTKQT_LIBS@ $(VTK_LIBS) $(X_LIBS) \
@LIBS@ @PTHREAD_LIB@
PARLIBS=$(COMMONLIBS) -lavtmath_par -ldatabase_par -lquery_par \
......
#if defined(_WIN32)
#include <windows.h>
#include <direct.h>
#include <string.h>
#else
#include <pwd.h>
#include <dirent.h>
......@@ -1410,6 +1411,10 @@ MDServerConnection::GetPattern(const std::string &file, std::string &p) const
// key instead of a std::string key. I did this to fix sorting problems
// with the virtual filenames list.
//
// Brad Whitlock, Fri Apr 30 16:47:10 PST 2004
// I added code to prevent VisIt from creating virtual databases that
// contain .visit files.
//
// ****************************************************************************
void
......@@ -1461,7 +1466,25 @@ MDServerConnection::GetFilteredFileList(GetFileListRPC::FileList &files,
//
// See if the filename matches a pattern for related files.
//
if(GetPattern(names[i], pattern))
bool matchesPattern = GetPattern(names[i], pattern);
//
// See if the filename is a .visit file.
//
std::string visitExt(names[i]);
if(names[i].length() > 6)
visitExt = names[i].substr(names[i].length() - 6);
#if defined(_WIN32)
bool notVisItFile = (_stricmp(visitExt.c_str(), ".visit") != 0);
#else
bool notVisItFile = (visitExt != ".visit");
#endif
//
// If the file matches a pattern and it's not a .visit file
// then add it to the list of possible virtual files.
//
if(matchesPattern && notVisItFile)
{
//
// Look for the pattern in the newVirtualFiles map.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment