Browse Source

Merge remote-tracking branch 'origin/release/1.9.x'

rdb 10 years ago
parent
commit
2db003a1c2

+ 73 - 2
direct/src/p3d/Packager.py

@@ -375,6 +375,9 @@ class Packager:
             # This records the current list of modules we have added so
             # This records the current list of modules we have added so
             # far.
             # far.
             self.freezer = FreezeTool.Freezer(platform = self.packager.platform)
             self.freezer = FreezeTool.Freezer(platform = self.packager.platform)
+            
+            # Map of extensions to files to number (ignored by dir)
+            self.ignoredDirFiles = {}
 
 
         def close(self):
         def close(self):
             """ Writes out the contents of the current package.  Returns True
             """ Writes out the contents of the current package.  Returns True
@@ -385,6 +388,13 @@ class Packager:
                 message = 'Cannot generate packages without an installDir; use -i'
                 message = 'Cannot generate packages without an installDir; use -i'
                 raise PackagerError, message
                 raise PackagerError, message
 
 
+            if self.ignoredDirFiles:
+                exts = list(self.ignoredDirFiles.keys())
+                exts.sort()
+                total = sum([x for x in self.ignoredDirFiles.values()])
+                self.notify.warning("excluded %s files not marked for inclusion: %s" \
+                                    % (total, ", ".join(["'" + ext + "'" for ext in exts])))
+                
             if not self.host:
             if not self.host:
                 self.host = self.packager.host
                 self.host = self.packager.host
 
 
@@ -2185,6 +2195,9 @@ class Packager:
         # ignoring any request to specify a particular download host,
         # ignoring any request to specify a particular download host,
         # e.g. for testing and development.
         # e.g. for testing and development.
         self.ignoreSetHost = False
         self.ignoreSetHost = False
+        
+        # Set this to true to verbosely log files ignored by dir().
+        self.verbosePrint = False
 
 
         # This will be appended to the basename of any .p3d package,
         # This will be appended to the basename of any .p3d package,
         # before the .p3d extension.
         # before the .p3d extension.
@@ -2390,6 +2403,14 @@ class Packager:
         # should be added exactly byte-for-byte as they are.
         # should be added exactly byte-for-byte as they are.
         self.unprocessedExtensions = []
         self.unprocessedExtensions = []
 
 
+        # Files for which warnings should be suppressed when they are
+        # not handled by dir()
+        self.suppressWarningForExtensions = ['', 'pyc', 'pyo', 
+                                             'p3d', 'pdef', 
+                                             'c', 'C', 'cxx', 'cpp', 'h', 'H',
+                                             'hpp', 'pp', 'I', 'pem', 'p12', 'crt',
+                                             'o', 'obj', 'a', 'lib', 'bc', 'll']
+         
         # System files that should never be packaged.  For
         # System files that should never be packaged.  For
         # case-insensitive filesystems (like Windows and OSX), put the
         # case-insensitive filesystems (like Windows and OSX), put the
         # lowercase filename here.  Case-sensitive filesystems should
         # lowercase filename here.  Case-sensitive filesystems should
@@ -2617,12 +2638,20 @@ class Packager:
             if dirname.makeTrueCase():
             if dirname.makeTrueCase():
                 searchPath.appendDirectory(dirname)
                 searchPath.appendDirectory(dirname)
 
 
+    def _ensureExtensions(self):
+        self.knownExtensions = \
+            self.imageExtensions + \
+            self.modelExtensions + \
+            self.textExtensions + \
+            self.binaryExtensions + \
+            self.uncompressibleExtensions + \
+            self.unprocessedExtensions
 
 
     def setup(self):
     def setup(self):
         """ Call this method to initialize the class after filling in
         """ Call this method to initialize the class after filling in
         some of the values in the constructor. """
         some of the values in the constructor. """
 
 
-        self.knownExtensions = self.imageExtensions + self.modelExtensions + self.textExtensions + self.binaryExtensions + self.uncompressibleExtensions + self.unprocessedExtensions
+        self._ensureExtensions()
 
 
         self.currentPackage = None
         self.currentPackage = None
 
 
