Merge branch 'release/1.9.x'

This commit is contained in:
rdb 2016-09-28 00:14:21 +02:00
commit 4381412d23
9 changed files with 159 additions and 267 deletions

View File

@ -37,6 +37,9 @@ This issue fixes several bugs that were still found in 1.9.2.
* Fix asyncFlattenStrong called on nodes without parent
* Fix is_playing() check when playing an animation backwards
* Windows installer no longer clears %PATH% if longer than 1024 chars
* Fix inoperative -tbn/-tbnall/-tbnauto options in egg-optchar
* Fix tinydisplay texture errors on shutdown
* Fix mipmap filtering issues in tinydisplay renderer
------------------------ RELEASE 1.9.2 ------------------------

View File

@ -944,17 +944,16 @@ Function AddToPath
Goto AddToPath_done
AddToPath_NT:
ClearErrors
ReadRegStr $1 HKCU "Environment" "PATH"
Call IsUserAdmin
Pop $3
; If this is an Admin user, use the System env. variable instead of the user's env. variable
StrCmp $3 1 0 +2
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
; If the PATH string is empty, WATCH OUT. This probably means
; the PATH surpassed NSIS' string limit. Don't overwrite it!
; The only thing we can do is display an error message.
StrCmp $1 "" AddToPath_EmptyError
; If we reached an error, WATCH OUT. Either this means that
; the registry key did not exist, or that it didn't fit in
; NSIS' string limit. If the latter, we have to be very
; careful not to overwrite the user's PATH.
IfErrors AddToPath_Error
DetailPrint "Current PATH value is set to $1"
StrCmp $1 "" AddToPath_NTAddPath
; Pull off the last character of the PATH string. If it's a semicolon,
; we don't need to add another one, so jump to the section where we
@ -962,7 +961,20 @@ Function AddToPath
StrCpy $2 $1 1 -1
StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
AddToPath_EmptyError:
AddToPath_Error:
DetailPrint "Encountered error reading PATH variable."
; Does the variable exist? If it doesn't, then the
; error happened because we need to create the
; variable. If it does, then we failed to read it
; because we reached NSIS' string limit.
StrCpy $3 0
AddToPath_loop:
EnumRegValue $4 HKCU "Environment" $3
StrCmp $4 "PATH" AddToPath_ExceedLimit
StrCmp $4 "" AddToPath_NTAddPath
IntOp $3 $3 + 1
Goto AddToPath_loop
AddToPath_ExceedLimit:
MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "Your PATH environment variable is too long! Please remove extraneous entries before proceeding. Panda3D needs to add the following the PATH so that the Panda3D utilities and libraries can be located correctly.$\n$\n$0$\n$\nIf you wish to add Panda3D to the path yourself, choose Ignore." IDIGNORE AddToPath_done IDRETRY AddToPath_NT
SetDetailsPrint both
DetailPrint "Cannot append to PATH - variable is likely too long."
@ -973,16 +985,7 @@ Function AddToPath
Goto AddToPath_NTAddPath
AddToPath_NTAddPath:
StrCpy $0 "$1$0"
Goto AddToPath_NTdoIt
AddToPath_NTdoIt:
Call IsUserAdmin
Pop $3
StrCmp $3 1 0 NotAdmin
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
Goto AddToPath_done
NotAdmin:
WriteRegExpandStr HKCU "Environment" "PATH" $0
WriteRegExpandStr HKCU "Environment" "PATH" $0
AddToPath_done:
Pop $3
Pop $2
@ -1033,42 +1036,40 @@ Function RemoveFromPath
Goto unRemoveFromPath_done
unRemoveFromPath_NT:
Push $0
StrLen $2 $0
Call IsUserAdmin
Pop $5
StrCmp $5 1 0 NotAdmin
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push $1
Push $0
Call StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
Goto unRemoveFromPath_done
ReadRegStr $1 HKCU "Environment" "PATH"
Push $1
Push $0
Call StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_NT_System
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKCU "Environment" "PATH" $3
NotAdmin:
ReadRegStr $1 HKCU "Environment" "PATH"
Push $1
Push $0
Call StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKCU "Environment" "PATH" $3
unRemoveFromPath_NT_System:
Pop $0
StrLen $2 $0
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push $1
Push $0
Call StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
unRemoveFromPath_done:
Pop $5
@ -1119,42 +1120,40 @@ Function un.RemoveFromPath
Goto unRemoveFromPath_done
unRemoveFromPath_NT:
Push $0
StrLen $2 $0
Call un.IsUserAdmin
Pop $5
StrCmp $5 1 0 NotAdmin
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push $1
Push $0
Call un.StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
Goto unRemoveFromPath_done
ReadRegStr $1 HKCU "Environment" "PATH"
Push $1
Push $0
Call un.StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_NT_System
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKCU "Environment" "PATH" $3
NotAdmin:
ReadRegStr $1 HKCU "Environment" "PATH"
Push $1
Push $0
Call un.StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKCU "Environment" "PATH" $3
unRemoveFromPath_NT_System:
Pop $0
StrLen $2 $0
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push $1
Push $0
Call un.StrStr ; Find $0 in $1
Pop $0 ; pos of our dir
IntCmp $0 -1 unRemoveFromPath_done
; else, it is in path
StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
StrLen $0 $1
StrCpy $1 $1 $0 $2
StrCpy $3 "$3$1"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
unRemoveFromPath_done:
Pop $5
@ -1165,148 +1164,6 @@ Function un.RemoveFromPath
Pop $0
FunctionEnd
; From: http://nsis.sourceforge.net/archive/nsisweb.php?page=329&instances=0,11
; Localized by Ben Johnson (bkj@andrew.cmu.edu)
Function IsUserAdmin
Push $0
Push $1
Push $2
Push $3
Call IsNT
Pop $1
ClearErrors
UserInfo::GetName
;IfErrors Win9x
Pop $2
UserInfo::GetAccountType
Pop $3
; Compare results of IsNT with "1"
StrCmp $1 1 0 NotNT
;This is NT
StrCmp $3 "Admin" 0 NotAdmin
; Observation: I get here when running Win98SE. (Lilla)
; The functions UserInfo.dll looks for are there on Win98 too,
; but just don't work. So UserInfo.dll, knowing that admin isn't required
; on Win98, returns admin anyway. (per kichik)
; MessageBox MB_OK 'User "$R1" is in the Administrators group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
Return
NotAdmin:
; You should still check for an empty string because the functions
; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
#StrCmp $2 "" Win9x
#StrCpy $0 0
;MessageBox MB_OK 'User "$2" is in the "$3" group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 0
Return
;Because we use IsNT, this is redundant.
#Win9x:
# ; comment/message below is by UserInfo.nsi author:
# ; This one means you don't need to care about admin or
# ; not admin because Windows 9x doesn't either
# ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
# StrCpy $0 0
NotNT:
;We are not NT
;Win9x doesn't have "admin" users.
;Let the user do whatever.
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
FunctionEnd
Function un.IsUserAdmin
Push $0
Push $1
Push $2
Push $3
Call un.IsNT
Pop $1
ClearErrors
UserInfo::GetName
;IfErrors Win9x
Pop $2
UserInfo::GetAccountType
Pop $3
; Compare results of IsNT with "1"
StrCmp $1 1 0 NotNT
;This is NT
StrCmp $3 "Admin" 0 NotAdmin
; Observation: I get here when running Win98SE. (Lilla)
; The functions UserInfo.dll looks for are there on Win98 too,
; but just don't work. So UserInfo.dll, knowing that admin isn't required
; on Win98, returns admin anyway. (per kichik)
; MessageBox MB_OK 'User "$R1" is in the Administrators group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
Return
NotAdmin:
; You should still check for an empty string because the functions
; UserInfo.dll looks for may not be present on Windows 95. (per kichik)
#StrCmp $2 "" Win9x
#StrCpy $0 0
;MessageBox MB_OK 'User "$2" is in the "$3" group'
Pop $3
Pop $2
Pop $1
Pop $0
Push 0
Return
;Because we use IsNT, this is redundant.
#Win9x:
# ; comment/message below is by UserInfo.nsi author:
# ; This one means you don't need to care about admin or
# ; not admin because Windows 9x doesn't either
# ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
# StrCpy $0 0
NotNT:
;We are not NT
;Win9x doesn't have "admin" users.
;Let the user do whatever.
Pop $3
Pop $2
Pop $1
Pop $0
Push 1
FunctionEnd
Function StrRep
;Written by dirtydingus 2003-02-20 04:30:09

