Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2019-10-05 21:13:42 +02:00
commit 114a7c0995
6 changed files with 47 additions and 27 deletions

View File

@ -9,6 +9,12 @@ from direct.directnotify import DirectNotifyGlobal
from direct.task.Task import Task from direct.task.Task import Task
from .DirectFrame import * from .DirectFrame import *
from .DirectButton import * from .DirectButton import *
import sys
if sys.version_info >= (3,0):
stringType = str
else:
stringType = basestring
class DirectScrolledListItem(DirectButton): class DirectScrolledListItem(DirectButton):
@ -61,7 +67,7 @@ class DirectScrolledList(DirectFrame):
# so we can modify it without mangling the user's list # so we can modify it without mangling the user's list
if 'items' in kw: if 'items' in kw:
for item in kw['items']: for item in kw['items']:
if type(item) != type(''): if not isinstance(item, stringType):
break break
else: else:
# we get here if every item in 'items' is a string # we get here if every item in 'items' is a string
@ -106,7 +112,7 @@ class DirectScrolledList(DirectFrame):
DirectFrame, (self,), DirectFrame, (self,),
) )
for item in self["items"]: for item in self["items"]:
if item.__class__.__name__ != 'str': if not isinstance(item, stringType):
item.reparentTo(self.itemFrame) item.reparentTo(self.itemFrame)
self.initialiseoptions(DirectScrolledList) self.initialiseoptions(DirectScrolledList)
@ -124,7 +130,7 @@ class DirectScrolledList(DirectFrame):
else: else:
self.maxHeight = 0.0 self.maxHeight = 0.0
for item in self["items"]: for item in self["items"]:
if item.__class__.__name__ != 'str': if not isinstance(item, stringType):
self.maxHeight = max(self.maxHeight, item.getHeight()) self.maxHeight = max(self.maxHeight, item.getHeight())
def setScrollSpeed(self): def setScrollSpeed(self):
@ -172,7 +178,7 @@ class DirectScrolledList(DirectFrame):
if len(self["items"]) == 0: if len(self["items"]) == 0:
return 0 return 0
if type(self["items"][0]) == type(''): if isinstance(self["items"][0], stringType):
self.notify.warning("getItemIndexForItemID: cant find itemID for non-class list items!") self.notify.warning("getItemIndexForItemID: cant find itemID for non-class list items!")
return 0 return 0
@ -238,7 +244,7 @@ class DirectScrolledList(DirectFrame):
# Hide them all # Hide them all
for item in self["items"]: for item in self["items"]:
if item.__class__.__name__ != 'str': if not isinstance(item, stringType):
item.hide() item.hide()
# Then show the ones in range, and stack their positions # Then show the ones in range, and stack their positions
@ -248,7 +254,7 @@ class DirectScrolledList(DirectFrame):
#print "stacking buttontext[", i,"]", self["items"][i]["text"] #print "stacking buttontext[", i,"]", self["items"][i]["text"]
# If the item is a 'str', then it has not been created (scrolled list is 'as needed') # If the item is a 'str', then it has not been created (scrolled list is 'as needed')
# Therefore, use the the function given to make it or just make it a frame # Therefore, use the the function given to make it or just make it a frame
if item.__class__.__name__ == 'str': if isinstance(item, stringType):
if self['itemMakeFunction']: if self['itemMakeFunction']:
# If there is a function to create the item # If there is a function to create the item
item = self['itemMakeFunction'](item, i, self['itemMakeExtraArgs']) item = self['itemMakeFunction'](item, i, self['itemMakeExtraArgs'])
@ -280,7 +286,7 @@ class DirectScrolledList(DirectFrame):
# Therefore, use the the function given to make it or # Therefore, use the the function given to make it or
# just make it a frame # just make it a frame
#print "Making " + str(item) #print "Making " + str(item)
if item.__class__.__name__ == 'str': if isinstance(item, stringType):
if self['itemMakeFunction']: if self['itemMakeFunction']:
# If there is a function to create the item # If there is a function to create the item
item = self['itemMakeFunction'](item, i, self['itemMakeExtraArgs']) item = self['itemMakeFunction'](item, i, self['itemMakeExtraArgs'])
@ -345,16 +351,16 @@ class DirectScrolledList(DirectFrame):
Add this string and extraArg to the list Add this string and extraArg to the list
""" """
assert self.notify.debugStateCall(self) assert self.notify.debugStateCall(self)
if type(item) != type(''): if not isinstance(item, stringType):
# cant add attribs to non-classes (like strings & ints) # cant add attribs to non-classes (like strings & ints)
item.itemID = self.nextItemID item.itemID = self.nextItemID
self.nextItemID += 1 self.nextItemID += 1
self['items'].append(item) self['items'].append(item)
if type(item) != type(''): if not isinstance(item, stringType):
item.reparentTo(self.itemFrame) item.reparentTo(self.itemFrame)
if refresh: if refresh:
self.refresh() self.refresh()
if type(item) != type(''): if not isinstance(item, stringType):
return item.itemID # to pass to scrollToItemID return item.itemID # to pass to scrollToItemID
def removeItem(self, item, refresh=1): def removeItem(self, item, refresh=1):
@ -369,7 +375,7 @@ class DirectScrolledList(DirectFrame):
if hasattr(self, "currentSelected") and self.currentSelected is item: if hasattr(self, "currentSelected") and self.currentSelected is item:
del self.currentSelected del self.currentSelected
self["items"].remove(item) self["items"].remove(item)
if type(item) != type(''): if not isinstance(item, stringType):
item.reparentTo(ShowBaseGlobal.hidden) item.reparentTo(ShowBaseGlobal.hidden)
self.refresh() self.refresh()
return 1 return 1
@ -387,7 +393,7 @@ class DirectScrolledList(DirectFrame):
if (hasattr(item, 'destroy') and hasattr(item.destroy, '__call__')): if (hasattr(item, 'destroy') and hasattr(item.destroy, '__call__')):
item.destroy() item.destroy()
self["items"].remove(item) self["items"].remove(item)
if type(item) != type(''): if not isinstance(item, stringType):
item.reparentTo(ShowBaseGlobal.hidden) item.reparentTo(ShowBaseGlobal.hidden)
self.refresh() self.refresh()
return 1 return 1
@ -409,7 +415,7 @@ class DirectScrolledList(DirectFrame):
if hasattr(self, "currentSelected") and self.currentSelected is item: if hasattr(self, "currentSelected") and self.currentSelected is item:
del self.currentSelected del self.currentSelected
self["items"].remove(item) self["items"].remove(item)
if type(item) != type(''): if not isinstance(item, stringType):
#RAU possible leak here, let's try to do the right thing #RAU possible leak here, let's try to do the right thing
#item.reparentTo(ShowBaseGlobal.hidden) #item.reparentTo(ShowBaseGlobal.hidden)
item.removeNode() item.removeNode()
@ -434,7 +440,7 @@ class DirectScrolledList(DirectFrame):
if (hasattr(item, 'destroy') and hasattr(item.destroy, '__call__')): if (hasattr(item, 'destroy') and hasattr(item.destroy, '__call__')):
item.destroy() item.destroy()
self["items"].remove(item) self["items"].remove(item)
if type(item) != type(''): if not isinstance(item, stringType):
#RAU possible leak here, let's try to do the right thing #RAU possible leak here, let's try to do the right thing
#item.reparentTo(ShowBaseGlobal.hidden) #item.reparentTo(ShowBaseGlobal.hidden)
item.removeNode() item.removeNode()
@ -459,7 +465,7 @@ class DirectScrolledList(DirectFrame):
def getSelectedText(self): def getSelectedText(self):
assert self.notify.debugStateCall(self) assert self.notify.debugStateCall(self)
if self['items'][self.index].__class__.__name__ == 'str': if isinstance(self['items'][self.index], stringType):
return self['items'][self.index] return self['items'][self.index]
else: else:
return self['items'][self.index]['text'] return self['items'][self.index]['text']