@@ -3604,6 +3633,43 @@ class Packager:
         filename = Filename(filename)
         filename = Filename(filename)
         self.currentPackage.excludeFile(filename)
         self.currentPackage.excludeFile(filename)
 
 
+
+    def do_includeExtensions(self, executableExtensions = None, extractExtensions = None, 
+                         imageExtensions = None, textExtensions = None, 
+                         uncompressibleExtensions = None, unprocessedExtensions = None,
+                         suppressWarningForExtensions = None):
+        """ Ensure that dir() will include files with the given extensions.
+        The extensions should not have '.' prefixes.
+        
+        All except 'suppressWarningForExtensions' allow the given kinds of files
+        to be packaged with their respective semantics (read the source).
+        
+        'suppressWarningForExtensions' lists extensions *expected* to be ignored, 
+        so no warnings will be emitted for them.
+        """
+        if executableExtensions:
+            self.executableExtensions += executableExtensions
+
+        if extractExtensions:
+            self.extractExtensions += extractExtensions
+
+        if imageExtensions:
+            self.imageExtensions += imageExtensions
+
+        if textExtensions:
+            self.textExtensions += textExtensions
+
+        if uncompressibleExtensions:
+            self.uncompressibleExtensions += uncompressibleExtensions
+
+        if unprocessedExtensions:
+            self.unprocessedExtensions += unprocessedExtensions
+
+        if suppressWarningForExtensions:
+            self.suppressWarningForExtensions += suppressWarningForExtensions
+
+        self._ensureExtensions()
+
     def do_dir(self, dirname, newDir = None, unprocessed = None):
     def do_dir(self, dirname, newDir = None, unprocessed = None):
 
 
         """ Adds the indicated directory hierarchy to the current
         """ Adds the indicated directory hierarchy to the current
@@ -3676,7 +3742,12 @@ class Packager:
                     filename.setBinary()
                     filename.setBinary()
                 self.currentPackage.addFile(filename, newName = newName,
                 self.currentPackage.addFile(filename, newName = newName,
                                             explicit = False, unprocessed = unprocessed)
                                             explicit = False, unprocessed = unprocessed)
-
+            elif not ext in self.suppressWarningForExtensions:
+                newCount = self.currentPackage.ignoredDirFiles.get(ext, 0) + 1
+                self.currentPackage.ignoredDirFiles[ext] = newCount
+                
+                if self.verbosePrint:
+                    self.notify.warning("ignoring file %s" % filename) 
 
 
     def readContentsFile(self):
     def readContentsFile(self):
         """ Reads the contents.xml file at the beginning of
         """ Reads the contents.xml file at the beginning of

+ 10 - 1
direct/src/p3d/ppackage.py

@@ -123,6 +123,10 @@ Options:
      as such.  This only applies to .p3d packages, not to other types
      as such.  This only applies to .p3d packages, not to other types
      of packages!
      of packages!
 
 
+  -v
+     Emit a warning for any file not recognized by the dir() command
+     (indicating there may be a need for addExtensions(...)).
+     
   -h
   -h
      Display this help
      Display this help
 """
 """
@@ -151,11 +155,12 @@ allowPythonDev = False
 universalBinaries = False
 universalBinaries = False
 systemRoot = None
 systemRoot = None
 ignoreSetHost = False
 ignoreSetHost = False
+verbosePrint = False
 p3dSuffix = ''
 p3dSuffix = ''
 platforms = []
 platforms = []
 
 
 try:
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DuP:R:Ha:h')
+    opts, args = getopt.getopt(sys.argv[1:], 'i:ps:S:DuP:R:Ha:hv')
 except getopt.error, msg:
 except getopt.error, msg:
     usage(1, msg)
     usage(1, msg)
 
 
@@ -188,6 +193,9 @@ for opt, arg in opts:
     elif opt == '-a':
     elif opt == '-a':
         p3dSuffix = arg
         p3dSuffix = arg
 
 
+    elif opt == '-v':
+        verbosePrint = True
+        
     elif opt == '-h':
     elif opt == '-h':
         usage(0)
         usage(0)
     else:
     else:
@@ -230,6 +238,7 @@ for platform in platforms:
     packager.allowPythonDev = allowPythonDev
     packager.allowPythonDev = allowPythonDev
     packager.systemRoot = systemRoot
     packager.systemRoot = systemRoot
     packager.ignoreSetHost = ignoreSetHost
     packager.ignoreSetHost = ignoreSetHost
+    packager.verbosePrint = verbosePrint
     packager.p3dSuffix = p3dSuffix
     packager.p3dSuffix = p3dSuffix
 
 
     try:
     try:

+ 6 - 4
panda/src/bullet/bulletHingeConstraint.cxx

@@ -211,10 +211,12 @@ get_hinge_angle() {
 //     Function: BulletHingeConstraint::enable_angular_motor
 //     Function: BulletHingeConstraint::enable_angular_motor
 //       Access: Published
 //       Access: Published
 //  Description: Applies an impulse to the constraint so that the
 //  Description: Applies an impulse to the constraint so that the
-//               angle changes at target_velocity (probably
-//               degrees/second) where max_impulse is the maximum
-//               impulse that is used for achieving the specified
-//               velocity.
+//               angle changes at target_velocity where max_impulse
+//               is the maximum impulse that is used for achieving
+//               the specified velocity.
+//
+//               Note that the target_velocity is in radians/second,
+//               not degrees.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletHingeConstraint::
 void BulletHingeConstraint::
 enable_angular_motor(bool enable, PN_stdfloat target_velocity, PN_stdfloat max_impulse) {
 enable_angular_motor(bool enable, PN_stdfloat target_velocity, PN_stdfloat max_impulse) {

+ 6 - 0
panda/src/express/referenceCount.I

@@ -319,6 +319,9 @@ get_weak_list() const {
 INLINE void ReferenceCount::
 INLINE void ReferenceCount::
 weak_ref(WeakPointerToVoid *ptv) {
 weak_ref(WeakPointerToVoid *ptv) {
   TAU_PROFILE("void ReferenceCount::weak_ref()", " ", TAU_USER);
   TAU_PROFILE("void ReferenceCount::weak_ref()", " ", TAU_USER);
+#ifdef _DEBUG
+  nassertv(test_ref_count_integrity());
+#endif
   get_weak_list()->add_reference(ptv);
   get_weak_list()->add_reference(ptv);
 }
 }
 
 
@@ -332,6 +335,9 @@ weak_ref(WeakPointerToVoid *ptv) {
 INLINE void ReferenceCount::
 INLINE void ReferenceCount::
 weak_unref(WeakPointerToVoid *ptv) {
 weak_unref(WeakPointerToVoid *ptv) {
   TAU_PROFILE("void ReferenceCount::weak_unref()", " ", TAU_USER);
   TAU_PROFILE("void ReferenceCount::weak_unref()", " ", TAU_USER);
+#ifdef _DEBUG
+  nassertv(test_ref_count_integrity());
+#endif
   nassertv(has_weak_list());
   nassertv(has_weak_list());
   ((WeakReferenceList *)_weak_list)->clear_reference(ptv);
   ((WeakReferenceList *)_weak_list)->clear_reference(ptv);
 }
 }

+ 3 - 3
panda/src/express/weakPointerTo.I

@@ -43,7 +43,7 @@ WeakPointerTo(const PointerTo<T> &copy) :
 template<class T>
 template<class T>
 INLINE WeakPointerTo<T>::
 INLINE WeakPointerTo<T>::
 WeakPointerTo(const WeakPointerTo<T> &copy) :
 WeakPointerTo(const WeakPointerTo<T> &copy) :
-  WeakPointerToBase<T>(*(const PointerToBase<T> *)&copy)
+  WeakPointerToBase<T>(*(const WeakPointerToBase<T> *)&copy)
 {
 {
 }
 }
 
 
@@ -194,7 +194,7 @@ WeakConstPointerTo(const ConstPointerTo<T> &copy) :
 template<class T>
 template<class T>
 INLINE WeakConstPointerTo<T>::
 INLINE WeakConstPointerTo<T>::
 WeakConstPointerTo(const WeakPointerTo<T> &copy) :
 WeakConstPointerTo(const WeakPointerTo<T> &copy) :
-  WeakPointerToBase<T>(*(const PointerToBase<T> *)&copy)
+  WeakPointerToBase<T>(*(const WeakPointerToBase<T> *)&copy)
 {
 {
 }
 }
 
 
@@ -206,7 +206,7 @@ WeakConstPointerTo(const WeakPointerTo<T> &copy) :
 template<class T>
 template<class T>
 INLINE WeakConstPointerTo<T>::
 INLINE WeakConstPointerTo<T>::
 WeakConstPointerTo(const WeakConstPointerTo<T> &copy) :
 WeakConstPointerTo(const WeakConstPointerTo<T> &copy) :
-  WeakPointerToBase<T>(*(const PointerToBase<T> *)&copy)
+  WeakPointerToBase<T>(*(const WeakPointerToBase<T> *)&copy)
 {
 {
 }
 }
 
 

+ 7 - 1
panda/src/express/weakPointerToBase.I

@@ -43,7 +43,13 @@ WeakPointerToBase(const PointerToBase<T> &copy) {
 template<class T>
 template<class T>
 INLINE WeakPointerToBase<T>::
 INLINE WeakPointerToBase<T>::
 WeakPointerToBase(const WeakPointerToBase<T> &copy) {
 WeakPointerToBase(const WeakPointerToBase<T> &copy) {
-  reassign(copy);
+  _void_ptr = copy._void_ptr;
+  _ptr_was_deleted = copy._ptr_was_deleted;
+
+  if (is_valid_pointer()) {
+    To *ptr = (To *)_void_ptr;
+    ptr->weak_ref(this);
+  }
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 8 - 1
panda/src/x11display/x11GraphicsWindow.cxx

@@ -1643,6 +1643,7 @@ map_button(KeySym key) const {
   case XK_ampersand:
   case XK_ampersand:
     return KeyboardButton::ascii_key('&');
     return KeyboardButton::ascii_key('&');
   case XK_apostrophe: // == XK_quoteright
   case XK_apostrophe: // == XK_quoteright
+  case XK_dead_acute: // on int'l keyboards
     return KeyboardButton::ascii_key('\'');
     return KeyboardButton::ascii_key('\'');
   case XK_parenleft:
   case XK_parenleft:
     return KeyboardButton::ascii_key('(');
     return KeyboardButton::ascii_key('(');
@@ -1774,6 +1775,7 @@ map_button(KeySym key) const {
   case XK_underscore:
   case XK_underscore:
     return KeyboardButton::ascii_key('_');
     return KeyboardButton::ascii_key('_');
   case XK_grave: // == XK_quoteleft
   case XK_grave: // == XK_quoteleft
+  case XK_dead_grave: // on int'l keyboards
     return KeyboardButton::ascii_key('`');
     return KeyboardButton::ascii_key('`');
   case XK_a:
   case XK_a:
     return KeyboardButton::ascii_key('a');
     return KeyboardButton::ascii_key('a');
@@ -1916,15 +1918,20 @@ map_button(KeySym key) const {
   case XK_Alt_R:
   case XK_Alt_R:
     return KeyboardButton::ralt();
     return KeyboardButton::ralt();
   case XK_Meta_L:
   case XK_Meta_L:
+  case XK_Super_L:
     return KeyboardButton::lmeta();
     return KeyboardButton::lmeta();
   case XK_Meta_R:
   case XK_Meta_R:
+  case XK_Super_R:
     return KeyboardButton::rmeta();
     return KeyboardButton::rmeta();
   case XK_Caps_Lock:
   case XK_Caps_Lock:
     return KeyboardButton::caps_lock();
     return KeyboardButton::caps_lock();
   case XK_Shift_Lock:
   case XK_Shift_Lock:
     return KeyboardButton::shift_lock();
     return KeyboardButton::shift_lock();
   }
   }
-
+  if (x11display_cat.is_debug()) {
+    x11display_cat.debug()
+      << "Unrecognized keysym 0x" << hex << key << dec << "\n";
+  }
   return ButtonHandle::none();
   return ButtonHandle::none();
 }
 }