View File

@ -595,10 +595,13 @@ load_model(const NodePath &parent, Filename filename) {
extension = Filename(filename.get_basename_wo_extension()).get_extension();
}
#endif // HAVE_ZLIB
TexturePool *texture_pool = TexturePool::get_global_ptr();
LoaderFileType *model_type = NULL;
if (!extension.empty()) {
LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr();
LoaderFileType *model_type =
reg->get_type_from_extension(extension);
model_type = reg->get_type_from_extension(extension);
if (model_type == (LoaderFileType *)NULL) {
// The extension isn't a known model file type; is it a known image file
// extension?
@ -623,6 +626,13 @@ load_model(const NodePath &parent, Filename filename) {
node = load_image_as_model(filename);
} else {
node = loader.load_sync(filename, options);
// It failed to load. Is it because the extension isn't recognised? If
// so, then we just got done printing out the known scene types, and we
// should also print out the supported texture types.
if (node == (PandaNode *)NULL && !is_image && model_type == NULL) {
texture_pool->write_texture_types(nout, 2);
}
}
if (node == (PandaNode *)NULL) {

View File

@ -1723,24 +1723,9 @@ update_texture(TextureContext *tc, bool force, int stage_index, bool uses_mipmap
*/
void TinyGraphicsStateGuardian::
release_texture(TextureContext *tc) {
TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
_texturing_state = 0; // just in case
GLTexture *gltex = &gtc->_gltex;
if (gltex->allocated_buffer != NULL) {
nassertv(gltex->num_levels != 0);
TinyTextureContext::get_class_type().dec_memory_usage(TypeHandle::MC_array, gltex->total_bytecount);
PANDA_FREE_ARRAY(gltex->allocated_buffer);
gltex->allocated_buffer = NULL;
gltex->total_bytecount = 0;
gltex->num_levels = 0;
} else {
nassertv(gltex->num_levels == 0);
}
gtc->dequeue_lru();
TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
delete gtc;
}

View File

@ -22,11 +22,3 @@ TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex, int view) :
_gltex.allocated_buffer = NULL;
_gltex.total_bytecount = 0;
}
/**
*
*/
INLINE TinyTextureContext::
~TinyTextureContext() {
nassertv(_gltex.num_levels == 0 && _gltex.allocated_buffer == NULL && _gltex.total_bytecount == 0);
}

View File

@ -16,6 +16,24 @@
TypeHandle TinyTextureContext::_type_handle;
/**
* Releases the memory associated with the texture.
*/
TinyTextureContext::
~TinyTextureContext() {
GLTexture *gltex = &_gltex;
if (gltex->allocated_buffer != NULL) {
nassertv(gltex->num_levels != 0);
TinyTextureContext::get_class_type().dec_memory_usage(TypeHandle::MC_array, gltex->total_bytecount);
PANDA_FREE_ARRAY(gltex->allocated_buffer);
gltex->allocated_buffer = NULL;
gltex->total_bytecount = 0;
gltex->num_levels = 0;
} else {
nassertv(gltex->num_levels == 0);
}
}
/**
* Evicts the page from the LRU. Called internally when the LRU determines
* that it is full. May also be called externally when necessary to

View File

@ -27,7 +27,7 @@ public:
INLINE TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex, int view);
ALLOC_DELETED_CHAIN(TinyTextureContext);
INLINE ~TinyTextureContext();
~TinyTextureContext();
virtual void evict_lru();

View File

@ -489,11 +489,11 @@ lookup_texture_mipmap_linear(ZTextureDef *texture_def, int s, int t, unsigned in
level = max((int)level - 1, 0);
p2 = ZB_LOOKUP_TEXTURE_MIPMAP_NEAREST(texture_def, s, t, level);
unsigned int bitsize = level + ZB_POINT_ST_FRAC_BITS;
r = LINEAR_FILTER_BITSIZE(PIXEL_R(p2), PIXEL_R(p1), level_dx, bitsize);
g = LINEAR_FILTER_BITSIZE(PIXEL_G(p2), PIXEL_G(p1), level_dx, bitsize);
b = LINEAR_FILTER_BITSIZE(PIXEL_B(p2), PIXEL_B(p1), level_dx, bitsize);
a = LINEAR_FILTER_BITSIZE(PIXEL_A(p2), PIXEL_A(p1), level_dx, bitsize);
unsigned int f = level_dx >> (level - 1);
r = LINEAR_FILTER(PIXEL_R(p1), PIXEL_R(p2), f);
g = LINEAR_FILTER(PIXEL_G(p1), PIXEL_G(p2), f);
b = LINEAR_FILTER(PIXEL_B(p1), PIXEL_B(p2), f);
a = LINEAR_FILTER(PIXEL_A(p1), PIXEL_A(p2), f);
return RGBA_TO_PIXEL(r, g, b, a);
}
@ -570,11 +570,11 @@ lookup_texture_mipmap_trilinear(ZTextureDef *texture_def, int s, int t, unsigned
}
int r, g, b, a;
unsigned int bitsize = level + ZB_POINT_ST_FRAC_BITS;
r = LINEAR_FILTER_BITSIZE(PIXEL_R(p2a), PIXEL_R(p1a), level_dx, bitsize);
g = LINEAR_FILTER_BITSIZE(PIXEL_G(p2a), PIXEL_G(p1a), level_dx, bitsize);
b = LINEAR_FILTER_BITSIZE(PIXEL_B(p2a), PIXEL_B(p1a), level_dx, bitsize);
a = LINEAR_FILTER_BITSIZE(PIXEL_A(p2a), PIXEL_A(p1a), level_dx, bitsize);
unsigned int f = level_dx >> (level - 1);
r = LINEAR_FILTER(PIXEL_R(p1a), PIXEL_R(p2a), f);
g = LINEAR_FILTER(PIXEL_G(p1a), PIXEL_G(p2a), f);
b = LINEAR_FILTER(PIXEL_B(p1a), PIXEL_B(p2a), f);
a = LINEAR_FILTER(PIXEL_A(p1a), PIXEL_A(p2a), f);
return RGBA_TO_PIXEL(r, g, b, a);
}

View File

@ -104,6 +104,33 @@ post_process_egg_files() {
// Do nothing.
break;
}
if (_got_tbnall) {
for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
if ((*ei)->recompute_tangent_binormal(GlobPattern("*"))) {
(*ei)->remove_unused_vertices(true);
}
}
} else {
if (_got_tbnauto) {
for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
if ((*ei)->recompute_tangent_binormal_auto()) {
(*ei)->remove_unused_vertices(true);
}
}
}
for (vector_string::const_iterator si = _tbn_names.begin();
si != _tbn_names.end();
++si) {
GlobPattern uv_name(*si);
nout << "Computing tangent and binormal for \"" << uv_name << "\"\n";
for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
(*ei)->recompute_tangent_binormal(uv_name);
(*ei)->remove_unused_vertices(true);
}
}
}
}