View File

@ -461,6 +461,11 @@ def MakeInstallerOSX(version, python_versions=[], **kwargs):
oscmd("mkdir -p %s" % (dir)) oscmd("mkdir -p %s" % (dir))
WriteFile("%s/Panda3D.pth" % (dir), "/Developer/Panda3D") WriteFile("%s/Panda3D.pth" % (dir), "/Developer/Panda3D")
# Also place it somewhere the Homebrew version of Python can find it.
dir = "dstroot/pybindings%s/usr/local/lib/python%s/site-packages" % (pyver, pyver)
oscmd("mkdir -p %s" % (dir))
WriteFile("%s/Panda3D.pth" % (dir), "/Developer/Panda3D")
if not PkgSkip("FFMPEG"): if not PkgSkip("FFMPEG"):
oscmd("mkdir -p dstroot/ffmpeg/Developer/Panda3D/lib") oscmd("mkdir -p dstroot/ffmpeg/Developer/Panda3D/lib")
oscmd("cp -R %s/lib/libp3ffmpeg.* dstroot/ffmpeg/Developer/Panda3D/lib/" % outputdir) oscmd("cp -R %s/lib/libp3ffmpeg.* dstroot/ffmpeg/Developer/Panda3D/lib/" % outputdir)

View File

@ -397,8 +397,9 @@ load_named_module(const string &name) {
<< "loading display module: " << dlname.to_os_specific() << std::endl; << "loading display module: " << dlname.to_os_specific() << std::endl;
void *handle = load_dso(get_plugin_path().get_value(), dlname); void *handle = load_dso(get_plugin_path().get_value(), dlname);
if (handle == nullptr) { if (handle == nullptr) {
std::string error = load_dso_error();
display_cat.warning() display_cat.warning()
<< "Unable to load: " << load_dso_error() << std::endl; << "Unable to load " << dlname.get_basename() << ": " << error << std::endl;
return TypeHandle::none(); return TypeHandle::none();
} }

View File

@ -131,6 +131,7 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte
// glVertexPointer). // glVertexPointer).
size_t nvarying = _shader->_var_spec.size(); size_t nvarying = _shader->_var_spec.size();
_attributes.resize(nvarying); _attributes.resize(nvarying);
_used_generic_attribs.clear();
for (size_t i = 0; i < nvarying; ++i) { for (size_t i = 0; i < nvarying; ++i) {
const Shader::ShaderVarSpec &bind = _shader->_var_spec[i]; const Shader::ShaderVarSpec &bind = _shader->_var_spec[i];
@ -332,6 +333,9 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte
#endif #endif
_attributes[i] = loc; _attributes[i] = loc;
if (loc >= 0) {
_used_generic_attribs.set_bit(loc);
}
} }
_glgsg->report_my_gl_errors(); _glgsg->report_my_gl_errors();
@ -857,8 +861,6 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
int start, stride, num_values; int start, stride, num_values;
size_t nvarying = _shader->_var_spec.size(); size_t nvarying = _shader->_var_spec.size();
GLuint max_p = 0;
for (size_t i = 0; i < nvarying; ++i) { for (size_t i = 0; i < nvarying; ++i) {
const Shader::ShaderVarSpec &bind = _shader->_var_spec[i]; const Shader::ShaderVarSpec &bind = _shader->_var_spec[i];
InternalName *name = bind._name; InternalName *name = bind._name;
@ -893,8 +895,6 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
// limited in the options we can set. // limited in the options we can set.
GLenum type = _glgsg->get_numeric_type(numeric_type); GLenum type = _glgsg->get_numeric_type(numeric_type);
if (p >= 0) { if (p >= 0) {
max_p = std::max(max_p, (GLuint)p + 1);
_glgsg->enable_vertex_attrib_array(p); _glgsg->enable_vertex_attrib_array(p);
if (numeric_type == GeomEnums::NT_packed_dabc) { if (numeric_type == GeomEnums::NT_packed_dabc) {
@ -1018,12 +1018,16 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
} }
} }
// Disable attribute arrays we don't use. // Disable enabled attribute arrays that we don't use.
GLint highest_p = _glgsg->_enabled_vertex_attrib_arrays.get_highest_on_bit() + 1; BitMask32 disable = _glgsg->_enabled_vertex_attrib_arrays & ~_used_generic_attribs;
for (GLint p = max_p; p < highest_p; ++p) { if (!disable.is_zero()) {
for (GLuint p = (GLuint)disable.get_lowest_on_bit(); p <= (GLuint)disable.get_highest_on_bit(); ++p) {
if (disable.get_bit(p)) {
_glgsg->disable_vertex_attrib_array(p); _glgsg->disable_vertex_attrib_array(p);
} }
} }
}
}
if (_transform_table_param) { if (_transform_table_param) {
const TransformTable *table = _glgsg->_data_reader->get_transform_table(); const TransformTable *table = _glgsg->_data_reader->get_transform_table();

View File

@ -68,6 +68,7 @@ private:
GLuint _glsl_program; GLuint _glsl_program;
pvector<GLint> _attributes; pvector<GLint> _attributes;
BitMask32 _used_generic_attribs;
GLint _color_attrib_index; GLint _color_attrib_index;
CGparameter _transform_table_param; CGparameter _transform_table_param;
CGparameter _slider_table_param; CGparameter _slider_table_param;

View File

@ -123,9 +123,10 @@ load_audio_types() {
<< "loading audio type module: " << name << endl; << "loading audio type module: " << name << endl;
void *tmp = load_dso(get_plugin_path().get_value(), dlname); void *tmp = load_dso(get_plugin_path().get_value(), dlname);
if (tmp == nullptr) { if (tmp == nullptr) {
std::string error = load_dso_error();
movies_cat.warning() movies_cat.warning()
<< "Unable to load " << dlname.to_os_specific() << "Unable to load " << dlname.to_os_specific()
<< ": " << load_dso_error() << endl; << ": " << error << endl;
} else if (movies_cat.is_debug()) { } else if (movies_cat.is_debug()) {
movies_cat.debug() movies_cat.debug()
<< "done loading audio type module: " << name << endl; << "done loading audio type module: " << name << endl;
@ -252,9 +253,10 @@ load_video_types() {
<< "loading video type module: " << name << endl; << "loading video type module: " << name << endl;
void *tmp = load_dso(get_plugin_path().get_value(), dlname); void *tmp = load_dso(get_plugin_path().get_value(), dlname);
if (tmp == nullptr) { if (tmp == nullptr) {
std::string error = load_dso_error();
movies_cat.warning() movies_cat.warning()
<< "Unable to load " << dlname.to_os_specific() << "Unable to load " << dlname.to_os_specific()
<< ": " << load_dso_error() << endl; << ": " << error << endl;
} else if (movies_cat.is_debug()) { } else if (movies_cat.is_debug()) {
movies_cat.debug() movies_cat.debug()
<< "done loading video type module: " << name << endl; << "done loading video type module: " << name << endl;
@ -294,9 +296,10 @@ load_movie_library(const string &name) {
void *tmp = load_dso(get_plugin_path().get_value(), dlname); void *tmp = load_dso(get_plugin_path().get_value(), dlname);
if (tmp == nullptr) { if (tmp == nullptr) {
std::string error = load_dso_error();
movies_cat.warning() movies_cat.warning()
<< "Unable to load " << dlname.to_os_specific() << "Unable to load " << dlname.to_os_specific()
<< ": " << load_dso_error() << endl; << ": " << error << endl;
} else if (movies_cat.is_debug()) { } else if (movies_cat.is_debug()) {
movies_cat.debug() movies_cat.debug()
<< "done loading video type module: " << name << endl; << "done loading video type module: " << name << endl;