2
0
Эх сурвалжийг харах

Merge remote-tracking branch 'origin/release/1.10.x' into webgl-port

rdb 7 жил өмнө
parent
commit
291341a898
100 өөрчлөгдсөн 1585 нэмэгдсэн , 1449 устгасан
  1. 1 0
      .gitignore
  2. 6 4
      .travis.yml
  3. 40 8
      README.md
  4. 51 47
      contrib/src/ai/aiBehaviors.cxx
  5. 15 15
      contrib/src/ai/aiBehaviors.h
  6. 4 1
      contrib/src/ai/aiCharacter.cxx
  7. 4 3
      contrib/src/ai/aiCharacter.h
  8. 3 3
      contrib/src/ai/aiNode.cxx
  9. 4 4
      contrib/src/ai/aiPathFinder.cxx
  10. 4 4
      contrib/src/ai/aiPathFinder.h
  11. 33 105
      contrib/src/ai/aiWorld.cxx
  12. 5 25
      contrib/src/ai/aiWorld.h
  13. 4 4
      contrib/src/ai/arrival.cxx
  14. 1 1
      contrib/src/ai/flock.h
  15. 3 3
      contrib/src/ai/meshNode.cxx
  16. 0 1
      contrib/src/ai/obstacleAvoidance.cxx
  17. 25 21
      contrib/src/ai/pathFind.cxx
  18. 4 4
      contrib/src/ai/pathFind.h
  19. 1 1
      contrib/src/ai/pathFollow.cxx
  20. 3 3
      contrib/src/ai/pathFollow.h
  21. BIN
      contrib/src/panda3dtoolsgui/pandaIcon.ico
  22. 2 2
      contrib/src/rplight/gpuCommand.I
  23. 4 4
      contrib/src/rplight/gpuCommand.cxx
  24. 1 1
      contrib/src/rplight/gpuCommand.h
  25. 1 1
      contrib/src/rplight/gpuCommandList.h
  26. 4 2
      contrib/src/rplight/iesDataset.cxx
  27. 5 3
      contrib/src/rplight/internalLightManager.cxx
  28. 3 2
      contrib/src/rplight/pointerSlotStorage.h
  29. 2 0
      contrib/src/rplight/pssmCameraRig.cxx
  30. 3 3
      contrib/src/rplight/pssmCameraRig.h
  31. 2 2
      contrib/src/rplight/rpLight.I
  32. 2 2
      contrib/src/rplight/rpLight.h
  33. 2 0
      contrib/src/rplight/rpSpotLight.cxx
  34. 1 1
      contrib/src/rplight/shadowAtlas.I
  35. 6 6
      contrib/src/rplight/shadowAtlas.cxx
  36. 2 2
      contrib/src/rplight/shadowManager.I
  37. 5 5
      contrib/src/rplight/tagStateManager.I
  38. 3 1
      contrib/src/rplight/tagStateManager.cxx
  39. 10 10
      contrib/src/rplight/tagStateManager.h
  40. 1 1
      contrib/src/sceneeditor/MetadataPanel.py
  41. 37 29
      contrib/src/sceneeditor/SideWindow.py
  42. 3 4
      contrib/src/sceneeditor/collisionWindow.py
  43. 186 180
      contrib/src/sceneeditor/controllerWindow.py
  44. 50 48
      contrib/src/sceneeditor/dataHolder.py
  45. 2 2
      contrib/src/sceneeditor/duplicateWindow.py
  46. 32 25
      contrib/src/sceneeditor/lightingPanel.py
  47. 4 5
      contrib/src/sceneeditor/propertyWindow.py
  48. 6 8
      contrib/src/sceneeditor/quad.py
  49. 48 37
      contrib/src/sceneeditor/sceneEditor.py
  50. 9 5
      contrib/src/sceneeditor/seAnimPanel.py
  51. 9 5
      contrib/src/sceneeditor/seBlendAnimPanel.py
  52. 10 11
      contrib/src/sceneeditor/seCameraControl.py
  53. 8 2
      contrib/src/sceneeditor/seColorEntry.py
  54. 18 18
      contrib/src/sceneeditor/seFileSaver.py
  55. 1 3
      contrib/src/sceneeditor/seForceGroup.py
  56. 8 8
      contrib/src/sceneeditor/seGeometry.py
  57. 10 11
      contrib/src/sceneeditor/seLights.py
  58. 1 1
      contrib/src/sceneeditor/seManipulation.py
  59. 153 146
      contrib/src/sceneeditor/seMopathRecorder.py
  60. 4 4
      contrib/src/sceneeditor/seParticleEffect.py
  61. 29 22
      contrib/src/sceneeditor/seParticlePanel.py
  62. 5 25
      contrib/src/sceneeditor/seParticles.py
  63. 34 27
      contrib/src/sceneeditor/sePlacer.py
  64. 16 9
      contrib/src/sceneeditor/seSceneGraphExplorer.py
  65. 20 11
      contrib/src/sceneeditor/seSelection.py
  66. 9 6
      contrib/src/sceneeditor/seSession.py
  67. 15 9
      contrib/src/sceneeditor/seTree.py
  68. 0 12
      direct/src/actor/Actor.py
  69. 0 9
      direct/src/configfiles/direct.init
  70. 5 2
      direct/src/dcparse/dcparse.cxx
  71. 81 7
      direct/src/dcparser/dcArrayParameter.cxx
  72. 9 5
      direct/src/dcparser/dcArrayParameter.h
  73. 14 12
      direct/src/dcparser/dcAtomicField.cxx
  74. 7 7
      direct/src/dcparser/dcAtomicField.h
  75. 1 1
      direct/src/dcparser/dcClass.I
  76. 61 50
      direct/src/dcparser/dcClass.cxx
  77. 18 18
      direct/src/dcparser/dcClass.h
  78. 4 4
      direct/src/dcparser/dcClassParameter.cxx
  79. 3 3
      direct/src/dcparser/dcClassParameter.h
  80. 6 6
      direct/src/dcparser/dcDeclaration.cxx
  81. 6 6
      direct/src/dcparser/dcDeclaration.h
  82. 5 5
      direct/src/dcparser/dcField.I
  83. 38 35
      direct/src/dcparser/dcField.cxx
  84. 15 15
      direct/src/dcparser/dcField.h
  85. 18 15
      direct/src/dcparser/dcFile.cxx
  86. 16 16
      direct/src/dcparser/dcFile.h
  87. 4 4
      direct/src/dcparser/dcKeyword.cxx
  88. 6 6
      direct/src/dcparser/dcKeyword.h
  89. 5 5
      direct/src/dcparser/dcKeywordList.cxx
  90. 5 5
      direct/src/dcparser/dcKeywordList.h
  91. 165 143
      direct/src/dcparser/dcLexer.cxx.prebuilt
  92. 47 43
      direct/src/dcparser/dcLexer.lxx
  93. 3 3
      direct/src/dcparser/dcLexerDefs.h
  94. 5 5
      direct/src/dcparser/dcMolecularField.cxx
  95. 4 4
      direct/src/dcparser/dcMolecularField.h
  96. 20 20
      direct/src/dcparser/dcNumericRange.I
  97. 8 8
      direct/src/dcparser/dcNumericRange.h
  98. 6 6
      direct/src/dcparser/dcPackData.I
  99. 1 1
      direct/src/dcparser/dcPackData.cxx
  100. 2 2
      direct/src/dcparser/dcPackData.h

+ 1 - 0
.gitignore

@@ -59,3 +59,4 @@ __pycache__/
 # Test tool cache directories
 # Test tool cache directories
 .tox/
 .tox/
 .cache/
 .cache/
+.pytest_cache/

+ 6 - 4
.travis.yml

@@ -11,6 +11,8 @@ matrix:
       before_install:
       before_install:
         - export CC=gcc-4.7
         - export CC=gcc-4.7
         - export CXX=g++-4.7
         - export CXX=g++-4.7
+    - compiler: clang
+      env: PYTHONV=python3 FLAGS=--no-python SKIP_TESTS=1
 addons:
 addons:
   apt:
   apt:
     sources:
     sources:
@@ -42,13 +44,13 @@ install:
     - $PYTHONV -m pip install pytest
     - $PYTHONV -m pip install pytest
 script:
 script:
     - $PYTHONV makepanda/makepanda.py --everything --git-commit $TRAVIS_COMMIT $FLAGS --threads 4
     - $PYTHONV makepanda/makepanda.py --everything --git-commit $TRAVIS_COMMIT $FLAGS --threads 4
-    - LD_LIBRARY_PATH=built/lib PYTHONPATH=built $PYTHONV makepanda/test_imports.py
-    - LD_LIBRARY_PATH=built/lib PYTHONPATH=built $PYTHONV -m pytest tests
+    - test -n "$SKIP_TESTS" || LD_LIBRARY_PATH=built/lib PYTHONPATH=built $PYTHONV makepanda/test_imports.py
+    - test -n "$SKIP_TESTS" || LD_LIBRARY_PATH=built/lib PYTHONPATH=built $PYTHONV -m pytest -v tests
 notifications:
 notifications:
   irc:
   irc:
     channels:
     channels:
-      - "chat.freenode.net#panda3d"
+      - secure: "jfwHT9RHAVOGRGTMY8TpYKJI6rq8nFoIj41Y0soZdJQNWtSSFEK9AyzZeMY+2dHga7cR/X+/0NWZ2ehhedTnd9FvlzOnMWWC3K0I/b3XWbEdVEqIZnggFkKGqs82Gy3omguRC63yWupeJCcSCckIhoWbLzWy6xV8lF5WC80iXi8="
     on_success: change
     on_success: change
     on_failure: always
     on_failure: always
     use_notice: true
     use_notice: true
-    skip_join: true
+    skip_join: false

+ 40 - 8
README.md

@@ -43,8 +43,9 @@ Building Panda3D
 Windows
 Windows
 -------
 -------
 
 
-We currently build using the Microsoft Visual C++ 2015 compiler.  You will
-also need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk),
+You can build Panda3D with the Microsoft Visual C++ 2015 or 2017 compiler,
+which can be downloaded for free from the [Visual Studio site](https://visualstudio.microsoft.com/downloads/).
+You will also need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk),
 and if you intend to target Windows XP, you will also need the
 and if you intend to target Windows XP, you will also need the
 [Windows 7.1 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279).
 [Windows 7.1 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279).
 
 
@@ -54,15 +55,16 @@ depending on whether you are on a 32-bit or 64-bit system, or you can
 [click here](https://github.com/rdb/panda3d-thirdparty) for instructions on
 [click here](https://github.com/rdb/panda3d-thirdparty) for instructions on
 building them from source.
 building them from source.
 
 
-http://rdb.name/thirdparty-vc14-x64.7z
-http://rdb.name/thirdparty-vc14.7z
+https://www.panda3d.org/download/panda3d-1.10.0/panda3d-1.10.0-tools-win64.zip
+https://www.panda3d.org/download/panda3d-1.10.0/panda3d-1.10.0-tools-win32.zip
 
 
 After acquiring these dependencies, you may simply build Panda3D from the
 After acquiring these dependencies, you may simply build Panda3D from the
-command prompt using the following command.  (Add the `--windows-sdk=10`
-option if you don't need to support Windows XP.)
+command prompt using the following command.  (Change `14.1` to `14` if you are
+using Visual C++ 2015 instead of 2017.  Add the `--windows-sdk=10` option if
+you don't need to support Windows XP and did not install the Windows 7.1 SDK.)
 
 
 ```bash
 ```bash
-makepanda\makepanda.bat --everything --installer --no-eigen --threads=2
+makepanda\makepanda.bat --everything --installer --msvc-version=14.1 --no-eigen --threads=2
 ```
 ```
 
 
 When the build succeeds, it will produce an .exe file that you can use to
 When the build succeeds, it will produce an .exe file that you can use to
@@ -101,7 +103,7 @@ If you are on Ubuntu, this command should cover the most frequently
 used third-party packages:
 used third-party packages:
 
 
 ```bash
 ```bash
-sudo apt-get install build-essential pkg-config python-dev libpng-dev libjpeg-dev libtiff-dev zlib1g-dev libssl-dev libx11-dev libgl1-mesa-dev libxrandr-dev libxxf86dga-dev libxcursor-dev bison flex libfreetype6-dev libvorbis-dev libeigen3-dev libopenal-dev libode-dev libbullet-dev nvidia-cg-toolkit libgtk2.0-dev
+sudo apt-get install build-essential pkg-config python-dev libpng-dev libjpeg-dev libtiff-dev zlib1g-dev libssl-dev libx11-dev libgl1-mesa-dev libxrandr-dev libxxf86dga-dev libxcursor-dev bison flex libfreetype6-dev libvorbis-dev libeigen3-dev libopenal-dev libode-dev libbullet-dev nvidia-cg-toolkit libgtk2.0-dev libassimp-dev libopenexr-dev
 ```
 ```
 
 
 Once Panda3D has built, you can either install the .deb or .rpm package that
 Once Panda3D has built, you can either install the .deb or .rpm package that
@@ -163,6 +165,36 @@ python3.6 makepanda/makepanda.py --everything --installer --no-egl --no-gles --n
 If successful, this will produce a .pkg file in the root of the source
 If successful, this will produce a .pkg file in the root of the source
 directory which you can install using `pkg install`.
 directory which you can install using `pkg install`.
 
 
+Android
+-------
+
+Note: building on Android is very experimental and not guaranteed to work.
+
+You can experimentally build the Android Python runner via the [termux](https://termux.com/)
+shell.  You will need to install [Termux](https://play.google.com/store/apps/details?id=com.termux)
+and [Termux API](https://play.google.com/store/apps/details?id=com.termux.api)
+from the Play Store.  Many of the dependencies can be installed by running the
+following command in the Termux shell:
+
+```bash
+pkg install python-dev termux-tools ndk-stl ndk-sysroot clang libvorbis-dev libopus-dev opusfile-dev openal-soft-dev freetype-dev harfbuzz-dev libpng-dev ecj4.6 dx patchelf aapt apksigner libcrypt-dev
+```
+
+Then, you can build and install the .apk right away using these commands:
+
+```bash
+python makepanda/makepanda.py --everything --target android-21 --installer
+xdg-open panda3d.apk
+```
+
+To launch a Python program from Termux, you can use the `run_python.sh` script
+inside the `panda/src/android` directory.  It will launch Python in a separate
+activity, load it with the Python script you passed as argument, and use a
+socket for returning the command-line output to the Termux shell.  Do note
+that this requires the Python application to reside on the SD card and that
+Termux needs to be set up with access to the SD card (using the
+`termux-setup-storage` command).
+
 Running Tests
 Running Tests
 =============
 =============
 
 

+ 51 - 47
contrib/src/ai/aiBehaviors.cxx

@@ -13,6 +13,10 @@
 
 
 #include "aiBehaviors.h"
 #include "aiBehaviors.h"
 
 
+using std::cout;
+using std::endl;
+using std::string;
+
 static const float _PI = 3.14;
 static const float _PI = 3.14;
 
 
 AIBehaviors::AIBehaviors() {
 AIBehaviors::AIBehaviors() {
@@ -21,16 +25,16 @@ AIBehaviors::AIBehaviors() {
   _previous_conflict = false;
   _previous_conflict = false;
   _conflict = false;
   _conflict = false;
 
 
-  _seek_obj = NULL;
-  _flee_obj = NULL;
-  _pursue_obj = NULL;
-  _evade_obj = NULL;
-  _arrival_obj = NULL;
-  _wander_obj = NULL;
-  _flock_group = NULL;
-  _path_follow_obj = NULL;
-  _path_find_obj = NULL;
-  _obstacle_avoidance_obj = NULL;
+  _seek_obj = nullptr;
+  _flee_obj = nullptr;
+  _pursue_obj = nullptr;
+  _evade_obj = nullptr;
+  _arrival_obj = nullptr;
+  _wander_obj = nullptr;
+  _flock_group = nullptr;
+  _path_follow_obj = nullptr;
+  _path_find_obj = nullptr;
+  _obstacle_avoidance_obj = nullptr;
 
 
   turn_off("seek");
   turn_off("seek");
   turn_off("flee");
   turn_off("flee");
@@ -267,7 +271,7 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
     accumulate_force("obstacle_avoidance", force);
     accumulate_force("obstacle_avoidance", force);
   }
   }
 
 
-  if(_path_follow_obj!=NULL) {
+  if(_path_follow_obj!=nullptr) {
     if(_path_follow_obj->_start) {
     if(_path_follow_obj->_start) {
       _path_follow_obj->do_follow();
       _path_follow_obj->do_follow();
     }
     }
@@ -286,13 +290,13 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
   }
   }
 
 
   if(is_on(_arrival)) {
   if(is_on(_arrival)) {
-    if(_seek_obj != NULL) {
+    if(_seek_obj != nullptr) {
       LVecBase3 dirn = _steering_force;
       LVecBase3 dirn = _steering_force;
       dirn.normalize();
       dirn.normalize();
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * dirn);
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * dirn);
     }
     }
 
 
-    if(_pursue_obj != NULL) {
+    if(_pursue_obj != nullptr) {
       LVecBase3 dirn = _steering_force;
       LVecBase3 dirn = _steering_force;
       dirn.normalize();
       dirn.normalize();
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * _arrival_obj->_arrival_direction);
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * _arrival_obj->_arrival_direction);
@@ -320,10 +324,10 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_off("seek");
                 turn_off("seek");
                 delete _seek_obj;
                 delete _seek_obj;
-                _seek_obj = NULL;
+                _seek_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -338,10 +342,10 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -356,59 +360,59 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_off("arrival");
                 turn_off("arrival");
                 turn_off("arrival_activate");
                 turn_off("arrival_activate");
                 delete _arrival_obj;
                 delete _arrival_obj;
-                _arrival_obj = NULL;
+                _arrival_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_off("flock");
                 turn_off("flock");
                 turn_off("flock_activate");
                 turn_off("flock_activate");
-                _flock_group = NULL;
+                _flock_group = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_off("wander");
                 turn_off("wander");
                 delete _wander_obj;
                 delete _wander_obj;
-                _wander_obj = NULL;
+                _wander_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj !=NULL) {
+              if(_obstacle_avoidance_obj !=nullptr) {
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance");
                 delete _obstacle_avoidance_obj;
                 delete _obstacle_avoidance_obj;
-                _obstacle_avoidance_obj = NULL;
+                _obstacle_avoidance_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
                 delete _path_follow_obj;
                 delete _path_follow_obj;
-                _path_follow_obj = NULL;
+                _path_follow_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
                 delete _path_follow_obj;
                 delete _path_follow_obj;
-                _path_follow_obj = NULL;
+                _path_follow_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -436,7 +440,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_off("seek");
                 turn_off("seek");
               }
               }
               break;
               break;
@@ -451,7 +455,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
               }
               }
               break;
               break;
@@ -466,7 +470,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_off("arrival");
                 turn_off("arrival");
                 turn_off("arrival_activate");
                 turn_off("arrival_activate");
               }
               }
@@ -474,7 +478,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_off("flock");
                 turn_off("flock");
                 turn_off("flock_activate");
                 turn_off("flock_activate");
               }
               }
@@ -482,14 +486,14 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_off("wander");
                 turn_off("wander");
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj != NULL) {
+              if(_obstacle_avoidance_obj != nullptr) {
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance_activate");
                 turn_off("obstacle_avoidance_activate");
               }
               }
@@ -497,14 +501,14 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }
@@ -534,7 +538,7 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_on("seek");
                 turn_on("seek");
               }
               }
               break;
               break;
@@ -548,7 +552,7 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_on("pursue");
                 turn_on("pursue");
               }
               }
               break;
               break;
@@ -562,42 +566,42 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_on("arrival");
                 turn_on("arrival");
               }
               }
               break;
               break;
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_on("flock");
                 turn_on("flock");
               }
               }
               break;
               break;
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_on("wander");
                 turn_on("wander");
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj != NULL) {
+              if(_obstacle_avoidance_obj != nullptr) {
                 turn_on("obstacle_avoidance");
                 turn_on("obstacle_avoidance");
               }
               }
               break;
               break;
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_on("pursue");
                 turn_on("pursue");
                 _path_follow_obj->_start = true;
                 _path_follow_obj->_start = true;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }

+ 15 - 15
contrib/src/ai/aiBehaviors.h

@@ -28,8 +28,8 @@ class PathFollow;
 class PathFind;
 class PathFind;
 class ObstacleAvoidance;
 class ObstacleAvoidance;
 
 
-typedef list<Flee, allocator<Flee> > ListFlee;
-typedef list<Evade, allocator<Evade> > ListEvade;
+typedef std::list<Flee, std::allocator<Flee> > ListFlee;
+typedef std::list<Evade, std::allocator<Evade> > ListEvade;
 
 
 /**
 /**
  * This class implements all the steering behaviors of the AI framework, such
  * This class implements all the steering behaviors of the AI framework, such
@@ -113,21 +113,21 @@ public:
   ~AIBehaviors();
   ~AIBehaviors();
 
 
   bool is_on(_behavior_type bt);
   bool is_on(_behavior_type bt);
-  bool is_on(string ai_type); // special cases for pathfollow and pathfinding
+  bool is_on(std::string ai_type); // special cases for pathfollow and pathfinding
   bool is_off(_behavior_type bt);
   bool is_off(_behavior_type bt);
-  bool is_off(string ai_type); // special cases for pathfollow and pathfinding
-  void turn_on(string ai_type);
-  void turn_off(string ai_type);
+  bool is_off(std::string ai_type); // special cases for pathfollow and pathfinding
+  void turn_on(std::string ai_type);
+  void turn_off(std::string ai_type);
 
 
   bool is_conflict();
   bool is_conflict();
 
 
-  void accumulate_force(string force_type, LVecBase3 force);
+  void accumulate_force(std::string force_type, LVecBase3 force);
   LVecBase3 calculate_prioritized();
   LVecBase3 calculate_prioritized();
 
 
   void flock_activate();
   void flock_activate();
   LVecBase3 do_flock();
   LVecBase3 do_flock();
 
 
-  int char_to_int(string ai_type);
+  int char_to_int(std::string ai_type);
 
 
 PUBLISHED:
 PUBLISHED:
   void seek(NodePath target_object, float seek_wt = 1.0);
   void seek(NodePath target_object, float seek_wt = 1.0);
@@ -150,21 +150,21 @@ PUBLISHED:
 
 
   void path_follow(float follow_wt);
   void path_follow(float follow_wt);
   void add_to_path(LVecBase3 pos);
   void add_to_path(LVecBase3 pos);
-  void start_follow(string type = "normal");
+  void start_follow(std::string type = "normal");
 
 
   // should have different function names.
   // should have different function names.
   void init_path_find(const char* navmesh_filename);
   void init_path_find(const char* navmesh_filename);
-  void path_find_to(LVecBase3 pos, string type = "normal");
-  void path_find_to(NodePath target, string type = "normal");
+  void path_find_to(LVecBase3 pos, std::string type = "normal");
+  void path_find_to(NodePath target, std::string type = "normal");
   void add_static_obstacle(NodePath obstacle);
   void add_static_obstacle(NodePath obstacle);
   void add_dynamic_obstacle(NodePath obstacle);
   void add_dynamic_obstacle(NodePath obstacle);
 
 
 
 
-  void remove_ai(string ai_type);
-  void pause_ai(string ai_type);
-  void resume_ai(string ai_type);
+  void remove_ai(std::string ai_type);
+  void pause_ai(std::string ai_type);
+  void resume_ai(std::string ai_type);
 
 
-  string behavior_status(string ai_type);
+  std::string behavior_status(std::string ai_type);
 };
 };
 
 
 #endif
 #endif

+ 4 - 1
contrib/src/ai/aiCharacter.cxx

@@ -13,7 +13,7 @@
 
 
 #include "aiCharacter.h"
 #include "aiCharacter.h"
 
 
-AICharacter::AICharacter(string model_name, NodePath model_np, double mass, double movt_force, double max_force) {
+AICharacter::AICharacter(std::string model_name, NodePath model_np, double mass, double movt_force, double max_force) {
   _name = model_name;
   _name = model_name;
   _ai_char_np = model_np;
   _ai_char_np = model_np;
 
 
@@ -24,6 +24,8 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
   _velocity = LVecBase3(0.0, 0.0, 0.0);
   _velocity = LVecBase3(0.0, 0.0, 0.0);
   _steering_force = LVecBase3(0.0, 0.0, 0.0);
   _steering_force = LVecBase3(0.0, 0.0, 0.0);
 
 
+  _world = nullptr;
+
   _steering = new AIBehaviors();
   _steering = new AIBehaviors();
   _steering->_ai_char = this;
   _steering->_ai_char = this;
 
 
@@ -31,6 +33,7 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
 }
 }
 
 
 AICharacter::~AICharacter() {
 AICharacter::~AICharacter() {
+  nassertv(_world == nullptr);
 }
 }
 
 
 /**
 /**

+ 4 - 3
contrib/src/ai/aiCharacter.h

@@ -15,6 +15,7 @@
 #define _AICHARACTER_H
 #define _AICHARACTER_H
 
 
 #include "aiBehaviors.h"
 #include "aiBehaviors.h"
+#include "referenceCount.h"
 
 
 /**
 /**
  * This class is used for creating the AI characters.  It assigns both physics
  * This class is used for creating the AI characters.  It assigns both physics
@@ -25,13 +26,13 @@
 class AIBehaviors;
 class AIBehaviors;
 class AIWorld;
 class AIWorld;
 
 
-class EXPCL_PANDAAI AICharacter {
+class EXPCL_PANDAAI AICharacter : public ReferenceCount {
  public:
  public:
   double _mass;
   double _mass;
   double _max_force;
   double _max_force;
   LVecBase3 _velocity;
   LVecBase3 _velocity;
   LVecBase3 _steering_force;
   LVecBase3 _steering_force;
-  string _name;
+  std::string _name;
   double _movt_force;
   double _movt_force;
   unsigned int _ai_char_flock_id;
   unsigned int _ai_char_flock_id;
   AIWorld *_world;
   AIWorld *_world;
@@ -62,7 +63,7 @@ PUBLISHED:
     // This function is used to enable or disable the guides for path finding.
     // This function is used to enable or disable the guides for path finding.
     void set_pf_guide(bool pf_guide);
     void set_pf_guide(bool pf_guide);
 
 
-    explicit AICharacter(string model_name, NodePath model_np, double mass, double movt_force, double max_force);
+    explicit AICharacter(std::string model_name, NodePath model_np, double mass, double movt_force, double max_force);
     ~AICharacter();
     ~AICharacter();
 };
 };
 
 

+ 3 - 3
contrib/src/ai/aiNode.cxx

@@ -15,7 +15,7 @@
 
 
 AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   for (int i = 0; i < 8; ++i) {
   for (int i = 0; i < 8; ++i) {
-    _neighbours[i] = NULL;
+    _neighbours[i] = nullptr;
   }
   }
 
 
   _position = pos;
   _position = pos;
@@ -29,8 +29,8 @@ AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h)
   _score = 0;
   _score = 0;
   _cost = 0;
   _cost = 0;
   _heuristic = 0;
   _heuristic = 0;
-  _next = NULL;
-  _prv_node =  NULL;
+  _next = nullptr;
+  _prv_node =  nullptr;
 }
 }
 
 
 AINode::~AINode() {
 AINode::~AINode() {

+ 4 - 4
contrib/src/ai/aiPathFinder.cxx

@@ -74,7 +74,7 @@ void PathFinder::generate_path() {
       add_to_clist(nxt_node);
       add_to_clist(nxt_node);
     }
     }
   }
   }
-  cout<<"DESTINATION NOT REACHABLE MATE!"<<endl;
+  std::cout << "DESTINATION NOT REACHABLE MATE!" << std::endl;
   _closed_list.clear();
   _closed_list.clear();
 }
 }
 
 
@@ -87,7 +87,7 @@ void PathFinder::identify_neighbors(Node *parent_node) {
   // while adding new nodes to the open list heap.
   // while adding new nodes to the open list heap.
   remove_from_olist();
   remove_from_olist();
   for(int i = 0; i < 8; ++i) {
   for(int i = 0; i < 8; ++i) {
-    if(parent_node->_neighbours[i] != NULL) {
+    if(parent_node->_neighbours[i] != nullptr) {
       if(parent_node->_neighbours[i]->_status == parent_node->_neighbours[i]->neutral
       if(parent_node->_neighbours[i]->_status == parent_node->_neighbours[i]->neutral
         && parent_node->_neighbours[i]->_type == true) {
         && parent_node->_neighbours[i]->_type == true) {
         // Link the neighbor to the parent node.
         // Link the neighbor to the parent node.
@@ -340,10 +340,10 @@ Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size) {
 
 
   for(int i = 0; i < size; ++i) {
   for(int i = 0; i < size; ++i) {
     for(int j = 0; j < size; ++j) {
     for(int j = 0; j < size; ++j) {
-      if(nav_mesh[i][j] != NULL && nav_mesh[i][j]->contains(x, y)) {
+      if(nav_mesh[i][j] != nullptr && nav_mesh[i][j]->contains(x, y)) {
         return(nav_mesh[i][j]);
         return(nav_mesh[i][j]);
       }
       }
     }
     }
   }
   }
-  return NULL;
+  return nullptr;
 }
 }

+ 4 - 4
contrib/src/ai/aiPathFinder.h

@@ -18,8 +18,8 @@
 #include "cmath.h"
 #include "cmath.h"
 #include "lineSegs.h"
 #include "lineSegs.h"
 
 
-typedef vector<Node *> NodeArray;
-typedef vector<NodeArray> NavMesh;
+typedef std::vector<Node *> NodeArray;
+typedef std::vector<NodeArray> NavMesh;
 
 
 Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size);
 Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size);
 
 
@@ -32,8 +32,8 @@ class EXPCL_PANDAAI PathFinder {
 public:
 public:
   Node *_src_node;
   Node *_src_node;
   Node *_dest_node;
   Node *_dest_node;
-  vector<Node*> _open_list;
-  vector<Node*> _closed_list;
+  std::vector<Node*> _open_list;
+  std::vector<Node*> _closed_list;
 
 
   NavMesh _grid;
   NavMesh _grid;
 
 

+ 33 - 105
contrib/src/ai/aiWorld.cxx

@@ -14,44 +14,56 @@
 #include "aiWorld.h"
 #include "aiWorld.h"
 
 
 AIWorld::AIWorld(NodePath render) {
 AIWorld::AIWorld(NodePath render) {
-  _ai_char_pool = new AICharPool();
-  _render = render;
+  _render = std::move(render);
 }
 }
 
 
 AIWorld::~AIWorld() {
 AIWorld::~AIWorld() {
 }
 }
 
 
 void AIWorld::add_ai_char(AICharacter *ai_char) {
 void AIWorld::add_ai_char(AICharacter *ai_char) {
-  _ai_char_pool->append(ai_char);
+  _ai_char_pool.push_back(ai_char);
   ai_char->_window_render = _render;
   ai_char->_window_render = _render;
   ai_char->_world = this;
   ai_char->_world = this;
 }
 }
 
 
-void AIWorld::remove_ai_char(string name) {
-  _ai_char_pool->del(name);
-  remove_ai_char_from_flock(name);
+void AIWorld::remove_ai_char(std::string name) {
+  AICharPool::iterator it;
+  for (it = _ai_char_pool.begin(); it != _ai_char_pool.end(); ++it) {
+    AICharacter *ai_char = *it;
+    if (ai_char->_name == name) {
+      nassertv(ai_char->_world == this);
+      ai_char->_world = nullptr;
+      _ai_char_pool.erase(it);
+      break;
+    }
+  }
+
+  remove_ai_char_from_flock(std::move(name));
 }
 }
 
 
-void AIWorld::remove_ai_char_from_flock(string name) {
-  AICharPool::node *ai_pool;
-  ai_pool = _ai_char_pool->_head;
-  while((ai_pool) != NULL) {
-    for(unsigned int i = 0; i < _flock_pool.size(); ++i) {
-      if(ai_pool->_ai_char->_ai_char_flock_id == _flock_pool[i]->get_id()) {
-        for(unsigned int j = 0; j<_flock_pool[i]->_ai_char_list.size(); ++j) {
-          if(_flock_pool[i]->_ai_char_list[j]->_name == name) {
-            _flock_pool[i]->_ai_char_list.erase(_flock_pool[i]->_ai_char_list.begin() + j);
+void AIWorld::remove_ai_char_from_flock(std::string name) {
+  for (AICharacter *ai_char : _ai_char_pool) {
+    for (Flock *flock : _flock_pool) {
+      if (ai_char->_ai_char_flock_id == flock->get_id()) {
+        for (size_t j = 0; j < flock->_ai_char_list.size(); ++j) {
+          if (flock->_ai_char_list[j]->_name == name) {
+            flock->_ai_char_list.erase(flock->_ai_char_list.begin() + j);
             return;
             return;
           }
           }
         }
         }
       }
       }
     }
     }
-    ai_pool = ai_pool->_next;
   }
   }
 }
 }
 
 
+/**
+ * This function prints the names of the AI characters that have been added to
+ * the AIWorld.  Useful for debugging purposes.
+ */
 void AIWorld::print_list() {
 void AIWorld::print_list() {
-  _ai_char_pool->print_list();
+  for (AICharacter *ai_char : _ai_char_pool) {
+    std::cout << ai_char->_name << std::endl;
+  }
 }
 }
 
 
 /**
 /**
@@ -59,12 +71,8 @@ void AIWorld::print_list() {
  * characters which have been added to the AIWorld.
  * characters which have been added to the AIWorld.
  */
  */
 void AIWorld::update() {
 void AIWorld::update() {
-  AICharPool::node *ai_pool;
-  ai_pool = _ai_char_pool->_head;
-
-  while((ai_pool)!=NULL) {
-    ai_pool->_ai_char->update();
-    ai_pool = ai_pool->_next;
+  for (AICharacter *ai_char : _ai_char_pool) {
+    ai_char->update();
   }
   }
 }
 }
 
 
@@ -91,7 +99,7 @@ Flock AIWorld::get_flock(unsigned int flock_id) {
       return *_flock_pool[i];
       return *_flock_pool[i];
     }
     }
   }
   }
-  Flock *null_flock = NULL;
+  Flock *null_flock = nullptr;
   return *null_flock;
   return *null_flock;
 }
 }
 
 
@@ -104,7 +112,7 @@ void AIWorld::remove_flock(unsigned int flock_id) {
        for(unsigned int j = 0; j < _flock_pool[i]->_ai_char_list.size(); ++j) {
        for(unsigned int j = 0; j < _flock_pool[i]->_ai_char_list.size(); ++j) {
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock_activate");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock_activate");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock");
-         _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->_flock_group = NULL;
+         _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->_flock_group = nullptr;
        }
        }
        _flock_pool.erase(_flock_pool.begin() + i);
        _flock_pool.erase(_flock_pool.begin() + i);
        break;
        break;
@@ -142,86 +150,6 @@ void AIWorld::flock_on(unsigned int flock_id) {
   }
   }
 }
 }
 
 
-AICharPool::AICharPool() {
-  _head = NULL;
-}
-
-AICharPool::~AICharPool() {
-}
-
-void AICharPool::append(AICharacter *ai_ch) {
-  node *q;
-  node *t;
-
-  if(_head == NULL) {
-    q = new node();
-    q->_ai_char = ai_ch;
-    q->_next = NULL;
-    _head = q;
-  }
-  else {
-    q = _head;
-    while( q->_next != NULL) {
-      q = q->_next;
-    }
-
-    t = new node();
-    t->_ai_char = ai_ch;
-    t->_next = NULL;
-    q->_next = t;
-  }
-}
-
-void AICharPool::del(string name) {
-  node *q;
-  node *r;
-  q = _head;
-
-  if(_head==NULL) {
-    return;
-  }
-
-  // Only one node in the linked list
-  if(q->_next == NULL) {
-    if(q->_ai_char->_name == name) {
-      _head = NULL;
-      delete q;
-    }
-    return;
-  }
-
-  r = q;
-  while( q != NULL) {
-    if( q->_ai_char->_name == name) {
-      // Special case
-      if(q == _head) {
-        _head = q->_next;
-        delete q;
-        return;
-      }
-
-      r->_next = q->_next;
-      delete q;
-      return;
-    }
-    r = q;
-    q = q->_next;
-  }
-}
-
-/**
- * This function prints the ai characters in the AICharPool.  Used for
- * debugging purposes.
- */
-void AICharPool::print_list() {
-  node* q;
-  q = _head;
-  while(q != NULL) {
-    cout<<q->_ai_char->_name<<endl;
-    q = q->_next;
-  }
-}
-
 /**
 /**
  * This function adds the nodepath as an obstacle that is needed by the
  * This function adds the nodepath as an obstacle that is needed by the
  * obstacle avoidance behavior.
  * obstacle avoidance behavior.

+ 5 - 25
contrib/src/ai/aiWorld.h

@@ -21,27 +21,6 @@
 class AICharacter;
 class AICharacter;
 class Flock;
 class Flock;
 
 
-/**
- * This class implements a linked list of AI Characters allowing the user to
- * add and delete characters from the linked list.  This will be used in the
- * AIWorld class.
- */
-class EXPCL_PANDAAI AICharPool {
-    public:
-    struct node {
-      AICharacter * _ai_char;
-      node * _next;
-    } ;
-
-    node* _head;
-    AICharPool();
-    ~AICharPool();
-    void append(AICharacter *ai_ch);
-    void del(string name);
-        void print_list();
-};
-
-
 /**
 /**
  * A class that implements the virtual AI world which keeps track of the AI
  * A class that implements the virtual AI world which keeps track of the AI
  * characters active at any given time.  It contains a linked list of AI
  * characters active at any given time.  It contains a linked list of AI
@@ -51,20 +30,21 @@ class EXPCL_PANDAAI AICharPool {
  */
  */
 class EXPCL_PANDAAI AIWorld {
 class EXPCL_PANDAAI AIWorld {
   private:
   private:
-    AICharPool * _ai_char_pool;
+    typedef std::vector<PT(AICharacter)> AICharPool;
+    AICharPool _ai_char_pool;
     NodePath _render;
     NodePath _render;
   public:
   public:
-    vector<NodePath> _obstacles;
+    std::vector<NodePath> _obstacles;
     typedef std::vector<Flock*> FlockPool;
     typedef std::vector<Flock*> FlockPool;
     FlockPool _flock_pool;
     FlockPool _flock_pool;
-    void remove_ai_char_from_flock(string name);
+    void remove_ai_char_from_flock(std::string name);
 
 
 PUBLISHED:
 PUBLISHED:
     AIWorld(NodePath render);
     AIWorld(NodePath render);
     ~AIWorld();
     ~AIWorld();
 
 
     void add_ai_char(AICharacter *ai_ch);
     void add_ai_char(AICharacter *ai_ch);
-    void remove_ai_char(string name);
+    void remove_ai_char(std::string name);
 
 
     void add_flock(Flock *flock);
     void add_flock(Flock *flock);
     void flock_off(unsigned int flock_id);
     void flock_off(unsigned int flock_id);

+ 4 - 4
contrib/src/ai/arrival.cxx

@@ -48,7 +48,7 @@ LVecBase3 Arrival::do_arrival() {
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_arrival_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_arrival_force = LVecBase3(0.0, 0.0, 0.0);
 
 
-    if(_ai_char->_steering->_seek_obj != NULL) {
+    if(_ai_char->_steering->_seek_obj != nullptr) {
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_on("arrival_activate");
       _ai_char->_steering->turn_on("arrival_activate");
     }
     }
@@ -62,11 +62,11 @@ LVecBase3 Arrival::do_arrival() {
   double u = _ai_char->get_velocity().length();
   double u = _ai_char->get_velocity().length();
   LVecBase3 desired_force = ((u * u) / (2 * distance)) * _ai_char->get_mass();
   LVecBase3 desired_force = ((u * u) / (2 * distance)) * _ai_char->get_mass();
 
 
-  if(_ai_char->_steering->_seek_obj != NULL) {
+  if(_ai_char->_steering->_seek_obj != nullptr) {
     return(desired_force);
     return(desired_force);
   }
   }
 
 
-  if(_ai_char->_steering->_pursue_obj != NULL) {
+  if(_ai_char->_steering->_pursue_obj != nullptr) {
 
 
     if(distance > _arrival_distance) {
     if(distance > _arrival_distance) {
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_off("arrival");
@@ -77,7 +77,7 @@ LVecBase3 Arrival::do_arrival() {
     return(desired_force);
     return(desired_force);
   }
   }
 
 
-  cout<<"Arrival works only with seek and pursue"<<endl;
+  std::cout << "Arrival works only with seek and pursue" << std::endl;
   return(LVecBase3(0.0, 0.0, 0.0));
   return(LVecBase3(0.0, 0.0, 0.0));
 }
 }
 
 

+ 1 - 1
contrib/src/ai/flock.h

@@ -40,7 +40,7 @@ public:
   unsigned int _alignment_wt;
   unsigned int _alignment_wt;
 
 
   // This vector will hold all the ai characters which belong to this flock.
   // This vector will hold all the ai characters which belong to this flock.
-  typedef std::vector<AICharacter*> AICharList;
+  typedef std::vector<PT(AICharacter)> AICharList;
   AICharList _ai_char_list;
   AICharList _ai_char_list;
 
 
 PUBLISHED:
 PUBLISHED:

+ 3 - 3
contrib/src/ai/meshNode.cxx

@@ -3,7 +3,7 @@
 
 
 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   for(int i = 0; i < 8; ++i) {
   for(int i = 0; i < 8; ++i) {
-    _neighbours[i] = NULL;
+    _neighbours[i] = nullptr;
   }
   }
 
 
   _position = pos;
   _position = pos;
@@ -17,8 +17,8 @@ Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   _score = 0;
   _score = 0;
   _cost = 0;
   _cost = 0;
   _heuristic = 0;
   _heuristic = 0;
-  _next = NULL;
-  _prv_node =  NULL;
+  _next = nullptr;
+  _prv_node =  nullptr;
 }
 }
 
 
 Node::~Node() {
 Node::~Node() {

+ 0 - 1
contrib/src/ai/obstacleAvoidance.cxx

@@ -36,7 +36,6 @@ obstacle_detection() {
   double distance = 0x7fff ;
   double distance = 0x7fff ;
   double expanded_radius = 0;
   double expanded_radius = 0;
   LVecBase3 to_obstacle;
   LVecBase3 to_obstacle;
-  LVecBase3 prev_avoidance;
   for(unsigned int i = 0; i < _ai_char->_world->_obstacles.size(); ++i) {
   for(unsigned int i = 0; i < _ai_char->_world->_obstacles.size(); ++i) {
     PT(BoundingVolume) bounds = _ai_char->_world->_obstacles[i].get_bounds();
     PT(BoundingVolume) bounds = _ai_char->_world->_obstacles[i].get_bounds();
     CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere();
     CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere();

+ 25 - 21
contrib/src/ai/pathFind.cxx

@@ -13,6 +13,10 @@
 
 
 #include "pathFind.h"
 #include "pathFind.h"
 
 
+using std::cout;
+using std::endl;
+using std::string;
+
 PathFind::PathFind(AICharacter *ai_ch) {
 PathFind::PathFind(AICharacter *ai_ch) {
   _ai_char = ai_ch;
   _ai_char = ai_ch;
 
 
@@ -23,7 +27,7 @@ PathFind::PathFind(AICharacter *ai_ch) {
   _pen->set_color(1.0, 0.0, 0.0);
   _pen->set_color(1.0, 0.0, 0.0);
   _pen->set_thickness(2.0);
   _pen->set_thickness(2.0);
 
 
-  _path_finder_obj = NULL;
+  _path_finder_obj = nullptr;
   _dynamic_avoid = false;
   _dynamic_avoid = false;
 }
 }
 
 
@@ -46,7 +50,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
   string fields[10];
   string fields[10];
 
 
   // Open data file for reading.
   // Open data file for reading.
-  ifstream nav_mesh_file (navmesh_filename);
+  std::ifstream nav_mesh_file (navmesh_filename);
 
 
   if(nav_mesh_file.is_open()) {
   if(nav_mesh_file.is_open()) {
     // Capture the grid size from the file.
     // Capture the grid size from the file.
@@ -56,9 +60,9 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
 
 
     // Initialize the stage mesh with NULL nodes.
     // Initialize the stage mesh with NULL nodes.
     for(int r = 0; r < _grid_size; ++r) {
     for(int r = 0; r < _grid_size; ++r) {
-      _nav_mesh.push_back(vector<Node*>());
+      _nav_mesh.push_back(std::vector<Node*>());
       for(int c = 0; c < _grid_size; ++c) {
       for(int c = 0; c < _grid_size; ++c) {
-        _nav_mesh[r].push_back(NULL);
+        _nav_mesh[r].push_back(nullptr);
       }
       }
     }
     }
 
 
@@ -68,7 +72,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
     // Begin reading data from the file.
     // Begin reading data from the file.
     while(!nav_mesh_file.eof()) {
     while(!nav_mesh_file.eof()) {
       getline(nav_mesh_file, line);
       getline(nav_mesh_file, line);
-      stringstream linestream (line);
+      std::stringstream linestream (line);
 
 
       // Stores all the data members in the line to the array.  Data
       // Stores all the data members in the line to the array.  Data
       // structure:
       // structure:
@@ -111,7 +115,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
  * _nav_mesh.
  * _nav_mesh.
  */
  */
 void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
 void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
-  ifstream nav_mesh_file (navmesh_filename);
+  std::ifstream nav_mesh_file (navmesh_filename);
 
 
   // Stage variables.
   // Stage variables.
   int gd_x, gd_y, gd_xn, gd_yn;
   int gd_x, gd_y, gd_xn, gd_yn;
@@ -125,7 +129,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
 
 
     while(!nav_mesh_file.eof()) {
     while(!nav_mesh_file.eof()) {
       getline(nav_mesh_file, ln); // Gets main node data only. No neighbor nodes.
       getline(nav_mesh_file, ln); // Gets main node data only. No neighbor nodes.
-      stringstream linestream (ln);
+      std::stringstream linestream (ln);
       for(int i = 0; i < 10; ++i) {
       for(int i = 0; i < 10; ++i) {
         getline(linestream, fields[i], ',');
         getline(linestream, fields[i], ',');
       }
       }
@@ -135,7 +139,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
         gd_y = atoi(fields[3].c_str());
         gd_y = atoi(fields[3].c_str());
         for(int i = 0; i < 8; ++i) {
         for(int i = 0; i < 8; ++i) {
           getline(nav_mesh_file, ln); // Gets neighbor node data only. No main nodes.
           getline(nav_mesh_file, ln); // Gets neighbor node data only. No main nodes.
-          stringstream linestream_n (ln);
+          std::stringstream linestream_n (ln);
           for(int j = 0; j < 10; ++j) {
           for(int j = 0; j < 10; ++j) {
             getline(linestream_n, fields_n[j], ',');
             getline(linestream_n, fields_n[j], ',');
           }
           }
@@ -150,7 +154,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
           }
           }
           else if(fields_n[0] == "1" && fields_n[1] == "1") {
           else if(fields_n[0] == "1" && fields_n[1] == "1") {
             // NULL neighbor.
             // NULL neighbor.
-            _nav_mesh[gd_y][gd_x]->_neighbours[i] = NULL;
+            _nav_mesh[gd_y][gd_x]->_neighbours[i] = nullptr;
           }
           }
           else {
           else {
             cout<<"Warning: Corrupt data!"<<endl;
             cout<<"Warning: Corrupt data!"<<endl;
@@ -183,7 +187,7 @@ void PathFind::set_path_find(const char* navmesh_filename) {
 
 
   if(_path_finder_obj) {
   if(_path_finder_obj) {
     delete _path_finder_obj;
     delete _path_finder_obj;
-    _path_finder_obj = NULL;
+    _path_finder_obj = nullptr;
   }
   }
 
 
   _path_finder_obj = new PathFinder(_nav_mesh);
   _path_finder_obj = new PathFinder(_nav_mesh);
@@ -207,17 +211,17 @@ void PathFind::path_find(LVecBase3 pos, string type) {
 
 
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
 
 
-  if(src == NULL) {
+  if(src == nullptr) {
     cout<<"couldnt find source"<<endl;
     cout<<"couldnt find source"<<endl;
   }
   }
 
 
   Node* dst = find_in_mesh(_nav_mesh, pos, _grid_size);
   Node* dst = find_in_mesh(_nav_mesh, pos, _grid_size);
 
 
-  if(dst == NULL) {
+  if(dst == nullptr) {
     cout<<"couldnt find destination"<<endl;
     cout<<"couldnt find destination"<<endl;
   }
   }
 
 
-  if(src != NULL && dst != NULL) {
+  if(src != nullptr && dst != nullptr) {
     _path_finder_obj->find_path(src, dst);
     _path_finder_obj->find_path(src, dst);
     trace_path(src);
     trace_path(src);
   }
   }
@@ -248,22 +252,22 @@ void PathFind::path_find(NodePath target, string type) {
 
 
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
 
 
-  if(src == NULL) {
+  if(src == nullptr) {
     cout<<"couldnt find source"<<endl;
     cout<<"couldnt find source"<<endl;
   }
   }
 
 
   Node* dst = find_in_mesh(_nav_mesh, _prev_position, _grid_size);
   Node* dst = find_in_mesh(_nav_mesh, _prev_position, _grid_size);
 
 
-  if(dst == NULL) {
+  if(dst == nullptr) {
     cout<<"couldnt find destination"<<endl;
     cout<<"couldnt find destination"<<endl;
   }
   }
 
 
-  if(src != NULL && dst != NULL) {
+  if(src != nullptr && dst != nullptr) {
     _path_finder_obj->find_path(src, dst);
     _path_finder_obj->find_path(src, dst);
     trace_path(src);
     trace_path(src);
   }
   }
 
 
-  if(_ai_char->_steering->_path_follow_obj!=NULL) {
+  if(_ai_char->_steering->_path_follow_obj!=nullptr) {
     if(!_ai_char->_steering->_path_follow_obj->_start) {
     if(!_ai_char->_steering->_path_follow_obj->_start) {
       _ai_char->_steering->start_follow("pathfind");
       _ai_char->_steering->start_follow("pathfind");
     }
     }
@@ -277,12 +281,12 @@ void PathFind::clear_path() {
   // Initialize to zero
   // Initialize to zero
   for(int i = 0; i < _grid_size; ++i) {
   for(int i = 0; i < _grid_size; ++i) {
     for(int j = 0; j < _grid_size; ++j) {
     for(int j = 0; j < _grid_size; ++j) {
-      if(_nav_mesh[i][j] != NULL) {
+      if(_nav_mesh[i][j] != nullptr) {
         _nav_mesh[i][j]->_status = _nav_mesh[i][j]->neutral;
         _nav_mesh[i][j]->_status = _nav_mesh[i][j]->neutral;
         _nav_mesh[i][j]->_cost = 0;
         _nav_mesh[i][j]->_cost = 0;
         _nav_mesh[i][j]->_heuristic = 0;
         _nav_mesh[i][j]->_heuristic = 0;
         _nav_mesh[i][j]->_score = 0;
         _nav_mesh[i][j]->_score = 0;
-        _nav_mesh[i][j]->_prv_node = NULL;
+        _nav_mesh[i][j]->_prv_node = nullptr;
       }
       }
     }
     }
   }
   }
@@ -333,7 +337,7 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
 
 
   Node* temp = find_in_mesh(_nav_mesh, obstacle.get_pos(), _grid_size);
   Node* temp = find_in_mesh(_nav_mesh, obstacle.get_pos(), _grid_size);
 
 
-  if(temp != NULL) {
+  if(temp != nullptr) {
     float left = temp->_position.get_x() - np_sphere->get_radius();
     float left = temp->_position.get_x() - np_sphere->get_radius();
     float right = temp->_position.get_x() + np_sphere->get_radius();
     float right = temp->_position.get_x() + np_sphere->get_radius();
     float top = temp->_position.get_y() + np_sphere->get_radius();
     float top = temp->_position.get_y() + np_sphere->get_radius();
@@ -341,7 +345,7 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
 
 
     for(int i = 0; i < _grid_size; ++i) {
     for(int i = 0; i < _grid_size; ++i) {
         for(int j = 0; j < _grid_size; ++j) {
         for(int j = 0; j < _grid_size; ++j) {
-          if(_nav_mesh[i][j] != NULL && _nav_mesh[i][j]->_type == true) {
+          if(_nav_mesh[i][j] != nullptr && _nav_mesh[i][j]->_type == true) {
             if(_nav_mesh[i][j]->_position.get_x() >= left && _nav_mesh[i][j]->_position.get_x() <= right &&
             if(_nav_mesh[i][j]->_position.get_x() >= left && _nav_mesh[i][j]->_position.get_x() <= right &&
                _nav_mesh[i][j]->_position.get_y() >= down && _nav_mesh[i][j]->_position.get_y() <= top) {
                _nav_mesh[i][j]->_position.get_y() >= down && _nav_mesh[i][j]->_position.get_y() <= top) {
               _nav_mesh[i][j]->_type = false;
               _nav_mesh[i][j]->_type = false;

+ 4 - 4
contrib/src/ai/pathFind.h

@@ -40,9 +40,9 @@ public:
   LVecBase3 _prev_position;
   LVecBase3 _prev_position;
   PT(GeomNode) _parent;
   PT(GeomNode) _parent;
   LineSegs *_pen;
   LineSegs *_pen;
-  vector<int> _previous_obstacles;
+  std::vector<int> _previous_obstacles;
   bool _dynamic_avoid;
   bool _dynamic_avoid;
-  vector<NodePath> _dynamic_obstacle;
+  std::vector<NodePath> _dynamic_obstacle;
 
 
   PathFind(AICharacter *ai_ch);
   PathFind(AICharacter *ai_ch);
   ~PathFind();
   ~PathFind();
@@ -56,8 +56,8 @@ public:
   void clear_previous_obstacles();
   void clear_previous_obstacles();
 
 
   void set_path_find(const char* navmesh_filename);
   void set_path_find(const char* navmesh_filename);
-  void path_find(LVecBase3 pos, string type = "normal");
-  void path_find(NodePath target, string type = "normal");
+  void path_find(LVecBase3 pos, std::string type = "normal");
+  void path_find(NodePath target, std::string type = "normal");
   void add_obstacle_to_mesh(NodePath obstacle);
   void add_obstacle_to_mesh(NodePath obstacle);
   void dynamic_avoid(NodePath obstacle);
   void dynamic_avoid(NodePath obstacle);
 };
 };

+ 1 - 1
contrib/src/ai/pathFollow.cxx

@@ -23,7 +23,7 @@ void PathFollow::add_to_path(LVecBase3 pos) {
 /**
 /**
  * This function initiates the path follow behavior.
  * This function initiates the path follow behavior.
  */
  */
-void PathFollow::start(string type) {
+void PathFollow::start(std::string type) {
     _type = type;
     _type = type;
   _start = true;
   _start = true;
   if(_path.size() > 0) {
   if(_path.size() > 0) {

+ 3 - 3
contrib/src/ai/pathFollow.h

@@ -13,18 +13,18 @@ class EXPCL_PANDAAI PathFollow {
 public:
 public:
   AICharacter *_ai_char;
   AICharacter *_ai_char;
   float _follow_weight;
   float _follow_weight;
-  vector<LVecBase3> _path;
+  std::vector<LVecBase3> _path;
   int _curr_path_waypoint;
   int _curr_path_waypoint;
   bool _start;
   bool _start;
   NodePath _dummy;
   NodePath _dummy;
-  string _type;
+  std::string _type;
   ClockObject *_myClock;
   ClockObject *_myClock;
   float _time;
   float _time;
 
 
   PathFollow(AICharacter *ai_ch, float follow_wt);
   PathFollow(AICharacter *ai_ch, float follow_wt);
   ~PathFollow();
   ~PathFollow();
   void add_to_path(LVecBase3 pos);
   void add_to_path(LVecBase3 pos);
-  void start(string type);
+  void start(std::string type);
   void do_follow();
   void do_follow();
   bool check_if_possible();
   bool check_if_possible();
 };
 };

BIN
contrib/src/panda3dtoolsgui/pandaIcon.ico


+ 2 - 2
contrib/src/rplight/gpuCommand.I

@@ -24,7 +24,7 @@
  *
  *
  */
  */
 
 
-#include "stdint.h"
+#include <stdint.h>
 
 
 /**
 /**
  * @brief Appends an integer to the GPUCommand.
  * @brief Appends an integer to the GPUCommand.
@@ -74,7 +74,7 @@ inline float GPUCommand::convert_int_to_float(int v) const {
  */
  */
 inline void GPUCommand::push_float(float v) {
 inline void GPUCommand::push_float(float v) {
   if (_current_index >= GPU_COMMAND_ENTRIES) {
   if (_current_index >= GPU_COMMAND_ENTRIES) {
-    gpucommand_cat.error() << "Out of bounds! Exceeded command size of " << GPU_COMMAND_ENTRIES << endl;
+    gpucommand_cat.error() << "Out of bounds! Exceeded command size of " << GPU_COMMAND_ENTRIES << std::endl;
     return;
     return;
   }
   }
   _data[_current_index++] = v;
   _data[_current_index++] = v;

+ 4 - 4
contrib/src/rplight/gpuCommand.cxx

@@ -57,13 +57,13 @@ GPUCommand::GPUCommand(CommandType command_type) {
  *   in mind that integers might be shown in their binary float representation,
  *   in mind that integers might be shown in their binary float representation,
  *   depending on the setting in the GPUCommand::convert_int_to_float method.
  *   depending on the setting in the GPUCommand::convert_int_to_float method.
  */
  */
-void GPUCommand::write(ostream &out) const {
-  out << "GPUCommand(type=" << _command_type << ", size=" << _current_index << ", data = {" << endl;
+void GPUCommand::write(std::ostream &out) const {
+  out << "GPUCommand(type=" << _command_type << ", size=" << _current_index << ", data = {" << std::endl;
   for (size_t k = 0; k < GPU_COMMAND_ENTRIES; ++k) {
   for (size_t k = 0; k < GPU_COMMAND_ENTRIES; ++k) {
     out << std::setw(12) << std::fixed << std::setprecision(5) << _data[k] << " ";
     out << std::setw(12) << std::fixed << std::setprecision(5) << _data[k] << " ";
-    if (k % 6 == 5 || k == GPU_COMMAND_ENTRIES - 1) out << endl;
+    if (k % 6 == 5 || k == GPU_COMMAND_ENTRIES - 1) out << std::endl;
   }
   }
-  out << "})" << endl;
+  out << "})" << std::endl;
 }
 }
 
 
 /**
 /**

+ 1 - 1
contrib/src/rplight/gpuCommand.h

@@ -73,7 +73,7 @@ PUBLISHED:
   inline static bool get_uses_integer_packing();
   inline static bool get_uses_integer_packing();
 
 
   void write_to(const PTA_uchar &dest, size_t command_index);
   void write_to(const PTA_uchar &dest, size_t command_index);
-  void write(ostream &out) const;
+  void write(std::ostream &out) const;
 
 
 private:
 private:
 
 

+ 1 - 1
contrib/src/rplight/gpuCommandList.h

@@ -48,7 +48,7 @@ PUBLISHED:
   MAKE_PROPERTY(num_commands, get_num_commands);
   MAKE_PROPERTY(num_commands, get_num_commands);
 
 
 protected:
 protected:
-  queue<GPUCommand> _commands;
+  std::queue<GPUCommand> _commands;
 };
 };
 
 
 #endif // GPUCOMMANDLIST_H
 #endif // GPUCOMMANDLIST_H

+ 4 - 2
contrib/src/rplight/iesDataset.cxx

@@ -27,7 +27,9 @@
 
 
 #include "iesDataset.h"
 #include "iesDataset.h"
 
 
+#ifndef _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
+#endif
 #include <math.h>
 #include <math.h>
 
 
 NotifyCategoryDef(iesdataset, "")
 NotifyCategoryDef(iesdataset, "")
@@ -139,7 +141,7 @@ float IESDataset::get_candela_value(float vertical_angle, float horizontal_angle
         iesdataset_cat.error() << "Invalid horizontal lerp: " << lerp
         iesdataset_cat.error() << "Invalid horizontal lerp: " << lerp
                      << ", requested angle was " << horizontal_angle
                      << ", requested angle was " << horizontal_angle
                      << ", prev = " << prev_angle << ", cur = " << curr_angle
                      << ", prev = " << prev_angle << ", cur = " << curr_angle
-                     << endl;
+                     << std::endl;
       }
       }
 
 
       return curr_value * lerp + prev_value * (1-lerp);
       return curr_value * lerp + prev_value * (1-lerp);
@@ -190,7 +192,7 @@ float IESDataset::get_vertical_candela_value(size_t horizontal_angle_idx, float
         iesdataset_cat.error() << "ERROR: Invalid vertical lerp: " << lerp
         iesdataset_cat.error() << "ERROR: Invalid vertical lerp: " << lerp
                      << ", requested angle was " << vertical_angle
                      << ", requested angle was " << vertical_angle
                      << ", prev = " << prev_angle << ", cur = " << curr_angle
                      << ", prev = " << prev_angle << ", cur = " << curr_angle
-                     << endl;
+                     << std::endl;
       }
       }
 
 
       return curr_value * lerp + prev_value * (1-lerp);
       return curr_value * lerp + prev_value * (1-lerp);

+ 5 - 3
contrib/src/rplight/internalLightManager.cxx

@@ -29,6 +29,8 @@
 
 
 #include <algorithm>
 #include <algorithm>
 
 
+using std::endl;
+
 NotifyCategoryDef(lightmgr, "");
 NotifyCategoryDef(lightmgr, "");
 
 
 
 
@@ -133,7 +135,7 @@ void InternalLightManager::setup_shadows(RPLight* light) {
   }
   }
 
 
   // Init all sources
   // Init all sources
-  for (int i = 0; i < num_sources; ++i) {
+  for (size_t i = 0; i < num_sources; ++i) {
     ShadowSource* source = light->get_shadow_source(i);
     ShadowSource* source = light->get_shadow_source(i);
 
 
     // Set the source as dirty, so it gets updated in the beginning
     // Set the source as dirty, so it gets updated in the beginning
@@ -355,7 +357,7 @@ bool InternalLightManager::compare_shadow_sources(const ShadowSource* a, const S
 void InternalLightManager::update_shadow_sources() {
 void InternalLightManager::update_shadow_sources() {
 
 
   // Find all dirty shadow sources and make a list of them
   // Find all dirty shadow sources and make a list of them
-  vector<ShadowSource*> sources_to_update;
+  std::vector<ShadowSource*> sources_to_update;
    for (auto iter = _shadow_sources.begin(); iter != _shadow_sources.end(); ++iter) {
    for (auto iter = _shadow_sources.begin(); iter != _shadow_sources.end(); ++iter) {
     ShadowSource* source = *iter;
     ShadowSource* source = *iter;
     if (source) {
     if (source) {
@@ -393,7 +395,7 @@ void InternalLightManager::update_shadow_sources() {
 
 
   // Free the regions of all sources which will get updated. We have to take into
   // Free the regions of all sources which will get updated. We have to take into
   // account that only a limited amount of sources can get updated per frame.
   // account that only a limited amount of sources can get updated per frame.
-  size_t update_slots = min(sources_to_update.size(),
+  size_t update_slots = std::min(sources_to_update.size(),
                 _shadow_manager->get_num_update_slots_left());
                 _shadow_manager->get_num_update_slots_left());
   for(size_t i = 0; i < update_slots; ++i) {
   for(size_t i = 0; i < update_slots; ++i) {
     if (sources_to_update[i]->has_region()) {
     if (sources_to_update[i]->has_region()) {

+ 3 - 2
contrib/src/rplight/pointerSlotStorage.h

@@ -45,6 +45,7 @@ class PointerSlotStorage {};
 using std::tr1::array;
 using std::tr1::array;
 #else
 #else
 #include <array>
 #include <array>
+using std::array;
 #endif
 #endif
 
 
 /**
 /**
@@ -169,7 +170,7 @@ public:
     _num_entries--;
     _num_entries--;
 
 
     // Update maximum index
     // Update maximum index
-    if (slot == _max_index) {
+    if ((int)slot == _max_index) {
       while (_max_index >= 0 && !_data[_max_index--]);
       while (_max_index >= 0 && !_data[_max_index--]);
     }
     }
   }
   }
@@ -202,7 +203,7 @@ public:
     nassertv(slot >= 0 && slot < SIZE);
     nassertv(slot >= 0 && slot < SIZE);
     nassertv(_data[slot] == nullptr); // Slot already taken!
     nassertv(_data[slot] == nullptr); // Slot already taken!
     nassertv(ptr != nullptr); // nullptr passed as argument!
     nassertv(ptr != nullptr); // nullptr passed as argument!
-    _max_index = max(_max_index, (int)slot);
+    _max_index = std::max(_max_index, (int)slot);
     _data[slot] = ptr;
     _data[slot] = ptr;
     _num_entries++;
     _num_entries++;
   }
   }

+ 2 - 0
contrib/src/rplight/pssmCameraRig.cxx

@@ -27,7 +27,9 @@
 
 
 #include "pssmCameraRig.h"
 #include "pssmCameraRig.h"
 
 
+#ifndef _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
+#endif
 #include <math.h>
 #include <math.h>
 #include "orthographicLens.h"
 #include "orthographicLens.h"
 
 

+ 3 - 3
contrib/src/rplight/pssmCameraRig.h

@@ -96,9 +96,9 @@ protected:
   inline LPoint3 get_interpolated_point(CoordinateOrigin origin, float depth);
   inline LPoint3 get_interpolated_point(CoordinateOrigin origin, float depth);
   LVecBase3 get_snap_offset(const LMatrix4& mat, size_t resolution);
   LVecBase3 get_snap_offset(const LMatrix4& mat, size_t resolution);
 
 
-  vector<NodePath> _cam_nodes;
-  vector<Camera*> _cameras;
-  vector<LVecBase2> _max_film_sizes;
+  std::vector<NodePath> _cam_nodes;
+  std::vector<Camera*> _cameras;
+  std::vector<LVecBase2> _max_film_sizes;
 
 
   // Current near and far points
   // Current near and far points
   // Order: UL, UR, LL, LR (See CoordinateOrigin)
   // Order: UL, UR, LL, LR (See CoordinateOrigin)

+ 2 - 2
contrib/src/rplight/rpLight.I

@@ -33,7 +33,7 @@
  *
  *
  * @return Amount of shadow sources
  * @return Amount of shadow sources
  */
  */
-inline int RPLight::get_num_shadow_sources() const {
+inline size_t RPLight::get_num_shadow_sources() const {
   return _shadow_sources.size();
   return _shadow_sources.size();
 }
 }
 
 
@@ -278,7 +278,7 @@ inline RPLight::LightType RPLight::get_light_type() const {
  */
  */
 inline void RPLight::set_casts_shadows(bool flag) {
 inline void RPLight::set_casts_shadows(bool flag) {
   if (has_slot()) {
   if (has_slot()) {
-    cerr << "Light is already attached, can not call set_casts_shadows!" << endl;
+    std::cerr << "Light is already attached, can not call set_casts_shadows!" << std::endl;
     return;
     return;
   }
   }
   _casts_shadows = flag;
   _casts_shadows = flag;

+ 2 - 2
contrib/src/rplight/rpLight.h

@@ -57,7 +57,7 @@ public:
   virtual void update_shadow_sources() = 0;
   virtual void update_shadow_sources() = 0;
   virtual void write_to_command(GPUCommand &cmd);
   virtual void write_to_command(GPUCommand &cmd);
 
 
-  inline int get_num_shadow_sources() const;
+  inline size_t get_num_shadow_sources() const;
   inline ShadowSource* get_shadow_source(size_t index) const;
   inline ShadowSource* get_shadow_source(size_t index) const;
   inline void clear_shadow_sources();
   inline void clear_shadow_sources();
 
 
@@ -122,7 +122,7 @@ protected:
   LightType _light_type;
   LightType _light_type;
   float _near_plane;
   float _near_plane;
 
 
-  vector<ShadowSource*> _shadow_sources;
+  std::vector<ShadowSource*> _shadow_sources;
 };
 };
 
 
 #include "rpLight.I"
 #include "rpLight.I"

+ 2 - 0
contrib/src/rplight/rpSpotLight.cxx

@@ -27,7 +27,9 @@
 
 
 #include "rpSpotLight.h"
 #include "rpSpotLight.h"
 
 
+#ifndef _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
+#endif
 #include <math.h>
 #include <math.h>
 
 
 
 

+ 1 - 1
contrib/src/rplight/shadowAtlas.I

@@ -118,7 +118,7 @@ inline int ShadowAtlas::get_required_tiles(size_t resolution) const {
 
 
   if (resolution % _tile_size != 0) {
   if (resolution % _tile_size != 0) {
     shadowatlas_cat.error() << "Resolution " << resolution << " is not a multiple "
     shadowatlas_cat.error() << "Resolution " << resolution << " is not a multiple "
-                << "of the shadow atlas tile size (" << _tile_size << ")!" << endl;
+                << "of the shadow atlas tile size (" << _tile_size << ")!" << std::endl;
     return 1;
     return 1;
   }
   }
   return resolution / _tile_size;
   return resolution / _tile_size;

+ 6 - 6
contrib/src/rplight/shadowAtlas.cxx

@@ -131,13 +131,13 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
 
 
   // Check for empty region
   // Check for empty region
   if (tile_width < 1 || tile_height < 1) {
   if (tile_width < 1 || tile_height < 1) {
-    shadowatlas_cat.error() << "Called find_and_reserve_region with null-region!" << endl;
+    shadowatlas_cat.error() << "Called find_and_reserve_region with null-region!" << std::endl;
     return LVecBase4i(-1);
     return LVecBase4i(-1);
   }
   }
 
 
   // Check for region bigger than the shadow atlas
   // Check for region bigger than the shadow atlas
   if (tile_width > _num_tiles || tile_height > _num_tiles) {
   if (tile_width > _num_tiles || tile_height > _num_tiles) {
-    shadowatlas_cat.error() << "Requested region exceeds shadow atlas size!" << endl;
+    shadowatlas_cat.error() << "Requested region exceeds shadow atlas size!" << std::endl;
     return LVecBase4i(-1);
     return LVecBase4i(-1);
   }
   }
 
 
@@ -155,7 +155,7 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
   // When we reached this part, we couldn't find a free region, so the atlas
   // When we reached this part, we couldn't find a free region, so the atlas
   // seems to be full.
   // seems to be full.
   shadowatlas_cat.error() << "Failed to find a free region of size " << tile_width
   shadowatlas_cat.error() << "Failed to find a free region of size " << tile_width
-              << " x " << tile_height << "!"  << endl;
+              << " x " << tile_height << "!"  << std::endl;
   return LVecBase4i(-1);
   return LVecBase4i(-1);
 }
 }
 
 
@@ -173,12 +173,12 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
 void ShadowAtlas::free_region(const LVecBase4i& region) {
 void ShadowAtlas::free_region(const LVecBase4i& region) {
   // Out of bounds check, can't hurt
   // Out of bounds check, can't hurt
   nassertv(region.get_x() >= 0 && region.get_y() >= 0);
   nassertv(region.get_x() >= 0 && region.get_y() >= 0);
-  nassertv(region.get_x() + region.get_z() <= _num_tiles && region.get_y() + region.get_w() <= _num_tiles);
+  nassertv(region.get_x() + region.get_z() <= (int)_num_tiles && region.get_y() + region.get_w() <= (int)_num_tiles);
 
 
   _num_used_tiles -= region.get_z() * region.get_w();
   _num_used_tiles -= region.get_z() * region.get_w();
 
 
-  for (size_t x = 0; x < region.get_z(); ++x) {
-    for (size_t y = 0; y < region.get_w(); ++y) {
+  for (int x = 0; x < region.get_z(); ++x) {
+    for (int y = 0; y < region.get_w(); ++y) {
       // Could do an assert here, that the tile should have been used (=true) before
       // Could do an assert here, that the tile should have been used (=true) before
       set_tile(region.get_x() + x, region.get_y() + y, false);
       set_tile(region.get_x() + x, region.get_y() + y, false);
     }
     }

+ 2 - 2
contrib/src/rplight/shadowManager.I

@@ -52,7 +52,7 @@ inline void ShadowManager::set_max_updates(size_t max_updates) {
   nassertv(max_updates >= 0);
   nassertv(max_updates >= 0);
   nassertv(_atlas == nullptr);  // ShadowManager was already initialized
   nassertv(_atlas == nullptr);  // ShadowManager was already initialized
   if (max_updates == 0) {
   if (max_updates == 0) {
-    shadowmanager_cat.warning() << "max_updates set to 0, no shadows will be updated." << endl;
+    shadowmanager_cat.warning() << "max_updates set to 0, no shadows will be updated." << std::endl;
   }
   }
   _max_updates = max_updates;
   _max_updates = max_updates;
 }
 }
@@ -170,7 +170,7 @@ inline bool ShadowManager::add_update(const ShadowSource* source) {
 
 
   if (_queued_updates.size() >= _max_updates) {
   if (_queued_updates.size() >= _max_updates) {
     if (shadowmanager_cat.is_debug()) {
     if (shadowmanager_cat.is_debug()) {
-      shadowmanager_cat.debug() << "cannot update source, out of update slots" << endl;
+      shadowmanager_cat.debug() << "cannot update source, out of update slots" << std::endl;
     }
     }
     return false;
     return false;
   }
   }

+ 5 - 5
contrib/src/rplight/tagStateManager.I

@@ -35,7 +35,7 @@
  * @param source Camera which will be used to render shadows
  * @param source Camera which will be used to render shadows
  */
  */
 inline void TagStateManager::
 inline void TagStateManager::
-register_camera(const string& name, Camera* source) {
+register_camera(const std::string& name, Camera* source) {
   ContainerList::iterator entry = _containers.find(name);
   ContainerList::iterator entry = _containers.find(name);
   nassertv(entry != _containers.end());
   nassertv(entry != _containers.end());
   register_camera(entry->second, source);
   register_camera(entry->second, source);
@@ -49,7 +49,7 @@ register_camera(const string& name, Camera* source) {
  * @param source Camera to unregister
  * @param source Camera to unregister
  */
  */
 inline void TagStateManager::
 inline void TagStateManager::
-unregister_camera(const string& name, Camera* source) {
+unregister_camera(const std::string& name, Camera* source) {
   ContainerList::iterator entry = _containers.find(name);
   ContainerList::iterator entry = _containers.find(name);
   nassertv(entry != _containers.end());
   nassertv(entry != _containers.end());
   unregister_camera(entry->second, source);
   unregister_camera(entry->second, source);
@@ -67,8 +67,8 @@ unregister_camera(const string& name, Camera* source) {
  * @param sort Determines the sort with which the shader will be applied.
  * @param sort Determines the sort with which the shader will be applied.
  */
  */
 inline void TagStateManager::
 inline void TagStateManager::
-apply_state(const string& state, NodePath np, Shader* shader,
-            const string &name, int sort) {
+apply_state(const std::string& state, NodePath np, Shader* shader,
+            const std::string &name, int sort) {
   ContainerList::iterator entry = _containers.find(state);
   ContainerList::iterator entry = _containers.find(state);
   nassertv(entry != _containers.end());
   nassertv(entry != _containers.end());
   apply_state(entry->second, np, shader, name, sort);
   apply_state(entry->second, np, shader, name, sort);
@@ -83,7 +83,7 @@ apply_state(const string& state, NodePath np, Shader* shader,
  * @return Bit mask of the render pass
  * @return Bit mask of the render pass
  */
  */
 inline BitMask32 TagStateManager::
 inline BitMask32 TagStateManager::
-get_mask(const string &container_name) {
+get_mask(const std::string &container_name) {
   if (container_name == "gbuffer") {
   if (container_name == "gbuffer") {
     return BitMask32::bit(1);
     return BitMask32::bit(1);
   }
   }

+ 3 - 1
contrib/src/rplight/tagStateManager.cxx

@@ -27,6 +27,8 @@
 
 
 #include "tagStateManager.h"
 #include "tagStateManager.h"
 
 
+using std::endl;
+
 
 
 NotifyCategoryDef(tagstatemgr, "");
 NotifyCategoryDef(tagstatemgr, "");
 
 
@@ -77,7 +79,7 @@ TagStateManager::
  */
  */
 void TagStateManager::
 void TagStateManager::
 apply_state(StateContainer& container, NodePath np, Shader* shader,
 apply_state(StateContainer& container, NodePath np, Shader* shader,
-            const string &name, int sort) {
+            const std::string &name, int sort) {
   if (tagstatemgr_cat.is_spam()) {
   if (tagstatemgr_cat.is_spam()) {
     tagstatemgr_cat.spam() << "Constructing new state " << name
     tagstatemgr_cat.spam() << "Constructing new state " << name
                  << " with shader " << shader << endl;
                  << " with shader " << shader << endl;

+ 10 - 10
contrib/src/rplight/tagStateManager.h

@@ -52,36 +52,36 @@ PUBLISHED:
   TagStateManager(NodePath main_cam_node);
   TagStateManager(NodePath main_cam_node);
   ~TagStateManager();
   ~TagStateManager();
 
 
-  inline void apply_state(const string& state, NodePath np, Shader* shader, const string &name, int sort);
+  inline void apply_state(const std::string& state, NodePath np, Shader* shader, const std::string &name, int sort);
   void cleanup_states();
   void cleanup_states();
 
 
-  inline void register_camera(const string& state, Camera* source);
-  inline void unregister_camera(const string& state, Camera* source);
-  inline BitMask32 get_mask(const string &container_name);
+  inline void register_camera(const std::string& state, Camera* source);
+  inline void unregister_camera(const std::string& state, Camera* source);
+  inline BitMask32 get_mask(const std::string &container_name);
 
 
 private:
 private:
-  typedef vector<Camera*> CameraList;
-  typedef pmap<string, CPT(RenderState)> TagStateList;
+  typedef std::vector<Camera*> CameraList;
+  typedef pmap<std::string, CPT(RenderState)> TagStateList;
 
 
   struct StateContainer {
   struct StateContainer {
     CameraList cameras;
     CameraList cameras;
     TagStateList tag_states;
     TagStateList tag_states;
-    string tag_name;
+    std::string tag_name;
     BitMask32 mask;
     BitMask32 mask;
     bool write_color;
     bool write_color;
 
 
     StateContainer() {};
     StateContainer() {};
-    StateContainer(const string &tag_name, size_t mask, bool write_color)
+    StateContainer(const std::string &tag_name, size_t mask, bool write_color)
       : tag_name(tag_name), mask(BitMask32::bit(mask)), write_color(write_color) {};
       : tag_name(tag_name), mask(BitMask32::bit(mask)), write_color(write_color) {};
   };
   };
 
 
   void apply_state(StateContainer& container, NodePath np, Shader* shader,
   void apply_state(StateContainer& container, NodePath np, Shader* shader,
-                   const string& name, int sort);
+                   const std::string& name, int sort);
   void cleanup_container_states(StateContainer& container);
   void cleanup_container_states(StateContainer& container);
   void register_camera(StateContainer &container, Camera* source);
   void register_camera(StateContainer &container, Camera* source);
   void unregister_camera(StateContainer &container, Camera* source);
   void unregister_camera(StateContainer &container, Camera* source);
 
 
-  typedef pmap<string, StateContainer> ContainerList;
+  typedef pmap<std::string, StateContainer> ContainerList;
   ContainerList _containers;
   ContainerList _containers;
 
 
   NodePath _main_cam_node;
   NodePath _main_cam_node;

+ 1 - 1
contrib/src/sceneeditor/MetadataPanel.py

@@ -36,7 +36,7 @@ class MetadataPanel(AppShell,Pmw.MegaWidget):
 
 
 
 
     def appInit(self):
     def appInit(self):
-        print "Metadata Panel"
+        print("Metadata Panel")
 
 
     def createInterface(self):
     def createInterface(self):
         interior = self.interior()
         interior = self.interior()

+ 37 - 29
contrib/src/sceneeditor/SideWindow.py

@@ -6,8 +6,16 @@ from direct.tkwidgets.AppShell import AppShell
 from direct.tkwidgets.VectorWidgets import ColorEntry
 from direct.tkwidgets.VectorWidgets import ColorEntry
 from direct.showbase.TkGlobal import spawnTkLoop
 from direct.showbase.TkGlobal import spawnTkLoop
 import seSceneGraphExplorer
 import seSceneGraphExplorer
-from Tkinter import Frame, IntVar, Checkbutton, Toplevel
-import Pmw, Tkinter
+
+import Pmw, sys
+
+if sys.version_info >= (3, 0):
+    from tkinter import Frame, IntVar, Checkbutton, Toplevel
+    import tkinter
+else:
+    from Tkinter import Frame, IntVar, Checkbutton, Toplevel
+    import Tkinter as tkinter
+
 
 
 class sideWindow(AppShell):
 class sideWindow(AppShell):
     #################################################################
     #################################################################
@@ -65,7 +73,7 @@ class sideWindow(AppShell):
         self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
         self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
 
 
     def appInit(self):
     def appInit(self):
-        print '----SideWindow is Initialized!!'
+        print('----SideWindow is Initialized!!')
 
 
     def createInterface(self):
     def createInterface(self):
         # The interior of the toplevel panel
         # The interior of the toplevel panel
@@ -73,7 +81,7 @@ class sideWindow(AppShell):
         mainFrame = Frame(interior)
         mainFrame = Frame(interior)
         ## Creat NoteBook
         ## Creat NoteBook
         self.notebookFrame = Pmw.NoteBook(mainFrame)
         self.notebookFrame = Pmw.NoteBook(mainFrame)
-        self.notebookFrame.pack(fill=Tkinter.BOTH,expand=1)
+        self.notebookFrame.pack(fill=tkinter.BOTH,expand=1)
         sgePage = self.notebookFrame.add('Tree Graph')
         sgePage = self.notebookFrame.add('Tree Graph')
         envPage = self.notebookFrame.add('World Setting')
         envPage = self.notebookFrame.add('World Setting')
         self.notebookFrame['raisecommand'] = self.updateInfo
         self.notebookFrame['raisecommand'] = self.updateInfo
@@ -83,7 +91,7 @@ class sideWindow(AppShell):
             sgePage, nodePath = render,
             sgePage, nodePath = render,
             scrolledCanvas_hull_width = 270,
             scrolledCanvas_hull_width = 270,
             scrolledCanvas_hull_height = 570)
             scrolledCanvas_hull_height = 570)
-        self.SGE.pack(fill = Tkinter.BOTH, expand = 0)
+        self.SGE.pack(fill = tkinter.BOTH, expand = 0)
 
 
         ## World Setting Page
         ## World Setting Page
         envPage = Frame(envPage)
         envPage = Frame(envPage)
@@ -95,8 +103,8 @@ class sideWindow(AppShell):
             text = 'Enable Lighting',
             text = 'Enable Lighting',
             variable = self.LightingVar,
             variable = self.LightingVar,
             command = self.toggleLights)
             command = self.toggleLights)
-        self.LightingButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.LightingButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.CollisionVar = IntVar()
         self.CollisionVar = IntVar()
@@ -106,8 +114,8 @@ class sideWindow(AppShell):
             text = 'Show Collision Object',
             text = 'Show Collision Object',
             variable = self.CollisionVar,
             variable = self.CollisionVar,
             command = self.showCollision)
             command = self.showCollision)
-        self.CollisionButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.CollisionButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.ParticleVar = IntVar()
         self.ParticleVar = IntVar()
@@ -117,8 +125,8 @@ class sideWindow(AppShell):
             text = 'Show Particle Dummy',
             text = 'Show Particle Dummy',
             variable = self.ParticleVar,
             variable = self.ParticleVar,
             command = self.enableParticle)
             command = self.enableParticle)
-        self.ParticleButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.ParticleButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.baseUseDriveVar = IntVar()
         self.baseUseDriveVar = IntVar()
@@ -128,8 +136,8 @@ class sideWindow(AppShell):
             text = 'Enable base.usedrive',
             text = 'Enable base.usedrive',
             variable = self.baseUseDriveVar,
             variable = self.baseUseDriveVar,
             command = self.enablebaseUseDrive)
             command = self.enablebaseUseDrive)
-        self.baseUseDriveButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.baseUseDriveButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.backfaceVar = IntVar()
         self.backfaceVar = IntVar()
@@ -139,8 +147,8 @@ class sideWindow(AppShell):
             text = 'Enable BackFace',
             text = 'Enable BackFace',
             variable = self.backfaceVar,
             variable = self.backfaceVar,
             command = self.toggleBackface)
             command = self.toggleBackface)
-        self.backfaceButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.backfaceButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.textureVar = IntVar()
         self.textureVar = IntVar()
@@ -150,8 +158,8 @@ class sideWindow(AppShell):
             text = 'Enable Texture',
             text = 'Enable Texture',
             variable = self.textureVar,
             variable = self.textureVar,
             command = self.toggleTexture)
             command = self.toggleTexture)
-        self.textureButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.textureButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.wireframeVar = IntVar()
         self.wireframeVar = IntVar()
@@ -161,8 +169,8 @@ class sideWindow(AppShell):
             text = 'Enable Wireframe',
             text = 'Enable Wireframe',
             variable = self.wireframeVar,
             variable = self.wireframeVar,
             command = self.toggleWireframe)
             command = self.toggleWireframe)
-        self.wireframeButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.wireframeButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.gridVar = IntVar()
         self.gridVar = IntVar()
@@ -172,8 +180,8 @@ class sideWindow(AppShell):
             text = 'Enable Grid',
             text = 'Enable Grid',
             variable = self.gridVar,
             variable = self.gridVar,
             command = self.toggleGrid)
             command = self.toggleGrid)
-        self.gridButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.gridButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.widgetVisVar = IntVar()
         self.widgetVisVar = IntVar()
@@ -183,8 +191,8 @@ class sideWindow(AppShell):
             text = 'Enable WidgetVisible',
             text = 'Enable WidgetVisible',
             variable = self.widgetVisVar,
             variable = self.widgetVisVar,
             command = self.togglewidgetVis)
             command = self.togglewidgetVis)
-        self.widgetVisButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.widgetVisButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.enableAutoCameraVar = IntVar()
         self.enableAutoCameraVar = IntVar()
@@ -194,17 +202,17 @@ class sideWindow(AppShell):
             text = 'Enable Auto Camera Movement for Loading Objects',
             text = 'Enable Auto Camera Movement for Loading Objects',
             variable = self.enableAutoCameraVar,
             variable = self.enableAutoCameraVar,
             command = self.toggleAutoCamera)
             command = self.toggleAutoCamera)
-        self.enableAutoCameraButton.pack(side=Tkinter.LEFT, expand=False)
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        self.enableAutoCameraButton.pack(side=tkinter.LEFT, expand=False)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         pageFrame = Frame(envPage)
         pageFrame = Frame(envPage)
         self.backgroundColor = ColorEntry(
         self.backgroundColor = ColorEntry(
             pageFrame, text = 'BG Color', value=self.worldColor)
             pageFrame, text = 'BG Color', value=self.worldColor)
         self.backgroundColor['command'] = self.setBackgroundColorVec
         self.backgroundColor['command'] = self.setBackgroundColorVec
         self.backgroundColor['resetValue'] = [0,0,0,0]
         self.backgroundColor['resetValue'] = [0,0,0,0]
-        self.backgroundColor.pack(side=Tkinter.LEFT, expand=False)
+        self.backgroundColor.pack(side=tkinter.LEFT, expand=False)
         self.bind(self.backgroundColor, 'Set background color')
         self.bind(self.backgroundColor, 'Set background color')
-        pageFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True)
+        pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
 
 
         envPage.pack(expand=False)
         envPage.pack(expand=False)
 
 
@@ -320,11 +328,11 @@ class sideWindow(AppShell):
         #
         #
         #################################################################
         #################################################################
         if self.enableBaseUseDrive==0:
         if self.enableBaseUseDrive==0:
-            print 'Enabled'
+            print('Enabled')
             base.useDrive()
             base.useDrive()
             self.enableBaseUseDrive = 1
             self.enableBaseUseDrive = 1
         else:
         else:
-            print 'disabled'
+            print('disabled')
             #base.useTrackball()
             #base.useTrackball()
             base.disableMouse()
             base.disableMouse()
             self.enableBaseUseDrive = 0
             self.enableBaseUseDrive = 0

+ 3 - 4
contrib/src/sceneeditor/collisionWindow.py

@@ -9,9 +9,8 @@ from seColorEntry import *
 from direct.tkwidgets import VectorWidgets
 from direct.tkwidgets import VectorWidgets
 from direct.tkwidgets import Floater
 from direct.tkwidgets import Floater
 from direct.tkwidgets import Slider
 from direct.tkwidgets import Slider
-from Tkinter import *
 import string, math, types
 import string, math, types
-from pandac.PandaModules import *
+from panda3d.core import *
 
 
 
 
 class collisionWindow(AppShell):
 class collisionWindow(AppShell):
@@ -195,7 +194,7 @@ class collisionWindow(AppShell):
         # put the object into a CollisionNode and attach it to the target nodePath
         # put the object into a CollisionNode and attach it to the target nodePath
         #################################################################
         #################################################################
         collisionObject = None
         collisionObject = None
-        print self.objType
+        print(self.objType)
         if self.objType=='collisionPolygon':
         if self.objType=='collisionPolygon':
             pointA =  Point3(float(self.widgetDict['PolygonPoint A'][0]._entry.get()),
             pointA =  Point3(float(self.widgetDict['PolygonPoint A'][0]._entry.get()),
                              float(self.widgetDict['PolygonPoint A'][1]._entry.get()),
                              float(self.widgetDict['PolygonPoint A'][1]._entry.get()),
@@ -236,7 +235,7 @@ class collisionWindow(AppShell):
                            float(self.widgetDict['RayDirection'][1]._entry.get()),
                            float(self.widgetDict['RayDirection'][1]._entry.get()),
                            float(self.widgetDict['RayDirection'][2]._entry.get()))
                            float(self.widgetDict['RayDirection'][2]._entry.get()))
 
 
-            print vector, point
+            print(vector, point)
 
 
             collisionObject = CollisionRay()
             collisionObject = CollisionRay()
             collisionObject.setOrigin(point)
             collisionObject.setOrigin(point)

+ 186 - 180
contrib/src/sceneeditor/controllerWindow.py

@@ -4,8 +4,14 @@
 #################################################################
 #################################################################
 
 
 from direct.tkwidgets.AppShell import AppShell
 from direct.tkwidgets.AppShell import AppShell
-from Tkinter import Frame, Label, Button
-import string, Pmw, Tkinter
+import sys, Pmw
+
+if sys.version_info >= (3, 0):
+    from tkinter import Frame, Label, Button
+    import tkinter
+else:
+    from Tkinter import Frame, Label, Button
+    import Tkinter as tkinter
 
 
 # Define the Category
 # Define the Category
 KEYBOARD = 'Keyboard-'
 KEYBOARD = 'Keyboard-'
@@ -75,11 +81,11 @@ class controllerWindow(AppShell):
         self.cotrollerTypeEntry = self.createcomponent(
         self.cotrollerTypeEntry = self.createcomponent(
             'Controller Type', (), None,
             'Controller Type', (), None,
             Pmw.ComboBox, (frame,),
             Pmw.ComboBox, (frame,),
-            labelpos = Tkinter.W, label_text='Controller Type:', entry_width = 20,entry_state = Tkinter.DISABLED,
+            labelpos = tkinter.W, label_text='Controller Type:', entry_width = 20,entry_state = tkinter.DISABLED,
             selectioncommand = self.setControllerType,
             selectioncommand = self.setControllerType,
             scrolledlist_items = self.controllerList)
             scrolledlist_items = self.controllerList)
-        self.cotrollerTypeEntry.pack(side=Tkinter.LEFT)
-        frame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=False, pady = 3)
+        self.cotrollerTypeEntry.pack(side=tkinter.LEFT)
+        frame.pack(side=tkinter.TOP, fill=tkinter.X, expand=False, pady = 3)
         self.cotrollerTypeEntry.selectitem('Keyboard', setentry=True)
         self.cotrollerTypeEntry.selectitem('Keyboard', setentry=True)
 
 
         self.inputZone = Pmw.Group(mainFrame, tag_pyclass = None)
         self.inputZone = Pmw.Group(mainFrame, tag_pyclass = None)
@@ -102,7 +108,7 @@ class controllerWindow(AppShell):
         keyboardPage = self.objNotebook.add('Keyboard')
         keyboardPage = self.objNotebook.add('Keyboard')
         tarckerPage = self.objNotebook.add('Tracker')
         tarckerPage = self.objNotebook.add('Tracker')
         self.objNotebook.selectpage('Keyboard')
         self.objNotebook.selectpage('Keyboard')
-        self.objNotebook.pack(side = Tkinter.TOP, fill='both',expand=False)
+        self.objNotebook.pack(side = tkinter.TOP, fill='both',expand=False)
         # Put this here so it isn't called right away
         # Put this here so it isn't called right away
         self.objNotebook['raisecommand'] = self.updateControlInfo
         self.objNotebook['raisecommand'] = self.updateControlInfo
 
 
@@ -113,11 +119,11 @@ class controllerWindow(AppShell):
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Target Type', (), None,
             'Target Type', (), None,
             Pmw.ComboBox, (Interior,),
             Pmw.ComboBox, (Interior,),
-            labelpos = Tkinter.W, label_text='Target Object:', entry_width = 20, entry_state = Tkinter.DISABLED,
+            labelpos = tkinter.W, label_text='Target Object:', entry_width = 20, entry_state = tkinter.DISABLED,
             selectioncommand = self.setTargetObj,
             selectioncommand = self.setTargetObj,
             scrolledlist_items = self.listOfObj)
             scrolledlist_items = self.listOfObj)
-        widget.pack(side=Tkinter.LEFT, padx=3)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 5)
+        widget.pack(side=tkinter.LEFT, padx=3)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 5)
         widget.selectitem(self.nameOfNode, setentry=True)
         widget.selectitem(self.nameOfNode, setentry=True)
         self.widgetsDict[KEYBOARD+'ObjList'] = widget
         self.widgetsDict[KEYBOARD+'ObjList'] = widget
 
 
@@ -126,411 +132,411 @@ class controllerWindow(AppShell):
         settingFrame = inputZone.interior()
         settingFrame = inputZone.interior()
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Assign a Key For:').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True,pady = 6 )
+        widget = Label(Interior, text = 'Assign a Key For:').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True,pady = 6 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Forward   :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Forward   :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Forward key', (), None,
             'Forward key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyForward'],
             value = self.keyboardMapDict['KeyForward'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyForward'] = widget
         self.widgetsDict[KEYBOARD+'KeyForward'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Forward Speed', (), None,
             'Forward Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedForward'],
             value = self.keyboardSpeedDict['SpeedForward'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedForward'] = widget
         self.widgetsDict[KEYBOARD+'SpeedForward'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Backward  :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Backward  :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Backward key', (), None,
             'Backward key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyBackward'],
             value = self.keyboardMapDict['KeyBackward'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyBackward'] = widget
         self.widgetsDict[KEYBOARD+'KeyBackward'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Backward Speed', (), None,
             'Backward Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedBackward'],
             value = self.keyboardSpeedDict['SpeedBackward'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedBackward'] = widget
         self.widgetsDict[KEYBOARD+'SpeedBackward'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Right     :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Right     :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Right key', (), None,
             'Right key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyRight'],
             value = self.keyboardMapDict['KeyRight'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyRight'] = widget
         self.widgetsDict[KEYBOARD+'KeyRight'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Right Speed', (), None,
             'Right Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedRight'],
             value = self.keyboardSpeedDict['SpeedRight'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedRight'] = widget
         self.widgetsDict[KEYBOARD+'SpeedRight'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Left      :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Left      :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Left key', (), None,
             'Left key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyLeft'],
             value = self.keyboardMapDict['KeyLeft'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyLeft'] = widget
         self.widgetsDict[KEYBOARD+'KeyLeft'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Left Speed', (), None,
             'Left Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedLeft'],
             value = self.keyboardSpeedDict['SpeedLeft'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedLeft'] = widget
         self.widgetsDict[KEYBOARD+'SpeedLeft'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Up        :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Up        :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Up key', (), None,
             'Up key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyUp'],
             value = self.keyboardMapDict['KeyUp'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyUp'] = widget
         self.widgetsDict[KEYBOARD+'KeyUp'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Up Speed', (), None,
             'Up Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedUp'],
             value = self.keyboardSpeedDict['SpeedUp'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedUp'] = widget
         self.widgetsDict[KEYBOARD+'SpeedUp'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Down      :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Down      :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Down key', (), None,
             'Down key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyDown'],
             value = self.keyboardMapDict['KeyDown'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyDown'] = widget
         self.widgetsDict[KEYBOARD+'KeyDown'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Down Speed', (), None,
             'Down Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedDown'],
             value = self.keyboardSpeedDict['SpeedDown'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedDown'] = widget
         self.widgetsDict[KEYBOARD+'SpeedDown'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Turn Right:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Turn Right:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn Right key', (), None,
             'Turn Right key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyTurnRight'],
             value = self.keyboardMapDict['KeyTurnRight'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyTurnRight'] = widget
         self.widgetsDict[KEYBOARD+'KeyTurnRight'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn Right Speed', (), None,
             'Turn Right Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedTurnRight'],
             value = self.keyboardSpeedDict['SpeedTurnRight'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedTurnRight'] = widget
         self.widgetsDict[KEYBOARD+'SpeedTurnRight'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Turn Left :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Turn Left :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn Left key', (), None,
             'Turn Left key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyTurnLeft'],
             value = self.keyboardMapDict['KeyTurnLeft'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyTurnLeft'] = widget
         self.widgetsDict[KEYBOARD+'KeyTurnLeft'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn Left Speed', (), None,
             'Turn Left Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedTurnLeft'],
             value = self.keyboardSpeedDict['SpeedTurnLeft'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedTurnLeft'] = widget
         self.widgetsDict[KEYBOARD+'SpeedTurnLeft'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Turn UP   :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Turn UP   :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn UP key', (), None,
             'Turn UP key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyTurnUp'],
             value = self.keyboardMapDict['KeyTurnUp'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyTurnUp'] = widget
         self.widgetsDict[KEYBOARD+'KeyTurnUp'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn UP Speed', (), None,
             'Turn UP Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedTurnUp'],
             value = self.keyboardSpeedDict['SpeedTurnUp'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedTurnUp'] = widget
         self.widgetsDict[KEYBOARD+'SpeedTurnUp'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Turn Down :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Turn Down :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn Down key', (), None,
             'Turn Down key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyTurnDown'],
             value = self.keyboardMapDict['KeyTurnDown'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyTurnDown'] = widget
         self.widgetsDict[KEYBOARD+'KeyTurnDown'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Turn Down Speed', (), None,
             'Turn Down Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedTurnDown'],
             value = self.keyboardSpeedDict['SpeedTurnDown'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedTurnDown'] = widget
         self.widgetsDict[KEYBOARD+'SpeedTurnDown'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Roll Right:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Roll Right:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Roll Right key', (), None,
             'Roll Right key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyRollRight'],
             value = self.keyboardMapDict['KeyRollRight'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyRollRight'] = widget
         self.widgetsDict[KEYBOARD+'KeyRollRight'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Roll Right Speed', (), None,
             'Roll Right Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedRollRight'],
             value = self.keyboardSpeedDict['SpeedRollRight'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedRollRight'] = widget
         self.widgetsDict[KEYBOARD+'SpeedRollRight'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Roll Left :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Roll Left :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Roll Left key', (), None,
             'Roll Left key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyRollLeft'],
             value = self.keyboardMapDict['KeyRollLeft'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyRollLeft'] = widget
         self.widgetsDict[KEYBOARD+'KeyRollLeft'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Roll Left Speed', (), None,
             'Roll Left Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedRollLeft'],
             value = self.keyboardSpeedDict['SpeedRollLeft'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedRollLeft'] = widget
         self.widgetsDict[KEYBOARD+'SpeedRollLeft'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale UP key', (), None,
             'Scale UP key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleUp'],
             value = self.keyboardMapDict['KeyScaleUp'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleUp'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleUp'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale UP Speed', (), None,
             'Scale UP Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleUp'],
             value = self.keyboardSpeedDict['SpeedScaleUp'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleUp'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleUp'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Down key', (), None,
             'Scale Down key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleDown'],
             value = self.keyboardMapDict['KeyScaleDown'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleDown'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleDown'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Down Speed', (), None,
             'Scale Down Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleDown'],
             value = self.keyboardSpeedDict['SpeedScaleDown'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleDown'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleDown'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale X UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale X UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale X UP key', (), None,
             'Scale X UP key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleXUp'],
             value = self.keyboardMapDict['KeyScaleXUp'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleXUp'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleXUp'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale X UP Speed', (), None,
             'Scale X UP Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleXUp'],
             value = self.keyboardSpeedDict['SpeedScaleXUp'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleXUp'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleXUp'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale X Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale X Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale X Down key', (), None,
             'Scale X Down key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleXDown'],
             value = self.keyboardMapDict['KeyScaleXDown'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleXDown'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleXDown'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Down X Speed', (), None,
             'Scale Down X Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleXDown'],
             value = self.keyboardSpeedDict['SpeedScaleXDown'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleXDown'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleXDown'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale Y UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale Y UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Y UP key', (), None,
             'Scale Y UP key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleYUp'],
             value = self.keyboardMapDict['KeyScaleYUp'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleYUp'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleYUp'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Y UP Speed', (), None,
             'Scale Y UP Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleYUp'],
             value = self.keyboardSpeedDict['SpeedScaleYUp'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleYUp'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleYUp'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale Y Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale Y Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Y Down key', (), None,
             'Scale Y Down key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleYDown'],
             value = self.keyboardMapDict['KeyScaleYDown'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleYDown'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleYDown'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Down XY Speed', (), None,
             'Scale Down XY Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleYDown'],
             value = self.keyboardSpeedDict['SpeedScaleYDown'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleYDown'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleYDown'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale Z UP :', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale Z UP :', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Z UP key', (), None,
             'Scale Z UP key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleZUp'],
             value = self.keyboardMapDict['KeyScaleZUp'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleZUp'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleZUp'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Z UP Speed', (), None,
             'Scale Z UP Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleZUp'],
             value = self.keyboardSpeedDict['SpeedScaleZUp'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleZUp'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleZUp'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
         Interior = Frame(settingFrame)
         Interior = Frame(settingFrame)
-        widget = Label(Interior, text = 'Scale Z Down:', width = 20, anchor = Tkinter.W).pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = 'Scale Z Down:', width = 20, anchor = tkinter.W).pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Z Down key', (), None,
             'Scale Z Down key', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardMapDict['KeyScaleZDown'],
             value = self.keyboardMapDict['KeyScaleZDown'],
-            labelpos = Tkinter.W, label_text='Key :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Key :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'KeyScaleZDown'] = widget
         self.widgetsDict[KEYBOARD+'KeyScaleZDown'] = widget
-        widget = Label(Interior, text = '   ').pack(side=Tkinter.LEFT, expand = False)
+        widget = Label(Interior, text = '   ').pack(side=tkinter.LEFT, expand = False)
         widget = self.createcomponent(
         widget = self.createcomponent(
             'Scale Down Z Speed', (), None,
             'Scale Down Z Speed', (), None,
             Pmw.EntryField, (Interior,),
             Pmw.EntryField, (Interior,),
             value = self.keyboardSpeedDict['SpeedScaleZDown'],
             value = self.keyboardSpeedDict['SpeedScaleZDown'],
-            labelpos = Tkinter.W, label_text='Speed :', entry_width = 10)
-        widget.pack(side=Tkinter.LEFT, expand = False)
+            labelpos = tkinter.W, label_text='Speed :', entry_width = 10)
+        widget.pack(side=tkinter.LEFT, expand = False)
         self.widgetsDict[KEYBOARD+'SpeedScaleZDown'] = widget
         self.widgetsDict[KEYBOARD+'SpeedScaleZDown'] = widget
-        widget = Label(Interior, text = 'Per Second').pack(side=Tkinter.LEFT, expand = False)
-        Interior.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=True, pady = 4 )
+        widget = Label(Interior, text = 'Per Second').pack(side=tkinter.LEFT, expand = False)
+        Interior.pack(side=tkinter.TOP, fill=tkinter.X, expand=True, pady = 4 )
 
 
-        assignFrame.pack(side=Tkinter.TOP, expand=True, fill = Tkinter.X)
-        keyboardPage.pack(side=Tkinter.TOP, expand=True, fill = Tkinter.X)
+        assignFrame.pack(side=tkinter.TOP, expand=True, fill = tkinter.X)
+        keyboardPage.pack(side=tkinter.TOP, expand=True, fill = tkinter.X)
 
 
         ####################################################################
         ####################################################################
         ####################################################################
         ####################################################################
@@ -539,12 +545,12 @@ class controllerWindow(AppShell):
         ####################################################################
         ####################################################################
         # Pack the mainFrame
         # Pack the mainFrame
         frame = Frame(mainFrame)
         frame = Frame(mainFrame)
-        widget = Button(frame, text='OK', width = 13, command=self.ok_press).pack(side=Tkinter.RIGHT)
-        widget = Button(frame, text='Enable Control', width = 13, command=self.enableControl).pack(side=Tkinter.LEFT)
-        widget = Button(frame, text='Disable Control', width = 13, command=self.disableControl).pack(side=Tkinter.LEFT)
-        widget = Button(frame, text='Save & Keep', width = 13, command=self.saveKeepControl).pack(side=Tkinter.LEFT)
-        frame.pack(side = Tkinter.BOTTOM, expand=1, fill = Tkinter.X)
-        mainFrame.pack(expand=1, fill = Tkinter.BOTH)
+        widget = Button(frame, text='OK', width = 13, command=self.ok_press).pack(side=tkinter.RIGHT)
+        widget = Button(frame, text='Enable Control', width = 13, command=self.enableControl).pack(side=tkinter.LEFT)
+        widget = Button(frame, text='Disable Control', width = 13, command=self.disableControl).pack(side=tkinter.LEFT)
+        widget = Button(frame, text='Save & Keep', width = 13, command=self.saveKeepControl).pack(side=tkinter.LEFT)
+        frame.pack(side = tkinter.BOTTOM, expand=1, fill = tkinter.X)
+        mainFrame.pack(expand=1, fill = tkinter.BOTH)
 
 
     def onDestroy(self, event):
     def onDestroy(self, event):
         # Check if user wish to keep the control after the window closed.
         # Check if user wish to keep the control after the window closed.
@@ -688,7 +694,7 @@ class controllerWindow(AppShell):
                 self.keyboardMapDict[index] = self.widgetsDict['Keyboard-'+index].getvalue()
                 self.keyboardMapDict[index] = self.widgetsDict['Keyboard-'+index].getvalue()
             for index in self.keyboardSpeedDict:
             for index in self.keyboardSpeedDict:
                 self.keyboardSpeedDict[index] = float(self.widgetsDict['Keyboard-'+index].getvalue())
                 self.keyboardSpeedDict[index] = float(self.widgetsDict['Keyboard-'+index].getvalue())
-            print self.nodePath
+            print(self.nodePath)
             messenger.send('ControlW_saveSetting', ['Keyboard', [self.nodePath, self.keyboardMapDict, self.keyboardSpeedDict]])
             messenger.send('ControlW_saveSetting', ['Keyboard', [self.nodePath, self.keyboardMapDict, self.keyboardSpeedDict]])
         return
         return
 
 

+ 50 - 48
contrib/src/sceneeditor/dataHolder.py

@@ -2,13 +2,15 @@
 # TK and PMW INTERFACE MODULES#
 # TK and PMW INTERFACE MODULES#
 ###############################
 ###############################
 from direct.showbase.TkGlobal import*
 from direct.showbase.TkGlobal import*
-from tkFileDialog import *
 import Pmw
 import Pmw
-import tkFileDialog
-import tkMessageBox
 from direct.tkwidgets import Dial
 from direct.tkwidgets import Dial
 from direct.tkwidgets import Floater
 from direct.tkwidgets import Floater
 
 
+if sys.version_info >= (3, 0):
+    from tkinter.filedialog import askopenfilename
+else:
+    from tkFileDialog import askopenfilename
+
 
 
 #############################
 #############################
 # Scene Editor Python Files #
 # Scene Editor Python Files #
@@ -154,7 +156,7 @@ class dataHolder:
         self.ActorNum=0
         self.ActorNum=0
         self.theScene=None
         self.theScene=None
         messenger.send('SGE_Update Explorer',[render])
         messenger.send('SGE_Update Explorer',[render])
-        print 'Scene should be cleaned up!'
+        print('Scene should be cleaned up!')
 
 
     def removeObj(self, nodePath):
     def removeObj(self, nodePath):
         #################################################################
         #################################################################
@@ -169,7 +171,7 @@ class dataHolder:
         childrenList = nodePath.getChildren()
         childrenList = nodePath.getChildren()
 
 
 
 
-        if self.ModelDic.has_key(name):
+        if name in self.ModelDic:
             del self.ModelDic[name]
             del self.ModelDic[name]
             del self.ModelRefDic[name]
             del self.ModelRefDic[name]
             if len(childrenList) != 0:
             if len(childrenList) != 0:
@@ -178,7 +180,7 @@ class dataHolder:
             nodePath.removeNode()
             nodePath.removeNode()
             self.ModelNum -= 1
             self.ModelNum -= 1
             pass
             pass
-        elif self.ActorDic.has_key(name):
+        elif name in self.ActorDic:
             del self.ActorDic[name]
             del self.ActorDic[name]
             del self.ActorRefDic[name]
             del self.ActorRefDic[name]
             if len(childrenList) != 0:
             if len(childrenList) != 0:
@@ -187,14 +189,14 @@ class dataHolder:
             nodePath.removeNode()
             nodePath.removeNode()
             self.ActorNum -= 1
             self.ActorNum -= 1
             pass
             pass
-        elif self.collisionDict.has_key(name):
+        elif name in self.collisionDict:
             del self.collisionDict[name]
             del self.collisionDict[name]
             if len(childrenList) != 0:
             if len(childrenList) != 0:
                 for node in childrenList:
                 for node in childrenList:
                     self.removeObj(node)
                     self.removeObj(node)
             nodePath.removeNode()
             nodePath.removeNode()
             pass
             pass
-        elif self.dummyDict.has_key(name):
+        elif name in self.dummyDict:
             del self.dummyDict[name]
             del self.dummyDict[name]
             if len(childrenList) != 0:
             if len(childrenList) != 0:
                 for node in childrenList:
                 for node in childrenList:
@@ -207,12 +209,12 @@ class dataHolder:
                     self.removeObj(node)
                     self.removeObj(node)
             list = self.lightManager.delete(name)
             list = self.lightManager.delete(name)
             return list
             return list
-        elif self.particleNodes.has_key(name):
+        elif name in self.particleNodes:
             self.particleNodes[name].removeNode()
             self.particleNodes[name].removeNode()
             del self.particleNodes[name]
             del self.particleNodes[name]
             del self.particleDict[name]
             del self.particleDict[name]
         else:
         else:
-            print 'You cannot remove this NodePath'
+            print('You cannot remove this NodePath')
             return
             return
 
 
         messenger.send('SGE_Update Explorer',[render])
         messenger.send('SGE_Update Explorer',[render])
@@ -237,15 +239,15 @@ class dataHolder:
         cHpr = hpr
         cHpr = hpr
         cScale = scale
         cScale = scale
         parent = nodePath.getParent()
         parent = nodePath.getParent()
-        if self.ActorDic.has_key(name):
+        if name in self.ActorDic:
             holder = self.ActorDic
             holder = self.ActorDic
             holderRef = self.ActorRefDic
             holderRef = self.ActorRefDic
             isModel = False
             isModel = False
-        elif self.ModelDic.has_key(name):
+        elif name in self.ModelDic:
             holder = self.ModelDic
             holder = self.ModelDic
             holderRef = self.ModelRefDic
             holderRef = self.ModelRefDic
         else:
         else:
-            print '---- DataHolder: Target Obj is not a legal object could be duplicate!'
+            print('---- DataHolder: Target Obj is not a legal object could be duplicate!')
             return
             return
 
 
         FilePath = holderRef[name]
         FilePath = holderRef[name]
@@ -356,7 +358,7 @@ class dataHolder:
         # This funciton will return True if there is an Actor in the scene named "name"
         # This funciton will return True if there is an Actor in the scene named "name"
         # and will return False if not.
         # and will return False if not.
         ###########################################################################
         ###########################################################################
-        return self.ActorDic.has_key(name)
+        return name in self.ActorDic
 
 
     def getActor(self, name):
     def getActor(self, name):
         ###########################################################################
         ###########################################################################
@@ -366,7 +368,7 @@ class dataHolder:
         if self.isActor(name):
         if self.isActor(name):
             return self.ActorDic[name]
             return self.ActorDic[name]
         else:
         else:
-            print '----No Actor named: ', name
+            print('----No Actor named: ', name)
             return None
             return None
 
 
     def getModel(self, name):
     def getModel(self, name):
@@ -377,7 +379,7 @@ class dataHolder:
         if self.isModel(name):
         if self.isModel(name):
             return self.ModelDic[name]
             return self.ModelDic[name]
         else:
         else:
-            print '----No Model named: ', name
+            print('----No Model named: ', name)
             return None
             return None
 
 
     def isModel(self, name):
     def isModel(self, name):
@@ -386,7 +388,7 @@ class dataHolder:
         # This funciton will return True if there is a Model in the scene named "name"
         # This funciton will return True if there is a Model in the scene named "name"
         # and will return False if not.
         # and will return False if not.
         ###########################################################################
         ###########################################################################
-        return self.ModelDic.has_key(name)
+        return name in self.ModelDic
 
 
     def loadAnimation(self,name, Dic):
     def loadAnimation(self,name, Dic):
         ###########################################################################
         ###########################################################################
@@ -406,7 +408,7 @@ class dataHolder:
             messenger.send('DataH_loadFinish'+name)
             messenger.send('DataH_loadFinish'+name)
             return
             return
         else:
         else:
-            print '------ Error when loading animation for Actor: ', name
+            print('------ Error when loading animation for Actor: ', name)
 
 
     def removeAnimation(self, name, anim):
     def removeAnimation(self, name, anim):
         ###########################################################################
         ###########################################################################
@@ -527,7 +529,7 @@ class dataHolder:
             self.ActorDic[nName]= self.ActorDic[oName]
             self.ActorDic[nName]= self.ActorDic[oName]
             self.ActorRefDic[nName]= self.ActorRefDic[oName]
             self.ActorRefDic[nName]= self.ActorRefDic[oName]
             self.ActorDic[nName].setName(nName)
             self.ActorDic[nName].setName(nName)
-            if self.blendAnimDict.has_key(oName):
+            if oName in self.blendAnimDict:
                 self.blendAnimDict[nName] = self.blendAnimDict[oName]
                 self.blendAnimDict[nName] = self.blendAnimDict[oName]
                 del self.blendAnimDict[oName]
                 del self.blendAnimDict[oName]
             del self.ActorDic[oName]
             del self.ActorDic[oName]
@@ -540,16 +542,16 @@ class dataHolder:
             del self.ModelRefDic[oName]
             del self.ModelRefDic[oName]
         elif self.lightManager.isLight(oName):
         elif self.lightManager.isLight(oName):
             list, lightNode = self.lightManager.rename(oName, nName)
             list, lightNode = self.lightManager.rename(oName, nName)
-        elif self.dummyDict.has_key(oName):
+        elif oName in self.dummyDict:
             self.dummyDict[nName]= self.dummyDict[oName]
             self.dummyDict[nName]= self.dummyDict[oName]
             self.dummyDict[nName].setName(nName)
             self.dummyDict[nName].setName(nName)
             del self.dummyDict[oName]
             del self.dummyDict[oName]
-        elif self.collisionDict.has_key(oName):
+        elif oName in self.collisionDict:
             self.collisionDict[nName]= self.collisionDict[oName]
             self.collisionDict[nName]= self.collisionDict[oName]
             self.collisionDict[nName].setName(nName)
             self.collisionDict[nName].setName(nName)
             del self.collisionDict[oName]
             del self.collisionDict[oName]
 
 
-        elif self.particleNodes.has_key(oName):
+        elif oName in self.particleNodes:
             self.particleNodes[nName]= self.particleNodes[oName]
             self.particleNodes[nName]= self.particleNodes[oName]
             self.particleDict[nName]= self.particleDict[oName]
             self.particleDict[nName]= self.particleDict[oName]
             self.particleDict[nName].setName(nName)
             self.particleDict[nName].setName(nName)
@@ -557,9 +559,9 @@ class dataHolder:
             del self.particleNodes[oName]
             del self.particleNodes[oName]
             del self.particleDict[oName]
             del self.particleDict[oName]
         else:
         else:
-            print '----Error: This Object is not allowed to this function!'
+            print('----Error: This Object is not allowed to this function!')
 
 
-        if self.curveDict.has_key(oName):
+        if oName in self.curveDict:
             self.curveDict[nName] = self.curveDict[oName]
             self.curveDict[nName] = self.curveDict[oName]
             del self.curveDict[oName]
             del self.curveDict[oName]
 
 
@@ -578,11 +580,11 @@ class dataHolder:
             return True
             return True
         elif self.lightManager.isLight(name):
         elif self.lightManager.isLight(name):
             return True
             return True
-        elif self.dummyDict.has_key(name):
+        elif name in self.dummyDict:
             return True
             return True
-        elif self.collisionDict.has_key(name):
+        elif name in self.collisionDict:
             return True
             return True
-        elif self.particleNodes.has_key(name):
+        elif name in self.particleNodes:
             return True
             return True
         elif (name == 'render')or(name == 'SEditor')or(name == 'Lights')or(name == 'camera'):
         elif (name == 'render')or(name == 'SEditor')or(name == 'Lights')or(name == 'camera'):
             return True
             return True
@@ -596,7 +598,7 @@ class dataHolder:
         # using the node name as a reference to assosiate a list which contains all curves related to that node.
         # using the node name as a reference to assosiate a list which contains all curves related to that node.
         ###########################################################################
         ###########################################################################
         name = node.getName()
         name = node.getName()
-        if self.curveDict.has_key(name):
+        if name in self.curveDict:
             self.curveDict[name].append(curveCollection)
             self.curveDict[name].append(curveCollection)
             return
             return
         else:
         else:
@@ -612,7 +614,7 @@ class dataHolder:
         # If the input node has not been bindedwith any curve, it will return None.
         # If the input node has not been bindedwith any curve, it will return None.
         ###########################################################################
         ###########################################################################
         name = nodePath.getName()
         name = nodePath.getName()
-        if self.curveDict.has_key(name):
+        if name in self.curveDict:
             return self.curveDict[name]
             return self.curveDict[name]
         else:
         else:
             return None
             return None
@@ -626,7 +628,7 @@ class dataHolder:
         # This message will be caught by Property Window for this node.
         # This message will be caught by Property Window for this node.
         ###########################################################################
         ###########################################################################
         name =nodePath.getName()
         name =nodePath.getName()
-        if self.curveDict.has_key(name):
+        if name in self.curveDict:
             index = None
             index = None
             for curve in self.curveDict[name]:
             for curve in self.curveDict[name]:
                 if curve.getCurve(0).getName() == curveName:
                 if curve.getCurve(0).getName() == curveName:
@@ -677,12 +679,12 @@ class dataHolder:
         elif self.isLight(name):
         elif self.isLight(name):
             type = 'Light'
             type = 'Light'
             info['lightNode'] = self.lightManager.getLightNode(name)
             info['lightNode'] = self.lightManager.getLightNode(name)
-        elif self.dummyDict.has_key(name):
+        elif name in self.dummyDict:
             type = 'dummy'
             type = 'dummy'
-        elif self.collisionDict.has_key(name):
+        elif name in self.collisionDict:
             type = 'collisionNode'
             type = 'collisionNode'
             info['collisionNode'] = self.collisionDict[name]
             info['collisionNode'] = self.collisionDict[name]
-        if self.curveDict.has_key(name):
+        if name in self.curveDict:
             info['curveList'] = self.getCurveList(nodePath)
             info['curveList'] = self.getCurveList(nodePath)
 
 
         return type, info
         return type, info
@@ -794,7 +796,7 @@ class dataHolder:
         # The formate of thsi dictionary is
         # The formate of thsi dictionary is
         # {"name of Blend Animation" : ["Animation A, Animation B, Effect(Float, 0~1)"]}
         # {"name of Blend Animation" : ["Animation A, Animation B, Effect(Float, 0~1)"]}
         ###########################################################################
         ###########################################################################
-        if self.blendAnimDict.has_key(name):
+        if name in self.blendAnimDict:
             return self.blendAnimDict[name]
             return self.blendAnimDict[name]
         else:
         else:
             return {}
             return {}
@@ -808,8 +810,8 @@ class dataHolder:
         # Also, if this blend is the first blend animation that the target actor has,
         # Also, if this blend is the first blend animation that the target actor has,
         # this function will add a "Blending" tag on this actor which is "True".
         # this function will add a "Blending" tag on this actor which is "True".
         ###########################################################################
         ###########################################################################
-        if self.blendAnimDict.has_key(actorName):
-            if self.blendAnimDict[actorName].has_key(blendName):
+        if actorName in self.blendAnimDict:
+            if blendName in self.blendAnimDict[actorName]:
                 ### replace the original setting
                 ### replace the original setting
                 self.blendAnimDict[actorName][blendName][0] = animNameA
                 self.blendAnimDict[actorName][blendName][0] = animNameA
                 self.blendAnimDict[actorName][blendName][1] = animNameB
                 self.blendAnimDict[actorName][blendName][1] = animNameB
@@ -832,7 +834,7 @@ class dataHolder:
         # it will also rewrite the data to the newest one.
         # it will also rewrite the data to the newest one.
         ###########################################################################
         ###########################################################################
         self.removeBlendAnim(actorName,oName)
         self.removeBlendAnim(actorName,oName)
-        print self.blendAnimDict
+        print(self.blendAnimDict)
         return self.saveBlendAnim(actorName, nName, animNameA, animNameB, effect)
         return self.saveBlendAnim(actorName, nName, animNameA, animNameB, effect)
 
 
     def removeBlendAnim(self, actorName, blendName):
     def removeBlendAnim(self, actorName, blendName):
@@ -844,8 +846,8 @@ class dataHolder:
         # Also, it will check that there is any blended animation remained for this actor,
         # Also, it will check that there is any blended animation remained for this actor,
         # If none, this function will clear the "Blending" tag of this object.
         # If none, this function will clear the "Blending" tag of this object.
         ###########################################################################
         ###########################################################################
-        if self.blendAnimDict.has_key(actorName):
-            if self.blendAnimDict[actorName].has_key(blendName):
+        if actorName in self.blendAnimDict:
+            if blendName in self.blendAnimDict[actorName]:
                 ### replace the original setting
                 ### replace the original setting
                 del self.blendAnimDict[actorName][blendName]
                 del self.blendAnimDict[actorName][blendName]
             if len(self.blendAnimDict[actorName])==0:
             if len(self.blendAnimDict[actorName])==0:
@@ -876,15 +878,15 @@ class dataHolder:
         ###########################################################################
         ###########################################################################
         if name == 'camera':
         if name == 'camera':
             return camera
             return camera
-        elif self.ModelDic.has_key(name):
+        elif name in self.ModelDic:
             return self.ModelDic[name]
             return self.ModelDic[name]
-        elif self.ActorDic.has_key(name):
+        elif name in self.ActorDic:
             return self.ActorDic[name]
             return self.ActorDic[name]
-        elif self.collisionDict.has_key(name):
+        elif name in self.collisionDict:
             return self.collisionDict[name]
             return self.collisionDict[name]
-        elif self.dummyDict.has_key(name):
+        elif name in self.dummyDict:
             return self.dummyDict[name]
             return self.dummyDict[name]
-        elif self.particleNodes.has_key(name):
+        elif name in self.particleNodes:
             return self.particleNodes[name]
             return self.particleNodes[name]
         elif self.lightManager.isLight(name):
         elif self.lightManager.isLight(name):
             return self.lightManager.getLightNode(name)
             return self.lightManager.getLightNode(name)
@@ -935,13 +937,13 @@ class dataHolder:
         ###########################################################################
         ###########################################################################
 
 
         ### Ask for a filename
         ### Ask for a filename
-        OpenFilename = tkFileDialog.askopenfilename(filetypes = [("PY","py")],title = "Load Scene")
+        OpenFilename = askopenfilename(filetypes = [("PY","py")],title = "Load Scene")
         if(not OpenFilename):
         if(not OpenFilename):
             return None
             return None
         f=Filename.fromOsSpecific(OpenFilename)
         f=Filename.fromOsSpecific(OpenFilename)
         fileName=f.getBasenameWoExtension()
         fileName=f.getBasenameWoExtension()
         dirName=f.getFullpathWoExtension()
         dirName=f.getFullpathWoExtension()
-        print "DATAHOLDER::" + dirName
+        print("DATAHOLDER::" + dirName)
         ############################################################################
         ############################################################################
         # Append the path to this file to our sys path where python looks for modules
         # Append the path to this file to our sys path where python looks for modules
         # We do this so that we can use "import"  on our saved scene code and execute it
         # We do this so that we can use "import"  on our saved scene code and execute it
@@ -976,7 +978,7 @@ class dataHolder:
             self.ActorDic[actor]=self.Scene.ActorDic[actor]
             self.ActorDic[actor]=self.Scene.ActorDic[actor]
             #self.ActorRefDic[actor]=self.Scene.ActorRefDic[actor] # Old way of doing absolute paths
             #self.ActorRefDic[actor]=self.Scene.ActorRefDic[actor] # Old way of doing absolute paths
             self.ActorRefDic[actor]=Filename(dirName + "/" + self.Scene.ActorRefDic[actor]) # Relative Paths
             self.ActorRefDic[actor]=Filename(dirName + "/" + self.Scene.ActorRefDic[actor]) # Relative Paths
-            if(self.Scene.blendAnimDict.has_key(str(actor))):
+            if(str(actor) in self.Scene.blendAnimDict):
                 self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor]
                 self.blendAnimDict[actor]=self.Scene.blendAnimDict[actor]
             self.ActorNum=self.ActorNum+1
             self.ActorNum=self.ActorNum+1
 
 
@@ -1006,7 +1008,7 @@ class dataHolder:
                 atten=alight.getAttenuation()
                 atten=alight.getAttenuation()
                 self.lightManager.create('spot',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),thenode.getHpr(),atten.getX(),atten.getY(),atten.getZ(),alight.getExponent(),name=alight.getName(),tag=thenode.getTag("Metadata"))
                 self.lightManager.create('spot',alight.getColor(),alight.getSpecularColor(),thenode.getPos(),thenode.getHpr(),atten.getX(),atten.getY(),atten.getZ(),alight.getExponent(),name=alight.getName(),tag=thenode.getTag("Metadata"))
             else:
             else:
-                print 'Invalid light type'
+                print('Invalid light type')
 
 
         ############################################################################
         ############################################################################
         # Populate Dummy related Dictionaries
         # Populate Dummy related Dictionaries

+ 2 - 2
contrib/src/sceneeditor/duplicateWindow.py

@@ -45,7 +45,7 @@ class duplicateWindow(AppShell):
         self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
         self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
 
 
     def appInit(self):
     def appInit(self):
-        print '----SideWindow is Initialized!!'
+        print('----SideWindow is Initialized!!')
 
 
     def createInterface(self):
     def createInterface(self):
         # The interior of the toplevel panel
         # The interior of the toplevel panel
@@ -122,7 +122,7 @@ class duplicateWindow(AppShell):
         # This message will be caught by sceneEditor.
         # This message will be caught by sceneEditor.
         #################################################################
         #################################################################
         if not self.allEntryValid():
         if not self.allEntryValid():
-            print '---- Duplication Window: Invalid value!!'
+            print('---- Duplication Window: Invalid value!!')
             return
             return
         x = self.move_x.getvalue()
         x = self.move_x.getvalue()
         y = self.move_y.getvalue()
         y = self.move_y.getvalue()

+ 32 - 25
contrib/src/sceneeditor/lightingPanel.py

@@ -7,9 +7,16 @@ from direct.tkwidgets.AppShell import AppShell
 from seColorEntry import *
 from seColorEntry import *
 from direct.tkwidgets.VectorWidgets import Vector3Entry
 from direct.tkwidgets.VectorWidgets import Vector3Entry
 from direct.tkwidgets.Slider import Slider
 from direct.tkwidgets.Slider import Slider
-from Tkinter import Frame, Button, Menubutton, Menu
-import string, math, types, Pmw, Tkinter
-from pandac.PandaModules import *
+import sys, math, types, Pmw
+from panda3d.core import *
+
+if sys.version_info >= (3, 0):
+    from tkinter import Frame, Button, Menubutton, Menu
+    import tkinter
+else:
+    from Tkinter import Frame, Button, Menubutton, Menu
+    import Tkinter as tkinter
+
 
 
 class lightingPanel(AppShell):
 class lightingPanel(AppShell):
     #################################################################
     #################################################################
@@ -51,25 +58,25 @@ class lightingPanel(AppShell):
         mainFrame = Frame(interior)
         mainFrame = Frame(interior)
 
 
         self.listZone = Pmw.Group(mainFrame,tag_pyclass = None)
         self.listZone = Pmw.Group(mainFrame,tag_pyclass = None)
-        self.listZone.pack(expand=0, fill=Tkinter.X,padx=3,pady=3)
+        self.listZone.pack(expand=0, fill=tkinter.X,padx=3,pady=3)
         listFrame = self.listZone.interior()
         listFrame = self.listZone.interior()
 
 
         self.lightEntry = self.createcomponent(
         self.lightEntry = self.createcomponent(
             'Lights List', (), None,
             'Lights List', (), None,
             Pmw.ComboBox, (listFrame,),label_text='Light :',
             Pmw.ComboBox, (listFrame,),label_text='Light :',
-            labelpos = Tkinter.W, entry_width = 25, selectioncommand = self.selectLight,
+            labelpos = tkinter.W, entry_width = 25, selectioncommand = self.selectLight,
             scrolledlist_items = self.lightList)
             scrolledlist_items = self.lightList)
-        self.lightEntry.pack(side=Tkinter.LEFT)
+        self.lightEntry.pack(side=tkinter.LEFT)
 
 
         self.renameButton = self.createcomponent(
         self.renameButton = self.createcomponent(
             'Rename Light', (), None,
             'Rename Light', (), None,
             Button, (listFrame,),
             Button, (listFrame,),
             text = ' Rename ',
             text = ' Rename ',
             command = self.renameLight)
             command = self.renameLight)
-        self.renameButton.pack(side=Tkinter.LEFT)
+        self.renameButton.pack(side=tkinter.LEFT)
 
 
         self.addLighZone = Pmw.Group(listFrame,tag_pyclass = None)
         self.addLighZone = Pmw.Group(listFrame,tag_pyclass = None)
-        self.addLighZone.pack(side=Tkinter.LEFT)
+        self.addLighZone.pack(side=tkinter.LEFT)
         insideFrame = self.addLighZone.interior()
         insideFrame = self.addLighZone.interior()
         self.lightsButton = Menubutton(insideFrame, text = 'Add light',borderwidth = 3,
         self.lightsButton = Menubutton(insideFrame, text = 'Add light',borderwidth = 3,
                                        activebackground = '#909090')
                                        activebackground = '#909090')
@@ -91,13 +98,13 @@ class lightingPanel(AppShell):
             Button, (listFrame,),
             Button, (listFrame,),
             text = '  Delete  ',
             text = '  Delete  ',
             command = self.deleteLight)
             command = self.deleteLight)
-        self.deleteButton.pack(side=Tkinter.LEFT)
+        self.deleteButton.pack(side=tkinter.LEFT)
 
 
         self.lightColor = seColorEntry(
         self.lightColor = seColorEntry(
             mainFrame, text = 'Light Color', value=self.lightColor)
             mainFrame, text = 'Light Color', value=self.lightColor)
         self.lightColor['command'] = self.setLightingColorVec
         self.lightColor['command'] = self.setLightingColorVec
         self.lightColor['resetValue'] = [0.3*255,0.3*255,0.3*255,0]
         self.lightColor['resetValue'] = [0.3*255,0.3*255,0.3*255,0]
-        self.lightColor.pack(fill=Tkinter.X,expand=0)
+        self.lightColor.pack(fill=tkinter.X,expand=0)
         self.bind(self.lightColor, 'Set light color')
         self.bind(self.lightColor, 'Set light color')
 
 
         # Notebook pages for light specific controls
         # Notebook pages for light specific controls
@@ -114,27 +121,27 @@ class lightingPanel(AppShell):
         self.dSpecularColor = seColorEntry(
         self.dSpecularColor = seColorEntry(
             directionalPage, text = 'Specular Color')
             directionalPage, text = 'Specular Color')
         self.dSpecularColor['command'] = self.setSpecularColor
         self.dSpecularColor['command'] = self.setSpecularColor
-        self.dSpecularColor.pack(fill = Tkinter.X, expand = 0)
+        self.dSpecularColor.pack(fill = tkinter.X, expand = 0)
         self.bind(self.dSpecularColor,
         self.bind(self.dSpecularColor,
                   'Set directional light specular color')
                   'Set directional light specular color')
         self.dPosition = Vector3Entry(
         self.dPosition = Vector3Entry(
             directionalPage, text = 'Position')
             directionalPage, text = 'Position')
         self.dPosition['command'] = self.setPosition
         self.dPosition['command'] = self.setPosition
         self.dPosition['resetValue'] = [0,0,0,0]
         self.dPosition['resetValue'] = [0,0,0,0]
-        self.dPosition.pack(fill = Tkinter.X, expand = 0)
+        self.dPosition.pack(fill = tkinter.X, expand = 0)
         self.bind(self.dPosition, 'Set directional light position')
         self.bind(self.dPosition, 'Set directional light position')
         self.dOrientation = Vector3Entry(
         self.dOrientation = Vector3Entry(
             directionalPage, text = 'Orientation')
             directionalPage, text = 'Orientation')
         self.dOrientation['command'] = self.setOrientation
         self.dOrientation['command'] = self.setOrientation
         self.dOrientation['resetValue'] = [0,0,0,0]
         self.dOrientation['resetValue'] = [0,0,0,0]
-        self.dOrientation.pack(fill = Tkinter.X, expand = 0)
+        self.dOrientation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.dOrientation, 'Set directional light orientation')
         self.bind(self.dOrientation, 'Set directional light orientation')
 
 
         # Point light controls
         # Point light controls
         self.pSpecularColor = seColorEntry(
         self.pSpecularColor = seColorEntry(
             pointPage, text = 'Specular Color')
             pointPage, text = 'Specular Color')
         self.pSpecularColor['command'] = self.setSpecularColor
         self.pSpecularColor['command'] = self.setSpecularColor
-        self.pSpecularColor.pack(fill = Tkinter.X, expand = 0)
+        self.pSpecularColor.pack(fill = tkinter.X, expand = 0)
         self.bind(self.pSpecularColor,
         self.bind(self.pSpecularColor,
                   'Set point light specular color')
                   'Set point light specular color')
 
 
@@ -142,7 +149,7 @@ class lightingPanel(AppShell):
             pointPage, text = 'Position')
             pointPage, text = 'Position')
         self.pPosition['command'] = self.setPosition
         self.pPosition['command'] = self.setPosition
         self.pPosition['resetValue'] = [0,0,0,0]
         self.pPosition['resetValue'] = [0,0,0,0]
-        self.pPosition.pack(fill = Tkinter.X, expand = 0)
+        self.pPosition.pack(fill = tkinter.X, expand = 0)
         self.bind(self.pPosition, 'Set point light position')
         self.bind(self.pPosition, 'Set point light position')
 
 
         self.pConstantAttenuation = Slider(
         self.pConstantAttenuation = Slider(
@@ -152,7 +159,7 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 1.0)
             value = 1.0)
         self.pConstantAttenuation['command'] = self.setConstantAttenuation
         self.pConstantAttenuation['command'] = self.setConstantAttenuation
-        self.pConstantAttenuation.pack(fill = Tkinter.X, expand = 0)
+        self.pConstantAttenuation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.pConstantAttenuation,
         self.bind(self.pConstantAttenuation,
                   'Set point light constant attenuation')
                   'Set point light constant attenuation')
 
 
@@ -163,7 +170,7 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 0.0)
             value = 0.0)
         self.pLinearAttenuation['command'] = self.setLinearAttenuation
         self.pLinearAttenuation['command'] = self.setLinearAttenuation
-        self.pLinearAttenuation.pack(fill = Tkinter.X, expand = 0)
+        self.pLinearAttenuation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.pLinearAttenuation,
         self.bind(self.pLinearAttenuation,
                   'Set point light linear attenuation')
                   'Set point light linear attenuation')
 
 
@@ -174,7 +181,7 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 0.0)
             value = 0.0)
         self.pQuadraticAttenuation['command'] = self.setQuadraticAttenuation
         self.pQuadraticAttenuation['command'] = self.setQuadraticAttenuation
-        self.pQuadraticAttenuation.pack(fill = Tkinter.X, expand = 0)
+        self.pQuadraticAttenuation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.pQuadraticAttenuation,
         self.bind(self.pQuadraticAttenuation,
                   'Set point light quadratic attenuation')
                   'Set point light quadratic attenuation')
 
 
@@ -182,7 +189,7 @@ class lightingPanel(AppShell):
         self.sSpecularColor = seColorEntry(
         self.sSpecularColor = seColorEntry(
             spotPage, text = 'Specular Color')
             spotPage, text = 'Specular Color')
         self.sSpecularColor['command'] = self.setSpecularColor
         self.sSpecularColor['command'] = self.setSpecularColor
-        self.sSpecularColor.pack(fill = Tkinter.X, expand = 0)
+        self.sSpecularColor.pack(fill = tkinter.X, expand = 0)
         self.bind(self.sSpecularColor,
         self.bind(self.sSpecularColor,
                   'Set spot light specular color')
                   'Set spot light specular color')
 
 
@@ -193,7 +200,7 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 1.0)
             value = 1.0)
         self.sConstantAttenuation['command'] = self.setConstantAttenuation
         self.sConstantAttenuation['command'] = self.setConstantAttenuation
-        self.sConstantAttenuation.pack(fill = Tkinter.X, expand = 0)
+        self.sConstantAttenuation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.sConstantAttenuation,
         self.bind(self.sConstantAttenuation,
                   'Set spot light constant attenuation')
                   'Set spot light constant attenuation')
 
 
@@ -204,7 +211,7 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 0.0)
             value = 0.0)
         self.sLinearAttenuation['command'] = self.setLinearAttenuation
         self.sLinearAttenuation['command'] = self.setLinearAttenuation
-        self.sLinearAttenuation.pack(fill = Tkinter.X, expand = 0)
+        self.sLinearAttenuation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.sLinearAttenuation,
         self.bind(self.sLinearAttenuation,
                   'Set spot light linear attenuation')
                   'Set spot light linear attenuation')
 
 
@@ -215,7 +222,7 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 0.0)
             value = 0.0)
         self.sQuadraticAttenuation['command'] = self.setQuadraticAttenuation
         self.sQuadraticAttenuation['command'] = self.setQuadraticAttenuation
-        self.sQuadraticAttenuation.pack(fill = Tkinter.X, expand = 0)
+        self.sQuadraticAttenuation.pack(fill = tkinter.X, expand = 0)
         self.bind(self.sQuadraticAttenuation,
         self.bind(self.sQuadraticAttenuation,
                   'Set spot light quadratic attenuation')
                   'Set spot light quadratic attenuation')
 
 
@@ -226,16 +233,16 @@ class lightingPanel(AppShell):
             resolution = 0.01,
             resolution = 0.01,
             value = 0.0)
             value = 0.0)
         self.sExponent['command'] = self.setExponent
         self.sExponent['command'] = self.setExponent
-        self.sExponent.pack(fill = Tkinter.X, expand = 0)
+        self.sExponent.pack(fill = tkinter.X, expand = 0)
         self.bind(self.sExponent,
         self.bind(self.sExponent,
                   'Set spot light exponent')
                   'Set spot light exponent')
 
 
         # MRM: Add frustum controls
         # MRM: Add frustum controls
 
 
         self.lightNotebook.setnaturalsize()
         self.lightNotebook.setnaturalsize()
-        self.lightNotebook.pack(expand = 1, fill = Tkinter.BOTH)
+        self.lightNotebook.pack(expand = 1, fill = tkinter.BOTH)
 
 
-        mainFrame.pack(expand=1, fill = Tkinter.BOTH)
+        mainFrame.pack(expand=1, fill = tkinter.BOTH)
 
 
     def onDestroy(self, event):
     def onDestroy(self, event):
         messenger.send('LP_close')
         messenger.send('LP_close')

+ 4 - 5
contrib/src/sceneeditor/propertyWindow.py

@@ -11,8 +11,7 @@ from direct.tkwidgets import Floater
 from direct.tkwidgets import Dial
 from direct.tkwidgets import Dial
 from direct.tkwidgets import Slider
 from direct.tkwidgets import Slider
 from direct.tkwidgets import VectorWidgets
 from direct.tkwidgets import VectorWidgets
-from pandac.PandaModules import *
-from Tkinter import *
+from panda3d.core import *
 import Pmw
 import Pmw
 
 
 class propertyWindow(AppShell,Pmw.MegaWidget):
 class propertyWindow(AppShell,Pmw.MegaWidget):
@@ -108,7 +107,7 @@ class propertyWindow(AppShell,Pmw.MegaWidget):
 
 
         self.curveFrame = None
         self.curveFrame = None
         #### If nodePath has been binded with any curves
         #### If nodePath has been binded with any curves
-        if self.info.has_key('curveList'):
+        if 'curveList' in self.info:
             self.createCurveFrame(self.contentFrame)
             self.createCurveFrame(self.contentFrame)
 
 
         ## Set all stuff done
         ## Set all stuff done
@@ -271,7 +270,7 @@ class propertyWindow(AppShell,Pmw.MegaWidget):
         # And, it will set the call back function to setNodeColorVec()
         # And, it will set the call back function to setNodeColorVec()
         #################################################################
         #################################################################
         color = self.nodePath.getColor()
         color = self.nodePath.getColor()
-        print color
+        print(color)
         self.nodeColor = VectorWidgets.ColorEntry(
         self.nodeColor = VectorWidgets.ColorEntry(
             contentFrame, text = 'Node Color', value=[color.getX()*255,
             contentFrame, text = 'Node Color', value=[color.getX()*255,
                                                       color.getY()*255,
                                                       color.getY()*255,
@@ -725,7 +724,7 @@ class propertyWindow(AppShell,Pmw.MegaWidget):
         # But, not directly removed be this function.
         # But, not directly removed be this function.
         # This function will send out a message to notice dataHolder to remove this animation
         # This function will send out a message to notice dataHolder to remove this animation
         #################################################################
         #################################################################
-        print anim
+        print(anim)
         widget = self.widgetsDict[anim]
         widget = self.widgetsDict[anim]
         self.accept('animRemovedFromNode',self.redrawAnimProperty)
         self.accept('animRemovedFromNode',self.redrawAnimProperty)
         messenger.send('PW_removeAnimFromNode',[self.name, anim])
         messenger.send('PW_removeAnimFromNode',[self.name, anim])

+ 6 - 8
contrib/src/sceneeditor/quad.py

@@ -9,10 +9,8 @@
 from direct.showbase.ShowBaseGlobal import *
 from direct.showbase.ShowBaseGlobal import *
 from direct.interval.IntervalGlobal import *
 from direct.interval.IntervalGlobal import *
 from direct.showbase.DirectObject import DirectObject
 from direct.showbase.DirectObject import DirectObject
-from pandac.PandaModules import *
+from panda3d.core import *
 import math
 import math
-#Manakel 2/12/2005: replace from pandac import by from pandac.PandaModules import
-from pandac.PandaModules import MouseWatcher
 
 
 
 
 class ViewPort:
 class ViewPort:
@@ -506,7 +504,7 @@ class QuadView(DirectObject):
             ansY=-1.0+y2
             ansY=-1.0+y2
 
 
         self.xy=[ansX,ansY]
         self.xy=[ansX,ansY]
-        print "Sent X:%f Sent Y:%f"%(ansX,ansY)
+        print("Sent X:%f Sent Y:%f"%(ansX,ansY))
         #SEditor.iRay.pick(render,self.xy)
         #SEditor.iRay.pick(render,self.xy)
         SEditor.manipulationControl.manipulationStop(self.xy)
         SEditor.manipulationControl.manipulationStop(self.xy)
         #print "MouseX " + str(base.mouseWatcherNode.getMouseX()) + "MouseY " + str(base.mouseWatcherNode.getMouseY()) + "\n"
         #print "MouseX " + str(base.mouseWatcherNode.getMouseX()) + "MouseY " + str(base.mouseWatcherNode.getMouseY()) + "\n"
@@ -550,28 +548,28 @@ class QuadView(DirectObject):
             dr.setDimensions(0.5,1,0,0.5)
             dr.setDimensions(0.5,1,0,0.5)
 
 
     def setLeft(self):
     def setLeft(self):
-        print "LEFT"
+        print("LEFT")
         self.CurrentQuad=3
         self.CurrentQuad=3
         self.ChangeBaseDR()
         self.ChangeBaseDR()
         self.Left.setCam()
         self.Left.setCam()
         #self.Left.setDR(self.mouseWatcherNode)
         #self.Left.setDR(self.mouseWatcherNode)
 
 
     def setTop(self):
     def setTop(self):
-        print "TOP"
+        print("TOP")
         self.CurrentQuad=2
         self.CurrentQuad=2
         self.ChangeBaseDR()
         self.ChangeBaseDR()
         self.Top.setCam()
         self.Top.setCam()
         #self.Top.setDR(self.mouseWatcherNode)
         #self.Top.setDR(self.mouseWatcherNode)
 
 
     def setPerspective(self):
     def setPerspective(self):
-        print "PERSPECTIVE"
+        print("PERSPECTIVE")
         self.CurrentQuad=4
         self.CurrentQuad=4
         self.ChangeBaseDR()
         self.ChangeBaseDR()
         self.Perspective.setCam()
         self.Perspective.setCam()
         #self.Perspective.setDR(self.mouseWatcherNode)
         #self.Perspective.setDR(self.mouseWatcherNode)
 
 
     def setFront(self):
     def setFront(self):
-        print "FRONT"
+        print("FRONT")
         self.CurrentQuad=1
         self.CurrentQuad=1
         self.ChangeBaseDR()
         self.ChangeBaseDR()
         self.Front.setCam()
         self.Front.setCam()

+ 48 - 37
contrib/src/sceneeditor/sceneEditor.py

@@ -3,11 +3,19 @@ import sys
 try: import _tkinter
 try: import _tkinter
 except: sys.exit("Please install python module 'Tkinter'")
 except: sys.exit("Please install python module 'Tkinter'")
 
 
-import direct
-from direct.directbase.DirectStart import*
+from direct.showbase.ShowBase import ShowBase
+
+ShowBase()
+
 from direct.showbase.TkGlobal import spawnTkLoop
 from direct.showbase.TkGlobal import spawnTkLoop
-from Tkinter import *
-from tkFileDialog import *
+
+if sys.version_info >= (3, 0):
+    from tkinter import *
+    from tkinter.filedialog import *
+else:
+    from Tkinter import *
+    from tkFileDialog import *
+
 from direct.directtools.DirectGlobals import *
 from direct.directtools.DirectGlobals import *
 from direct.tkwidgets.AppShell import*
 from direct.tkwidgets.AppShell import*
 
 
@@ -251,7 +259,10 @@ class myLevelEditor(AppShell):
         for event in self.actionEvents:
         for event in self.actionEvents:
             self.accept(event[0], event[1], extraArgs = event[2:])
             self.accept(event[0], event[1], extraArgs = event[2:])
 
 
-        camera.toggleVis()
+        if camera.is_hidden():
+            camera.show()
+        else:
+            camera.hide()
         self.selectNode(base.camera) ## Initially, we select camera as the first node...
         self.selectNode(base.camera) ## Initially, we select camera as the first node...
 
 
     def appInit(self):
     def appInit(self):
@@ -386,31 +397,31 @@ class myLevelEditor(AppShell):
             self.showAbout()
             self.showAbout()
             return
             return
         elif buttonIndex==12:
         elif buttonIndex==12:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==13:
         elif buttonIndex==13:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==14:
         elif buttonIndex==14:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==15:
         elif buttonIndex==15:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==16:
         elif buttonIndex==16:
-            print "Your scene will be eliminated within five seconds, Save your world!!!, Number %d."%buttonIndex
+            print("Your scene will be eliminated within five seconds, Save your world!!!, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==17:
         elif buttonIndex==17:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==18:
         elif buttonIndex==18:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==19:
         elif buttonIndex==19:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
         elif buttonIndex==20:
         elif buttonIndex==20:
-            print "You haven't defined the function for this Button, Number %d."%buttonIndex
+            print("You haven't defined the function for this Button, Number %d."%buttonIndex)
             return
             return
 
 
         return
         return
@@ -666,17 +677,17 @@ class myLevelEditor(AppShell):
         #################################################################
         #################################################################
         type, info = AllScene.getInfoOfThisNode(nodePath)
         type, info = AllScene.getInfoOfThisNode(nodePath)
         name = nodePath.getName()
         name = nodePath.getName()
-        if not self.propertyWindow.has_key(name):
+        if name not in self.propertyWindow:
             self.propertyWindow[name] = propertyWindow(nodePath, type,info )
             self.propertyWindow[name] = propertyWindow(nodePath, type,info )
         pass
         pass
 
 
     def closePropertyWindow(self, name):
     def closePropertyWindow(self, name):
-        if self.propertyWindow.has_key(name):
+        if name in self.propertyWindow:
             del self.propertyWindow[name]
             del self.propertyWindow[name]
         return
         return
 
 
     def openMetadataPanel(self,nodePath=None):
     def openMetadataPanel(self,nodePath=None):
-        print nodePath
+        print(nodePath)
         self.MetadataPanel=MetadataPanel(nodePath)
         self.MetadataPanel=MetadataPanel(nodePath)
         pass
         pass
 
 
@@ -685,7 +696,7 @@ class myLevelEditor(AppShell):
         # duplicate(self, nodePath = None)
         # duplicate(self, nodePath = None)
         # This function will be called when user try to open the duplication window
         # This function will be called when user try to open the duplication window
         #################################################################
         #################################################################
-        print '----Duplication!!'
+        print('----Duplication!!')
         if nodePath != None:
         if nodePath != None:
             self.duplicateWindow = duplicateWindow(nodePath = nodePath)
             self.duplicateWindow = duplicateWindow(nodePath = nodePath)
         pass
         pass
@@ -791,8 +802,8 @@ class myLevelEditor(AppShell):
         #################################################################
         #################################################################
         name = nodePath.getName()
         name = nodePath.getName()
         if AllScene.isActor(name):
         if AllScene.isActor(name):
-            if self.animPanel.has_key(name):
-                print '---- You already have an animation panel for this Actor!'
+            if name in self.animPanel:
+                print('---- You already have an animation panel for this Actor!')
                 return
                 return
             else:
             else:
                 Actor = AllScene.getActor(name)
                 Actor = AllScene.getActor(name)
@@ -842,9 +853,9 @@ class myLevelEditor(AppShell):
             # Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module
             # Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module
             # And if we reload a scene python wont reload since its already in sys.modules... and hence we delete it
             # And if we reload a scene python wont reload since its already in sys.modules... and hence we delete it
             # If there is ever a garbage colleciton bug..this might be a point to look at
             # If there is ever a garbage colleciton bug..this might be a point to look at
-            if sys.modules.has_key(currentModName):
+            if currentModName in sys.modules:
                 del sys.modules[currentModName]
                 del sys.modules[currentModName]
-                print sys.getrefcount(AllScene.theScene)
+                print(sys.getrefcount(AllScene.theScene))
                 del AllScene.theScene
                 del AllScene.theScene
         else:
         else:
             AllScene.resetAll()
             AllScene.resetAll()
@@ -872,9 +883,9 @@ class myLevelEditor(AppShell):
             # Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module
             # Let us actually remove the scene from sys modules... this is done because every scene is loaded as a module
             # And if we reload a scene python wont reload since its already in sys.modules... and hence we delete it
             # And if we reload a scene python wont reload since its already in sys.modules... and hence we delete it
             # If there is ever a garbage colleciton bug..this might be a point to look at
             # If there is ever a garbage colleciton bug..this might be a point to look at
-            if sys.modules.has_key(currentModName):
+            if currentModName in sys.modules:
                 del sys.modules[currentModName]
                 del sys.modules[currentModName]
-                print sys.getrefcount(AllScene.theScene)
+                print(sys.getrefcount(AllScene.theScene))
                 del AllScene.theScene
                 del AllScene.theScene
         else:
         else:
             AllScene.resetAll()
             AllScene.resetAll()
@@ -886,7 +897,7 @@ class myLevelEditor(AppShell):
 
 
         thefile=Filename(self.CurrentFileName)
         thefile=Filename(self.CurrentFileName)
         thedir=thefile.getFullpathWoExtension()
         thedir=thefile.getFullpathWoExtension()
-        print "SCENE EDITOR::" + thedir
+        print("SCENE EDITOR::" + thedir)
         self.CurrentDirName=thedir
         self.CurrentDirName=thedir
         if self.CurrentFileName != None:
         if self.CurrentFileName != None:
             self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
             self.parent.title('Scene Editor - '+ Filename.fromOsSpecific(self.CurrentFileName).getBasenameWoExtension())
@@ -934,7 +945,7 @@ class myLevelEditor(AppShell):
             theScene.writeBamFile(fileName)
             theScene.writeBamFile(fileName)
         else:
         else:
             render.writeBamFile(fileName+".bad")
             render.writeBamFile(fileName+".bad")
-        print " Scenegraph saved as :" +str(fileName)
+        print(" Scenegraph saved as :" +str(fileName))
 
 
     def loadFromBam(self):
     def loadFromBam(self):
         fileName = tkFileDialog.askopenfilename(filetypes = [("BAM",".bam")],title = "Load Scenegraph from Bam file")
         fileName = tkFileDialog.askopenfilename(filetypes = [("BAM",".bam")],title = "Load Scenegraph from Bam file")
@@ -959,7 +970,7 @@ class myLevelEditor(AppShell):
         ###############################################################################
         ###############################################################################
         # !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!!
         # !!!!! See if a module exists by this name... if it does you cannot use this filename !!!!!
         ###############################################################################
         ###############################################################################
-        if(sys.modules.has_key(fCheck.getBasenameWoExtension())):
+        if(fCheck.getBasenameWoExtension() in sys.modules):
             tkMessageBox.showwarning(
             tkMessageBox.showwarning(
             "Save file",
             "Save file",
             "Cannot save with this name because there is a system module with the same name. Please resave as something else."
             "Cannot save with this name because there is a system module with the same name. Please resave as something else."
@@ -993,7 +1004,7 @@ class myLevelEditor(AppShell):
         if modelFilename:
         if modelFilename:
             self.makeDirty()
             self.makeDirty()
             if not AllScene.loadModel(modelFilename, Filename.fromOsSpecific(modelFilename)):
             if not AllScene.loadModel(modelFilename, Filename.fromOsSpecific(modelFilename)):
-                print '----Error! No Such Model File!'
+                print('----Error! No Such Model File!')
         pass
         pass
 
 
     def loadActor(self):
     def loadActor(self):
@@ -1016,12 +1027,12 @@ class myLevelEditor(AppShell):
         if ActorFilename:
         if ActorFilename:
             self.makeDirty()
             self.makeDirty()
             if not AllScene.loadActor(ActorFilename, Filename.fromOsSpecific(ActorFilename)):
             if not AllScene.loadActor(ActorFilename, Filename.fromOsSpecific(ActorFilename)):
-                print '----Error! No Such Model File!'
+                print('----Error! No Such Model File!')
         pass
         pass
 
 
     def importScene(self):
     def importScene(self):
         self.makeDirty()
         self.makeDirty()
-        print '----God bless you Please Import!'
+        print('----God bless you Please Import!')
         pass
         pass
 
 
 
 
@@ -1495,7 +1506,7 @@ class myLevelEditor(AppShell):
         return
         return
 
 
     def animPanelClose(self, name):
     def animPanelClose(self, name):
-        if self.animPanel.has_key(name):
+        if name in self.animPanel:
             del self.animPanel[name]
             del self.animPanel[name]
         return
         return
 
 
@@ -1508,8 +1519,8 @@ class myLevelEditor(AppShell):
         ################################################################
         ################################################################
         name = nodePath.getName()
         name = nodePath.getName()
         if AllScene.isActor(name):
         if AllScene.isActor(name):
-            if self.animBlendPanel.has_key(name):
-                print '---- You already have an Blend Animation Panel for this Actor!'
+            if name in self.animBlendPanel:
+                print('---- You already have an Blend Animation Panel for this Actor!')
                 return
                 return
             else:
             else:
                 Actor = AllScene.getActor(name)
                 Actor = AllScene.getActor(name)
@@ -1554,7 +1565,7 @@ class myLevelEditor(AppShell):
         # This function will be called when Blend panel has been closed.
         # This function will be called when Blend panel has been closed.
         # Here we will reset the reference dictionary so it can be open again.
         # Here we will reset the reference dictionary so it can be open again.
         ################################################################
         ################################################################
-        if self.animBlendPanel.has_key(name):
+        if name in self.animBlendPanel:
             del self.animBlendPanel[name]
             del self.animBlendPanel[name]
         return
         return
 
 
@@ -1613,7 +1624,7 @@ class myLevelEditor(AppShell):
 
 
     def openAlignPanel(self, nodePath=None):
     def openAlignPanel(self, nodePath=None):
         name = nodePath.getName()
         name = nodePath.getName()
-        if not self.alignPanelDict.has_key(name):
+        if name not in self.alignPanelDict:
             list = AllScene.getAllObjNameAsList()
             list = AllScene.getAllObjNameAsList()
             if name in list:
             if name in list:
                 list.remove(name)
                 list.remove(name)
@@ -1623,7 +1634,7 @@ class myLevelEditor(AppShell):
         return
         return
 
 
     def closeAlignPanel(self, name=None):
     def closeAlignPanel(self, name=None):
-        if self.alignPanelDict.has_key(name):
+        if name in self.alignPanelDict:
             del self.alignPanelDict[name]
             del self.alignPanelDict[name]
 
 
     def alignObject(self, nodePath, name, list):
     def alignObject(self, nodePath, name, list):
@@ -1705,4 +1716,4 @@ class myLevelEditor(AppShell):
 
 
 editor = myLevelEditor(parent = base.tkRoot)
 editor = myLevelEditor(parent = base.tkRoot)
 
 
-run()
+base.run()

+ 9 - 5
contrib/src/sceneeditor/seAnimPanel.py

@@ -5,12 +5,16 @@
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 from direct.tkwidgets.AppShell import *
 from direct.tkwidgets.AppShell import *
 from direct.showbase.TkGlobal import *
 from direct.showbase.TkGlobal import *
-from tkSimpleDialog import askfloat
 import string
 import string
 import math
 import math
 import types
 import types
 from direct.task import Task
 from direct.task import Task
 
 
+if sys.version_info >= (3, 0):
+    from tkinter.simpledialog import askfloat
+else:
+    from tkSimpleDialog import askfloat
+
 FRAMES = 0
 FRAMES = 0
 SECONDS = 1
 SECONDS = 1
 
 
@@ -112,7 +116,7 @@ class AnimPanel(AppShell):
         self.playRateEntry.selectitem('1.0')
         self.playRateEntry.selectitem('1.0')
 
 
         ### Loop checkbox
         ### Loop checkbox
-        Label(actorFrame, text= "Loop:", font=('MSSansSerif', 12)).place(x=420,y=05,anchor=NW)
+        Label(actorFrame, text= "Loop:", font=('MSSansSerif', 12)).place(x=420,y=5,anchor=NW)
 
 
         self.loopVar = IntVar()
         self.loopVar = IntVar()
         self.loopVar.set(0)
         self.loopVar.set(0)
@@ -250,7 +254,7 @@ class AnimPanel(AppShell):
         self['animList'] = self['actor'].getAnimNames()
         self['animList'] = self['actor'].getAnimNames()
         animL = self['actor'].getAnimNames()
         animL = self['actor'].getAnimNames()
         self.AnimEntry.setlist(animL)
         self.AnimEntry.setlist(animL)
-        print '-----',animL
+        print('-----',animL)
         return
         return
 
 
     def loadAnimation(self):
     def loadAnimation(self):
@@ -278,7 +282,7 @@ class AnimPanel(AppShell):
             taskMgr.add(self.playTask, self.id + '_UpdateTask')
             taskMgr.add(self.playTask, self.id + '_UpdateTask')
             self.stopButton.config(state=NORMAL)
             self.stopButton.config(state=NORMAL)
         else:
         else:
-            print '----Illegal Animaion name!!', self.animName
+            print('----Illegal Animaion name!!', self.animName)
         return
         return
 
 
     def playTask(self, task):
     def playTask(self, task):
@@ -591,7 +595,7 @@ class LoadAnimPanel(AppShell):
         else:
         else:
             self.animList.append(name)
             self.animList.append(name)
         self.AnimName_1.setlist(self.animList)
         self.AnimName_1.setlist(self.animList)
-        print self.animDic
+        print(self.animDic)
         return
         return
 
 
     def ok_press(self):
     def ok_press(self):

+ 9 - 5
contrib/src/sceneeditor/seBlendAnimPanel.py

@@ -5,12 +5,16 @@
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 from direct.tkwidgets.AppShell import *
 from direct.tkwidgets.AppShell import *
 from direct.showbase.TkGlobal import *
 from direct.showbase.TkGlobal import *
-from tkSimpleDialog import askfloat
 import string
 import string
 import math
 import math
 import types
 import types
 from direct.task import Task
 from direct.task import Task
 
 
+if sys.version_info >= (3, 0):
+    from tkinter.simpledialog import askfloat
+else:
+    from tkSimpleDialog import askfloat
+
 FRAMES = 0
 FRAMES = 0
 SECONDS = 1
 SECONDS = 1
 
 
@@ -304,7 +308,7 @@ class BlendAnimPanel(AppShell):
             taskMgr.add(self.playTask, self.id + '_UpdateTask')
             taskMgr.add(self.playTask, self.id + '_UpdateTask')
             self.stopButton.config(state=NORMAL)
             self.stopButton.config(state=NORMAL)
         else:
         else:
-            print '----Illegal Animaion name!!', self.animNameA +  ',  '+ self.animNameB
+            print('----Illegal Animaion name!!', self.animNameA +  ',  '+ self.animNameB)
         return
         return
 
 
     def playTask(self, task):
     def playTask(self, task):
@@ -348,7 +352,7 @@ class BlendAnimPanel(AppShell):
         # setAnimation(self, animation, AB = 'a')
         # setAnimation(self, animation, AB = 'a')
         # see play(self)
         # see play(self)
         #################################################################
         #################################################################
-        print 'OK!!!'
+        print('OK!!!')
         if AB == 'a':
         if AB == 'a':
             if self.animNameA != None:
             if self.animNameA != None:
                 self['actor'].setControlEffect(self.animNameA, 1.0, 'modelRoot','lodRoot')
                 self['actor'].setControlEffect(self.animNameA, 1.0, 'modelRoot','lodRoot')
@@ -519,7 +523,7 @@ class BlendAnimPanel(AppShell):
         # then this function will set Animation A to "a" and animation B
         # then this function will set Animation A to "a" and animation B
         # to "b" and set the ratio slider to "c" position.
         # to "b" and set the ratio slider to "c" position.
         #################################################################
         #################################################################
-        if self.blendDict.has_key(name):
+        if name in self.blendDict:
             self.currentBlendName = name
             self.currentBlendName = name
             animA = self.blendDict[name][0]
             animA = self.blendDict[name][0]
             animB = self.blendDict[name][1]
             animB = self.blendDict[name][1]
@@ -544,7 +548,7 @@ class BlendAnimPanel(AppShell):
         self.blendDict.clear()
         self.blendDict.clear()
         del self.blendDict
         del self.blendDict
         self.blendDict = dict.copy()
         self.blendDict = dict.copy()
-        print self.blendDict
+        print(self.blendDict)
         if len(self.blendDict)>0:
         if len(self.blendDict)>0:
             self.blendList = self.blendDict.keys()
             self.blendList = self.blendDict.keys()
         else:
         else:

+ 10 - 11
contrib/src/sceneeditor/seCameraControl.py

@@ -55,14 +55,14 @@ class DirectCameraControl(DirectObject):
             ['n', self.pickNextCOA],
             ['n', self.pickNextCOA],
             ['u', self.orbitUprightCam],
             ['u', self.orbitUprightCam],
             ['shift-u', self.uprightCam],
             ['shift-u', self.uprightCam],
-            [`1`, self.spawnMoveToView, 1],
-            [`2`, self.spawnMoveToView, 2],
-            [`3`, self.spawnMoveToView, 3],
-            [`4`, self.spawnMoveToView, 4],
-            [`5`, self.spawnMoveToView, 5],
-            [`6`, self.spawnMoveToView, 6],
-            [`7`, self.spawnMoveToView, 7],
-            [`8`, self.spawnMoveToView, 8],
+            ['1', self.spawnMoveToView, 1],
+            ['2', self.spawnMoveToView, 2],
+            ['3', self.spawnMoveToView, 3],
+            ['4', self.spawnMoveToView, 4],
+            ['5', self.spawnMoveToView, 5],
+            ['6', self.spawnMoveToView, 6],
+            ['7', self.spawnMoveToView, 7],
+            ['8', self.spawnMoveToView, 8],
             ['9', self.swingCamAboutWidget, -90.0, t],
             ['9', self.swingCamAboutWidget, -90.0, t],
             ['0', self.swingCamAboutWidget,  90.0, t],
             ['0', self.swingCamAboutWidget,  90.0, t],
             ['`', self.removeManipulateCameraTask],
             ['`', self.removeManipulateCameraTask],
@@ -351,7 +351,7 @@ class DirectCameraControl(DirectObject):
             # MRM: Would be nice to be able to control this
             # MRM: Would be nice to be able to control this
             # At least display it
             # At least display it
             dist = pow(10.0, self.nullHitPointCount)
             dist = pow(10.0, self.nullHitPointCount)
-            SEditor.message('COA Distance: ' + `dist`)
+            SEditor.message('COA Distance: ' + repr(dist))
             coa.set(0,dist,0)
             coa.set(0,dist,0)
         # Compute COA Dist
         # Compute COA Dist
         coaDist = Vec3(coa - ZERO_POINT).length()
         coaDist = Vec3(coa - ZERO_POINT).length()
@@ -392,8 +392,7 @@ class DirectCameraControl(DirectObject):
             sf = 0.1
             sf = 0.1
         self.coaMarker.setScale(sf)
         self.coaMarker.setScale(sf)
         # Lerp color to fade out
         # Lerp color to fade out
-        self.coaMarker.lerpColor(VBase4(1,0,0,1), VBase4(1,0,0,0), 3.0,
-                                 task = 'fadeAway')
+        self.coaMarker.colorInterval(3.0, VBase4(1, 0, 0, 0), name='fadeAway').start()
 
 
     def homeCam(self):
     def homeCam(self):
         # Record undo point
         # Record undo point

+ 8 - 2
contrib/src/sceneeditor/seColorEntry.py

@@ -12,9 +12,15 @@
 from direct.tkwidgets import Valuator
 from direct.tkwidgets import Valuator
 from direct.tkwidgets import Floater
 from direct.tkwidgets import Floater
 from direct.tkwidgets import Slider
 from direct.tkwidgets import Slider
-import string, Pmw, Tkinter, tkColorChooser
+import sys, Pmw
 from direct.tkwidgets.VectorWidgets import VectorEntry
 from direct.tkwidgets.VectorWidgets import VectorEntry
 
 
+if sys.version_info >= (3, 0):
+    from tkinter.colorchooser import askcolor
+else:
+    from tkColorChooser import askcolor
+
+
 class seColorEntry(VectorEntry):
 class seColorEntry(VectorEntry):
     def __init__(self, parent = None, **kw):
     def __init__(self, parent = None, **kw):
         # Initialize options for the class (overriding some superclass options)
         # Initialize options for the class (overriding some superclass options)
@@ -41,7 +47,7 @@ class seColorEntry(VectorEntry):
 
 
     def popupColorPicker(self):
     def popupColorPicker(self):
         # Can pass in current color with: color = (255, 0, 0)
         # Can pass in current color with: color = (255, 0, 0)
-        color = tkColorChooser.askcolor(
+        color = askcolor(
             parent = self.interior(),
             parent = self.interior(),
             # Initialize it to current color
             # Initialize it to current color
             initialcolor = tuple(self.get()[:3]))[0]
             initialcolor = tuple(self.get()[:3]))[0]

+ 18 - 18
contrib/src/sceneeditor/seFileSaver.py

@@ -3,7 +3,7 @@
 # This code saves the scene out as python code... the scene is stored in the various dictionaries in "dataHolder.py" ...the class "AllScene"
 # This code saves the scene out as python code... the scene is stored in the various dictionaries in "dataHolder.py" ...the class "AllScene"
 #
 #
 ####################################################################################################################################################
 ####################################################################################################################################################
-from pandac.PandaModules import *
+from panda3d.core import *
 
 
 from direct.showbase.ShowBaseGlobal import *
 from direct.showbase.ShowBaseGlobal import *
 import os
 import os
@@ -42,7 +42,7 @@ class FileSaver:
         i1="    " # indentation
         i1="    " # indentation
         i2=i1+i1  # double indentation
         i2=i1+i1  # double indentation
         out_file = open(filename,"w")
         out_file = open(filename,"w")
-        print "dirname:" + dirname
+        print("dirname:" + dirname)
         if( not os.path.isdir(dirname)):
         if( not os.path.isdir(dirname)):
             os.mkdir(dirname)
             os.mkdir(dirname)
         savepathname=Filename(filename)
         savepathname=Filename(filename)
@@ -176,7 +176,7 @@ class FileSaver:
                     newtexpathF=Filename(newtexpath)
                     newtexpathF=Filename(newtexpath)
                     newtexpathSpecific=newtexpathF.toOsSpecific()
                     newtexpathSpecific=newtexpathF.toOsSpecific()
 
 
-                    print "TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific
+                    print("TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific)
                     if(oldtexpath != newtexpathSpecific):
                     if(oldtexpath != newtexpathSpecific):
                         shutil.copyfile(oldtexpath,newtexpathSpecific)
                         shutil.copyfile(oldtexpath,newtexpathSpecific)
 
 
@@ -187,7 +187,7 @@ class FileSaver:
 
 
                 # Copy the file over to the relative directory
                 # Copy the file over to the relative directory
                 oldModelpath=AllScene.ModelRefDic[model].toOsSpecific()
                 oldModelpath=AllScene.ModelRefDic[model].toOsSpecific()
-                print "FILESAVER:: copying from " + AllScene.ModelRefDic[model].toOsSpecific() + "to" + newpathSpecific
+                print("FILESAVER:: copying from " + AllScene.ModelRefDic[model].toOsSpecific() + "to" + newpathSpecific)
                 if(oldModelpath!=newpathSpecific):
                 if(oldModelpath!=newpathSpecific):
                     shutil.copyfile(oldModelpath,newpathSpecific)
                     shutil.copyfile(oldModelpath,newpathSpecific)
 
 
@@ -197,7 +197,7 @@ class FileSaver:
                 etc=EggTextureCollection()
                 etc=EggTextureCollection()
                 etc.extractTextures(e)
                 etc.extractTextures(e)
                 for index in range(len(fnamelist)):
                 for index in range(len(fnamelist)):
-                    print fnamelist[index]
+                    print(fnamelist[index])
                     tex=etc.findFilename(Filename(fnamelist[index]))
                     tex=etc.findFilename(Filename(fnamelist[index]))
                     fn=Filename(tex.getFilename())
                     fn=Filename(tex.getFilename())
                     fn.setDirname("")
                     fn.setDirname("")
@@ -305,14 +305,14 @@ class FileSaver:
                     newtexpath=dirname + "/" + texfilename.getBasename()
                     newtexpath=dirname + "/" + texfilename.getBasename()
                     newtexpathF=Filename(newtexpath)
                     newtexpathF=Filename(newtexpath)
                     newtexpathSpecific=newtexpathF.toOsSpecific()
                     newtexpathSpecific=newtexpathF.toOsSpecific()
-                    print "TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific
+                    print("TEXTURE SAVER:: copying" + oldtexpath + " to " + newtexpathSpecific)
                     if(oldtexpath != newtexpathSpecific):
                     if(oldtexpath != newtexpathSpecific):
                         shutil.copyfile(oldtexpath,newtexpathSpecific)
                         shutil.copyfile(oldtexpath,newtexpathSpecific)
 
 
 
 
                 # Copy the file over to the relative directory
                 # Copy the file over to the relative directory
                 oldActorpath=AllScene.ActorRefDic[actor].toOsSpecific()
                 oldActorpath=AllScene.ActorRefDic[actor].toOsSpecific()
-                print "FILESAVER:: copying from " + AllScene.ActorRefDic[actor].toOsSpecific() + "to" + newpathSpecific
+                print("FILESAVER:: copying from " + AllScene.ActorRefDic[actor].toOsSpecific() + "to" + newpathSpecific)
                 if(oldActorpath!=newpathSpecific):
                 if(oldActorpath!=newpathSpecific):
                     shutil.copyfile(oldActorpath,newpathSpecific)
                     shutil.copyfile(oldActorpath,newpathSpecific)
 
 
@@ -322,7 +322,7 @@ class FileSaver:
                 etc=EggTextureCollection()
                 etc=EggTextureCollection()
                 etc.extractTextures(e)
                 etc.extractTextures(e)
                 for index in range(len(actorfnamelist)):
                 for index in range(len(actorfnamelist)):
-                    print actorfnamelist[index]
+                    print(actorfnamelist[index])
                     tex=etc.findFilename(Filename(actorfnamelist[index]))
                     tex=etc.findFilename(Filename(actorfnamelist[index]))
                     fn=Filename(tex.getFilename())
                     fn=Filename(tex.getFilename())
                     fn.setDirname("")
                     fn.setDirname("")
@@ -362,12 +362,12 @@ class FileSaver:
                         #out_file.write(i2+ "self."+ actorS + ".loadAnims(" + str(ActorAnimations) +")\n") # Old way with absolute paths
                         #out_file.write(i2+ "self."+ actorS + ".loadAnims(" + str(ActorAnimations) +")\n") # Old way with absolute paths
                         #Manakel 2/12/2004: solve the not empty but not defined animation case
                         #Manakel 2/12/2004: solve the not empty but not defined animation case
                         if not animation is None:
                         if not animation is None:
-                            print "ACTOR ANIMATIONS:" + ActorAnimations[animation]
+                            print("ACTOR ANIMATIONS:" + ActorAnimations[animation])
                             oldAnimPath=Filename(ActorAnimations[animation])
                             oldAnimPath=Filename(ActorAnimations[animation])
                             oldAnim=oldAnimPath.toOsSpecific()
                             oldAnim=oldAnimPath.toOsSpecific()
                             dirOS=Filename(dirname)
                             dirOS=Filename(dirname)
                             newAnim=dirOS.toOsSpecific() + "\\" + oldAnimPath.getBasename()
                             newAnim=dirOS.toOsSpecific() + "\\" + oldAnimPath.getBasename()
-                            print "ACTOR ANIM SAVER:: Comparing" + oldAnim +"and" + newAnim
+                            print("ACTOR ANIM SAVER:: Comparing" + oldAnim +"and" + newAnim)
                             if(oldAnim!=newAnim):
                             if(oldAnim!=newAnim):
                                 shutil.copyfile(oldAnim,newAnim)
                                 shutil.copyfile(oldAnim,newAnim)
                             newAnimF=Filename.fromOsSpecific(newAnim)
                             newAnimF=Filename.fromOsSpecific(newAnim)
@@ -379,16 +379,16 @@ class FileSaver:
                 out_file.write(i2+ i1+"self."+ actorS + ".loadAnims(" + str(ActorAnimations) +")\n") # Now with new relative paths
                 out_file.write(i2+ i1+"self."+ actorS + ".loadAnims(" + str(ActorAnimations) +")\n") # Now with new relative paths
                 out_file.write(i2+"else:\n")
                 out_file.write(i2+"else:\n")
                 theloadAnimString=str(ActorAnimationsInvoke)# We hack the "self.executionpath" part into the dictionary as a variable using string replace
                 theloadAnimString=str(ActorAnimationsInvoke)# We hack the "self.executionpath" part into the dictionary as a variable using string replace
-                print "LOAD ANIM STRING BEFORE" + theloadAnimString
+                print("LOAD ANIM STRING BEFORE" + theloadAnimString)
                 theloadAnimString=theloadAnimString.replace('\'self.executionpath +','self.executionpath + \'')
                 theloadAnimString=theloadAnimString.replace('\'self.executionpath +','self.executionpath + \'')
-                print "LOAD ANIM STRING AFTER" + theloadAnimString
+                print("LOAD ANIM STRING AFTER" + theloadAnimString)
                 out_file.write(i2+ i1+"self."+ actorS + ".loadAnims(" + theloadAnimString +")\n") # Now with new relative paths based on editor invocation
                 out_file.write(i2+ i1+"self."+ actorS + ".loadAnims(" + theloadAnimString +")\n") # Now with new relative paths based on editor invocation
 
 
                 out_file.write(i2+ "self.ActorDic[\'" + actorS + "\']=self." + AllScene.ActorDic[actor].getName()+"\n")
                 out_file.write(i2+ "self.ActorDic[\'" + actorS + "\']=self." + AllScene.ActorDic[actor].getName()+"\n")
                 #out_file.write(i2+ "self.ActorRefDic[\'" + actorS + "\']=Filename(\'"+AllScene.ActorRefDic[actor].getFullpath() +"\')\n") # Old way with absolute paths
                 #out_file.write(i2+ "self.ActorRefDic[\'" + actorS + "\']=Filename(\'"+AllScene.ActorRefDic[actor].getFullpath() +"\')\n") # Old way with absolute paths
                 out_file.write(i2+ "self.ActorRefDic[\'" + actorS + "\']=\'"+ AllScene.ActorRefDic[actor].getBasename() +"\'\n")# Relative paths
                 out_file.write(i2+ "self.ActorRefDic[\'" + actorS + "\']=\'"+ AllScene.ActorRefDic[actor].getBasename() +"\'\n")# Relative paths
                 out_file.write(i2+ "self.ActorDic[\'"+ actorS + "\'].setName(\'"+ actorS +"\')\n")
                 out_file.write(i2+ "self.ActorDic[\'"+ actorS + "\'].setName(\'"+ actorS +"\')\n")
-                if(AllScene.blendAnimDict.has_key(actor)): # Check if a dictionary of blended animations exists
+                if(actor in AllScene.blendAnimDict): # Check if a dictionary of blended animations exists
                     out_file.write(i2+ "self.blendAnimDict[\"" + actorS +"\"]=" + str(AllScene.blendAnimDict[actor]) + "\n")
                     out_file.write(i2+ "self.blendAnimDict[\"" + actorS +"\"]=" + str(AllScene.blendAnimDict[actor]) + "\n")
 
 
 
 
@@ -458,7 +458,7 @@ class FileSaver:
 
 
                 pass
                 pass
             else:
             else:
-                 print "Invalid Collision Node: " + nodetype
+                 print("Invalid Collision Node: " + nodetype)
             out_file.write("\n")
             out_file.write("\n")
 
 
 
 
@@ -653,7 +653,7 @@ class FileSaver:
             if(parent=="render" or parent=="camera"):
             if(parent=="render" or parent=="camera"):
                 out_file.write(i2+ "self."+ modelS + ".reparentTo(" + parent + ")\n")
                 out_file.write(i2+ "self."+ modelS + ".reparentTo(" + parent + ")\n")
             else:
             else:
-                if(AllScene.particleDict.has_key(parent)):
+                if(parent in AllScene.particleDict):
                     out_file.write(i2+ "self."+ modelS + ".reparentTo(self." + parent + ".getEffect())\n")
                     out_file.write(i2+ "self."+ modelS + ".reparentTo(self." + parent + ".getEffect())\n")
                 else:
                 else:
                     out_file.write(i2+ "self."+ modelS + ".reparentTo(self." + parent + ")\n")
                     out_file.write(i2+ "self."+ modelS + ".reparentTo(self." + parent + ")\n")
@@ -666,7 +666,7 @@ class FileSaver:
             if(parent=="render" or parent=="camera"):
             if(parent=="render" or parent=="camera"):
                 out_file.write(i2+ "self."+ dummyS + ".reparentTo(" + parent + ")\n")
                 out_file.write(i2+ "self."+ dummyS + ".reparentTo(" + parent + ")\n")
             else:
             else:
-                if(AllScene.particleDict.has_key(parent)):
+                if(parent in AllScene.particleDict):
                     out_file.write(i2+ "self."+ dummyS + ".reparentTo(self." + parent + ".getEffect())\n")
                     out_file.write(i2+ "self."+ dummyS + ".reparentTo(self." + parent + ".getEffect())\n")
                 else:
                 else:
                     out_file.write(i2+ "self."+ dummyS + ".reparentTo(self." + parent + ")\n")
                     out_file.write(i2+ "self."+ dummyS + ".reparentTo(self." + parent + ")\n")
@@ -680,7 +680,7 @@ class FileSaver:
             if(parent=="render" or parent=="camera"):
             if(parent=="render" or parent=="camera"):
                 out_file.write(i2+ "self."+ actorS + ".reparentTo(" + parent + ")\n")
                 out_file.write(i2+ "self."+ actorS + ".reparentTo(" + parent + ")\n")
             else:
             else:
-                if(AllScene.particleDict.has_key(parent)):
+                if(parent in AllScene.particleDict):
                     out_file.write(i2+ "self."+ actorS + ".reparentTo(self." + parent + ".getEffect())\n")
                     out_file.write(i2+ "self."+ actorS + ".reparentTo(self." + parent + ".getEffect())\n")
                 else:
                 else:
                     out_file.write(i2+ "self."+ actorS + ".reparentTo(self." + parent + ")\n")
                     out_file.write(i2+ "self."+ actorS + ".reparentTo(self." + parent + ")\n")
@@ -698,7 +698,7 @@ class FileSaver:
                 out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]="+ parentname + ".attachNewNode(self." + collnodeS + "_Node)\n")
                 out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]="+ parentname + ".attachNewNode(self." + collnodeS + "_Node)\n")
             else:
             else:
                 #Manakel 2/12/2005: parent replaced by parent Name but why Parent name in partice and parent for other objects?
                 #Manakel 2/12/2005: parent replaced by parent Name but why Parent name in partice and parent for other objects?
-                if(AllScene.particleDict.has_key(parentname)):
+                if(parentname in AllScene.particleDict):
                     out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]=self."+ parentname + "getEffect().attachNewNode(self." + collnodeS + "_Node)\n")
                     out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]=self."+ parentname + "getEffect().attachNewNode(self." + collnodeS + "_Node)\n")
                 else:
                 else:
                     out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]=self."+ parentname + ".attachNewNode(self." + collnodeS + "_Node)\n")
                     out_file.write(i2+"self.collisionDict[\"" + collnodeS + "\"]=self."+ parentname + ".attachNewNode(self." + collnodeS + "_Node)\n")

+ 1 - 3
contrib/src/sceneeditor/seForceGroup.py

@@ -1,8 +1,6 @@
-from pandac.PandaModules import *
+from panda3d.core import *
 from direct.showbase.DirectObject import DirectObject
 from direct.showbase.DirectObject import DirectObject
 from direct.showbase.PhysicsManagerGlobal import *
 from direct.showbase.PhysicsManagerGlobal import *
-#Manakel 2/12/2005: replace from pandac import by from pandac.PandaModules import
-from pandac.PandaModules import ForceNode
 from direct.directnotify import DirectNotifyGlobal
 from direct.directnotify import DirectNotifyGlobal
 import sys
 import sys
 
 

+ 8 - 8
contrib/src/sceneeditor/seGeometry.py

@@ -12,7 +12,7 @@
 #
 #
 #################################################################
 #################################################################
 
 
-from pandac.PandaModules import *
+from panda3d.core import *
 from direct.directtools.DirectGlobals import *
 from direct.directtools.DirectGlobals import *
 from direct.directtools.DirectUtil import *
 from direct.directtools.DirectUtil import *
 import math
 import math
@@ -41,10 +41,10 @@ class LineNodePath(NodePath):
         ls.setColor(colorVec)
         ls.setColor(colorVec)
 
 
     def moveTo( self, *_args ):
     def moveTo( self, *_args ):
-        apply( self.lineSegs.moveTo, _args )
+        self.lineSegs.moveTo(*_args)
 
 
     def drawTo( self, *_args ):
     def drawTo( self, *_args ):
-        apply( self.lineSegs.drawTo, _args )
+        self.lineSegs.drawTo(*_args)
 
 
     def create( self, frameAccurate = 0 ):
     def create( self, frameAccurate = 0 ):
         self.lineSegs.create( self.lineNode, frameAccurate )
         self.lineSegs.create( self.lineNode, frameAccurate )
@@ -60,13 +60,13 @@ class LineNodePath(NodePath):
         self.lineSegs.setThickness( thickness )
         self.lineSegs.setThickness( thickness )
 
 
     def setColor( self, *_args ):
     def setColor( self, *_args ):
-        apply( self.lineSegs.setColor, _args )
+        self.lineSegs.setColor(*_args)
 
 
     def setVertex( self, *_args):
     def setVertex( self, *_args):
-        apply( self.lineSegs.setVertex, _args )
+        self.lineSegs.setVertex(*_args)
 
 
     def setVertexColor( self, vertex, *_args ):
     def setVertexColor( self, vertex, *_args ):
-        apply( self.lineSegs.setVertexColor, (vertex,) + _args )
+        self.lineSegs.setVertexColor(*(vertex,) + _args)
 
 
     def getCurrentPosition( self ):
     def getCurrentPosition( self ):
         return self.lineSegs.getCurrentPosition()
         return self.lineSegs.getCurrentPosition()
@@ -132,9 +132,9 @@ class LineNodePath(NodePath):
         Given a list of lists of points, draw a separate line for each list
         Given a list of lists of points, draw a separate line for each list
         """
         """
         for pointList in lineList:
         for pointList in lineList:
-            apply(self.moveTo, pointList[0])
+            self.moveTo(*pointList[0])
             for point in pointList[1:]:
             for point in pointList[1:]:
-                apply(self.drawTo, point)
+                self.drawTo(*point)
 
 
 ##
 ##
 ## Given a point in space, and a direction, find the point of intersection
 ## Given a point in space, and a direction, find the point of intersection

+ 10 - 11
contrib/src/sceneeditor/seLights.py

@@ -3,9 +3,8 @@
 # Written by Yi-Hong Lin, [email protected], 2004
 # Written by Yi-Hong Lin, [email protected], 2004
 #################################################################
 #################################################################
 from direct.showbase.DirectObject import *
 from direct.showbase.DirectObject import *
-from string import lower
 from direct.directtools import DirectUtil
 from direct.directtools import DirectUtil
-from pandac.PandaModules import *
+from panda3d.core import *
 import string
 import string
 
 
 
 
@@ -341,7 +340,7 @@ class seLightManager(NodePath):
         if type == 'ambient':
         if type == 'ambient':
             self.ambientCount += 1
             self.ambientCount += 1
             if(name=='DEFAULT_NAME'):
             if(name=='DEFAULT_NAME'):
-                light = AmbientLight('ambient_' + `self.ambientCount`)
+                light = AmbientLight('ambient_' + repr(self.ambientCount))
             else:
             else:
                 light = AmbientLight(name)
                 light = AmbientLight(name)
 
 
@@ -350,7 +349,7 @@ class seLightManager(NodePath):
         elif type == 'directional':
         elif type == 'directional':
             self.directionalCount += 1
             self.directionalCount += 1
             if(name=='DEFAULT_NAME'):
             if(name=='DEFAULT_NAME'):
-                light = DirectionalLight('directional_' + `self.directionalCount`)
+                light = DirectionalLight('directional_' + repr(self.directionalCount))
             else:
             else:
                 light = DirectionalLight(name)
                 light = DirectionalLight(name)
 
 
@@ -360,7 +359,7 @@ class seLightManager(NodePath):
         elif type == 'point':
         elif type == 'point':
             self.pointCount += 1
             self.pointCount += 1
             if(name=='DEFAULT_NAME'):
             if(name=='DEFAULT_NAME'):
-                light = PointLight('point_' + `self.pointCount`)
+                light = PointLight('point_' + repr(self.pointCount))
             else:
             else:
                 light = PointLight(name)
                 light = PointLight(name)
 
 
@@ -371,7 +370,7 @@ class seLightManager(NodePath):
         elif type == 'spot':
         elif type == 'spot':
             self.spotCount += 1
             self.spotCount += 1
             if(name=='DEFAULT_NAME'):
             if(name=='DEFAULT_NAME'):
-                light = Spotlight('spot_' + `self.spotCount`)
+                light = Spotlight('spot_' + repr(self.spotCount))
             else:
             else:
                 light = Spotlight(name)
                 light = Spotlight(name)
 
 
@@ -382,7 +381,7 @@ class seLightManager(NodePath):
             light.setAttenuation(Vec3(constant, linear, quadratic))
             light.setAttenuation(Vec3(constant, linear, quadratic))
             light.setExponent(exponent)
             light.setExponent(exponent)
         else:
         else:
-            print 'Invalid light type'
+            print('Invalid light type')
             return None
             return None
 
 
         # Create the seLight objects and put the light object we just created into it.
         # Create the seLight objects and put the light object we just created into it.
@@ -411,7 +410,7 @@ class seLightManager(NodePath):
         # Attention!!
         # Attention!!
         # only Spotlight obj nneds to be specified a lens node first. i.e. setLens() first!
         # only Spotlight obj nneds to be specified a lens node first. i.e. setLens() first!
         #################################################################
         #################################################################
-        type = lower(light.getType().getName())
+        type = light.getType().getName().lower()
 
 
         specularColor = VBase4(1)
         specularColor = VBase4(1)
         position = Point3(0,0,0)
         position = Point3(0,0,0)
@@ -451,7 +450,7 @@ class seLightManager(NodePath):
             quadratic = Attenuation.getZ()
             quadratic = Attenuation.getZ()
             exponent = light.getExponent()
             exponent = light.getExponent()
         else:
         else:
-            print 'Invalid light type'
+            print('Invalid light type')
             return None
             return None
 
 
         lightNode = seLight(light,self,type,
         lightNode = seLight(light,self,type,
@@ -508,7 +507,7 @@ class seLightManager(NodePath):
         # isLight(self.name)
         # isLight(self.name)
         # Use a string as a index to check if there existing a light named "name"
         # Use a string as a index to check if there existing a light named "name"
         #################################################################
         #################################################################
-        return self.lightDict.has_key(name)
+        return name in self.lightDict
 
 
     def rename(self,oName,nName):
     def rename(self,oName,nName):
         #################################################################
         #################################################################
@@ -523,7 +522,7 @@ class seLightManager(NodePath):
             del self.lightDict[oName]
             del self.lightDict[oName]
             return self.lightDict.keys(),lightNode
             return self.lightDict.keys(),lightNode
         else:
         else:
-            print '----Light Mnager: No such Light!'
+            print('----Light Mnager: No such Light!')
 
 
     def getLightNodeList(self):
     def getLightNodeList(self):
         #################################################################
         #################################################################

+ 1 - 1
contrib/src/sceneeditor/seManipulation.py

@@ -520,7 +520,7 @@ class ObjectHandles(NodePath,DirectObject):
         # To avoid recreating a vec every frame
         # To avoid recreating a vec every frame
         self.hitPt = Vec3(0)
         self.hitPt = Vec3(0)
         # Get a handle on the components
         # Get a handle on the components
-        self.xHandles = self.find('**/X')
+        self.xHandles = self.find('**/ohScalingNode')
         self.xPostGroup = self.xHandles.find('**/x-post-group')
         self.xPostGroup = self.xHandles.find('**/x-post-group')
         self.xPostCollision = self.xHandles.find('**/x-post')
         self.xPostCollision = self.xHandles.find('**/x-post')
         self.xRingGroup = self.xHandles.find('**/x-ring-group')
         self.xRingGroup = self.xHandles.find('**/x-ring-group')

+ 153 - 146
contrib/src/sceneeditor/seMopathRecorder.py

@@ -25,10 +25,17 @@ from direct.tkwidgets.Slider import Slider
 from direct.tkwidgets.EntryScale import EntryScale
 from direct.tkwidgets.EntryScale import EntryScale
 from direct.tkwidgets.VectorWidgets import Vector2Entry, Vector3Entry
 from direct.tkwidgets.VectorWidgets import Vector2Entry, Vector3Entry
 from direct.tkwidgets.VectorWidgets import ColorEntry
 from direct.tkwidgets.VectorWidgets import ColorEntry
-from Tkinter import Button, Frame, Radiobutton, Checkbutton, Label
-from Tkinter import StringVar, BooleanVar, Entry, Scale
-import os, string, Tkinter, Pmw
-import __builtin__
+import os, string, sys, Pmw
+
+if sys.version_info >= (3, 0):
+    from tkinter import Button, Frame, Radiobutton, Checkbutton, Label
+    from tkinter import StringVar, BooleanVar, Entry, Scale
+    import tkinter
+else:
+    from Tkinter import Button, Frame, Radiobutton, Checkbutton, Label
+    from Tkinter import StringVar, BooleanVar, Entry, Scale
+    import Tkinter as tkinter
+
 
 
 PRF_UTILITIES = [
 PRF_UTILITIES = [
     'lambda: camera.lookAt(render)',
     'lambda: camera.lookAt(render)',
@@ -123,7 +130,7 @@ class MopathRecorder(AppShell, DirectObject):
         self.postPoints = []
         self.postPoints = []
         self.pointSetDict = {}
         self.pointSetDict = {}
         self.pointSetCount = 0
         self.pointSetCount = 0
-        self.pointSetName = self.name + '-ps-' + `self.pointSetCount`
+        self.pointSetName = self.name + '-ps-' + repr(self.pointSetCount)
         # User callback to call before recording point
         # User callback to call before recording point
         self.samplingMode = 'Continuous'
         self.samplingMode = 'Continuous'
         self.preRecordFunc = None
         self.preRecordFunc = None
@@ -233,7 +240,7 @@ class MopathRecorder(AppShell, DirectObject):
             self.undoButton['state'] = 'normal'
             self.undoButton['state'] = 'normal'
         else:
         else:
             self.undoButton['state'] = 'disabled'
             self.undoButton['state'] = 'disabled'
-        self.undoButton.pack(side = Tkinter.LEFT, expand = 0)
+        self.undoButton.pack(side = tkinter.LEFT, expand = 0)
         self.bind(self.undoButton, 'Undo last operation')
         self.bind(self.undoButton, 'Undo last operation')
 
 
         self.redoButton = Button(self.menuFrame, text = 'Redo',
         self.redoButton = Button(self.menuFrame, text = 'Redo',
@@ -242,19 +249,19 @@ class MopathRecorder(AppShell, DirectObject):
             self.redoButton['state'] = 'normal'
             self.redoButton['state'] = 'normal'
         else:
         else:
             self.redoButton['state'] = 'disabled'
             self.redoButton['state'] = 'disabled'
-        self.redoButton.pack(side = Tkinter.LEFT, expand = 0)
+        self.redoButton.pack(side = tkinter.LEFT, expand = 0)
         self.bind(self.redoButton, 'Redo last operation')
         self.bind(self.redoButton, 'Redo last operation')
 
 
         # Record button
         # Record button
-        mainFrame = Frame(interior, relief = Tkinter.SUNKEN, borderwidth = 2)
+        mainFrame = Frame(interior, relief = tkinter.SUNKEN, borderwidth = 2)
         frame = Frame(mainFrame)
         frame = Frame(mainFrame)
         # Active node path
         # Active node path
         # Button to select active node path
         # Button to select active node path
         widget = self.createButton(frame, 'Recording', 'Node Path:',
         widget = self.createButton(frame, 'Recording', 'Node Path:',
                                    'Select Active Mopath Node Path',
                                    'Select Active Mopath Node Path',
                                    lambda s = self: SEditor.select(s.nodePath),
                                    lambda s = self: SEditor.select(s.nodePath),
-                                   side = Tkinter.LEFT, expand = 0)
-        widget['relief'] = Tkinter.FLAT
+                                   side = tkinter.LEFT, expand = 0)
+        widget['relief'] = tkinter.FLAT
         self.nodePathMenu = Pmw.ComboBox(
         self.nodePathMenu = Pmw.ComboBox(
             frame, entry_width = 20,
             frame, entry_width = 20,
             selectioncommand = self.selectNodePathNamed,
             selectioncommand = self.selectNodePathNamed,
@@ -264,7 +271,7 @@ class MopathRecorder(AppShell, DirectObject):
             self.nodePathMenu.component('entryfield_entry'))
             self.nodePathMenu.component('entryfield_entry'))
         self.nodePathMenuBG = (
         self.nodePathMenuBG = (
             self.nodePathMenuEntry.configure('background')[3])
             self.nodePathMenuEntry.configure('background')[3])
-        self.nodePathMenu.pack(side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+        self.nodePathMenu.pack(side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         self.bind(self.nodePathMenu,
         self.bind(self.nodePathMenu,
                   'Select active node path used for recording and playback')
                   'Select active node path used for recording and playback')
         # Recording type
         # Recording type
@@ -285,81 +292,81 @@ class MopathRecorder(AppShell, DirectObject):
             'Recording', 'Extend',
             'Recording', 'Extend',
             ('Next record session extends existing path'),
             ('Next record session extends existing path'),
             self.recordingType, 'Extend', expand = 0)
             self.recordingType, 'Extend', expand = 0)
-        frame.pack(fill = Tkinter.X, expand = 1)
+        frame.pack(fill = tkinter.X, expand = 1)
 
 
         frame = Frame(mainFrame)
         frame = Frame(mainFrame)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Recording', 'Record',
             frame, 'Recording', 'Record',
             'On: path is being recorded', self.toggleRecord, 0,
             'On: path is being recorded', self.toggleRecord, 0,
-            side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 1)
-        widget.configure(foreground = 'Red', relief = Tkinter.RAISED, borderwidth = 2,
-                         anchor = Tkinter.CENTER, width = 16)
+            side = tkinter.LEFT, fill = tkinter.BOTH, expand = 1)
+        widget.configure(foreground = 'Red', relief = tkinter.RAISED, borderwidth = 2,
+                         anchor = tkinter.CENTER, width = 16)
         widget = self.createButton(frame, 'Recording', 'Add Keyframe',
         widget = self.createButton(frame, 'Recording', 'Add Keyframe',
                                    'Add Keyframe To Current Path',
                                    'Add Keyframe To Current Path',
                                    self.addKeyframe,
                                    self.addKeyframe,
-                                   side = Tkinter.LEFT, expand = 1)
+                                   side = tkinter.LEFT, expand = 1)
 
 
         widget = self.createButton(frame, 'Recording', 'Bind Path to Node',
         widget = self.createButton(frame, 'Recording', 'Bind Path to Node',
                                    'Bind Motion Path to selected Object',
                                    'Bind Motion Path to selected Object',
                                    self.bindMotionPathToNode,
                                    self.bindMotionPathToNode,
-                                   side = Tkinter.LEFT, expand = 1)
+                                   side = tkinter.LEFT, expand = 1)
 
 
 
 
-        frame.pack(fill = Tkinter.X, expand = 1)
+        frame.pack(fill = tkinter.X, expand = 1)
 
 
-        mainFrame.pack(expand = 1, fill = Tkinter.X, pady = 3)
+        mainFrame.pack(expand = 1, fill = tkinter.X, pady = 3)
 
 
         # Playback controls
         # Playback controls
-        playbackFrame = Frame(interior, relief = Tkinter.SUNKEN,
+        playbackFrame = Frame(interior, relief = tkinter.SUNKEN,
                               borderwidth = 2)
                               borderwidth = 2)
         Label(playbackFrame, text = 'PLAYBACK CONTROLS',
         Label(playbackFrame, text = 'PLAYBACK CONTROLS',
-              font=('MSSansSerif', 12, 'bold')).pack(fill = Tkinter.X)
+              font=('MSSansSerif', 12, 'bold')).pack(fill = tkinter.X)
         # Main playback control slider
         # Main playback control slider
         widget = self.createEntryScale(
         widget = self.createEntryScale(
             playbackFrame, 'Playback', 'Time', 'Set current playback time',
             playbackFrame, 'Playback', 'Time', 'Set current playback time',
-            resolution = 0.01, command = self.playbackGoTo, side = Tkinter.TOP)
-        widget.component('hull')['relief'] = Tkinter.RIDGE
+            resolution = 0.01, command = self.playbackGoTo, side = tkinter.TOP)
+        widget.component('hull')['relief'] = tkinter.RIDGE
         # Kill playback task if drag slider
         # Kill playback task if drag slider
         widget['preCallback'] = self.stopPlayback
         widget['preCallback'] = self.stopPlayback
         # Jam duration entry into entry scale
         # Jam duration entry into entry scale
         self.createLabeledEntry(widget.labelFrame, 'Resample', 'Path Duration',
         self.createLabeledEntry(widget.labelFrame, 'Resample', 'Path Duration',
                                 'Set total curve duration',
                                 'Set total curve duration',
                                 command = self.setPathDuration,
                                 command = self.setPathDuration,
-                                side = Tkinter.LEFT, expand = 0)
+                                side = tkinter.LEFT, expand = 0)
         # Start stop buttons
         # Start stop buttons
         frame = Frame(playbackFrame)
         frame = Frame(playbackFrame)
         widget = self.createButton(frame, 'Playback', '<<',
         widget = self.createButton(frame, 'Playback', '<<',
                                    'Jump to start of playback',
                                    'Jump to start of playback',
                                    self.jumpToStartOfPlayback,
                                    self.jumpToStartOfPlayback,
-                                   side = Tkinter.LEFT, expand = 1)
+                                   side = tkinter.LEFT, expand = 1)
         widget['font'] = (('MSSansSerif', 12, 'bold'))
         widget['font'] = (('MSSansSerif', 12, 'bold'))
         widget = self.createCheckbutton(frame, 'Playback', 'Play',
         widget = self.createCheckbutton(frame, 'Playback', 'Play',
                                         'Start/Stop playback',
                                         'Start/Stop playback',
                                         self.startStopPlayback, 0,
                                         self.startStopPlayback, 0,
-                                        side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 1)
+                                        side = tkinter.LEFT, fill = tkinter.BOTH, expand = 1)
         widget.configure(anchor = 'center', justify = 'center',
         widget.configure(anchor = 'center', justify = 'center',
-                         relief = Tkinter.RAISED, font = ('MSSansSerif', 12, 'bold'))
+                         relief = tkinter.RAISED, font = ('MSSansSerif', 12, 'bold'))
         widget = self.createButton(frame, 'Playback', '>>',
         widget = self.createButton(frame, 'Playback', '>>',
                                    'Jump to end of playback',
                                    'Jump to end of playback',
                                    self.jumpToEndOfPlayback,
                                    self.jumpToEndOfPlayback,
-                                   side = Tkinter.LEFT, expand = 1)
+                                   side = tkinter.LEFT, expand = 1)
         widget['font'] = (('MSSansSerif', 12, 'bold'))
         widget['font'] = (('MSSansSerif', 12, 'bold'))
         self.createCheckbutton(frame, 'Playback', 'Loop',
         self.createCheckbutton(frame, 'Playback', 'Loop',
                                'On: loop playback',
                                'On: loop playback',
                                self.setLoopPlayback, self.loopPlayback,
                                self.setLoopPlayback, self.loopPlayback,
-                               side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 0)
-        frame.pack(fill = Tkinter.X, expand = 1)
+                               side = tkinter.LEFT, fill = tkinter.BOTH, expand = 0)
+        frame.pack(fill = tkinter.X, expand = 1)
 
 
         # Speed control
         # Speed control
         frame = Frame(playbackFrame)
         frame = Frame(playbackFrame)
-        widget = Button(frame, text = 'PB Speed Vernier', relief = Tkinter.FLAT,
+        widget = Button(frame, text = 'PB Speed Vernier', relief = tkinter.FLAT,
                         command = lambda s = self: s.setSpeedScale(1.0))
                         command = lambda s = self: s.setSpeedScale(1.0))
-        widget.pack(side = Tkinter.LEFT, expand = 0)
+        widget.pack(side = tkinter.LEFT, expand = 0)
         self.speedScale = Scale(frame, from_ = -1, to = 1,
         self.speedScale = Scale(frame, from_ = -1, to = 1,
                                 resolution = 0.01, showvalue = 0,
                                 resolution = 0.01, showvalue = 0,
                                 width = 10, orient = 'horizontal',
                                 width = 10, orient = 'horizontal',
                                 command = self.setPlaybackSF)
                                 command = self.setPlaybackSF)
-        self.speedScale.pack(side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+        self.speedScale.pack(side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         self.speedVar = StringVar()
         self.speedVar = StringVar()
         self.speedVar.set("0.00")
         self.speedVar.set("0.00")
         self.speedEntry = Entry(frame, textvariable = self.speedVar,
         self.speedEntry = Entry(frame, textvariable = self.speedVar,
@@ -368,14 +375,14 @@ class MopathRecorder(AppShell, DirectObject):
             '<Return>',
             '<Return>',
             lambda e = None, s = self: s.setSpeedScale(
             lambda e = None, s = self: s.setSpeedScale(
             string.atof(s.speedVar.get())))
             string.atof(s.speedVar.get())))
-        self.speedEntry.pack(side = Tkinter.LEFT, expand = 0)
-        frame.pack(fill = Tkinter.X, expand = 1)
+        self.speedEntry.pack(side = tkinter.LEFT, expand = 0)
+        frame.pack(fill = tkinter.X, expand = 1)
 
 
-        playbackFrame.pack(fill = Tkinter.X, pady = 2)
+        playbackFrame.pack(fill = tkinter.X, pady = 2)
 
 
         # Create notebook pages
         # Create notebook pages
         self.mainNotebook = Pmw.NoteBook(interior)
         self.mainNotebook = Pmw.NoteBook(interior)
-        self.mainNotebook.pack(fill = Tkinter.BOTH, expand = 1)
+        self.mainNotebook.pack(fill = tkinter.BOTH, expand = 1)
         self.resamplePage = self.mainNotebook.add('Resample')
         self.resamplePage = self.mainNotebook.add('Resample')
         self.refinePage = self.mainNotebook.add('Refine')
         self.refinePage = self.mainNotebook.add('Refine')
         self.extendPage = self.mainNotebook.add('Extend')
         self.extendPage = self.mainNotebook.add('Extend')
@@ -386,35 +393,35 @@ class MopathRecorder(AppShell, DirectObject):
         ## RESAMPLE PAGE
         ## RESAMPLE PAGE
         label = Label(self.resamplePage, text = 'RESAMPLE CURVE',
         label = Label(self.resamplePage, text = 'RESAMPLE CURVE',
                       font=('MSSansSerif', 12, 'bold'))
                       font=('MSSansSerif', 12, 'bold'))
-        label.pack(fill = Tkinter.X)
+        label.pack(fill = tkinter.X)
 
 
         # Resample
         # Resample
         resampleFrame = Frame(
         resampleFrame = Frame(
-            self.resamplePage, relief = Tkinter.SUNKEN, borderwidth = 2)
+            self.resamplePage, relief = tkinter.SUNKEN, borderwidth = 2)
         label = Label(resampleFrame, text = 'RESAMPLE CURVE',
         label = Label(resampleFrame, text = 'RESAMPLE CURVE',
                       font=('MSSansSerif', 12, 'bold')).pack()
                       font=('MSSansSerif', 12, 'bold')).pack()
         widget = self.createSlider(
         widget = self.createSlider(
             resampleFrame, 'Resample', 'Num. Samples',
             resampleFrame, 'Resample', 'Num. Samples',
             'Number of samples in resampled curve',
             'Number of samples in resampled curve',
             resolution = 1, min = 2, max = 1000, command = self.setNumSamples)
             resolution = 1, min = 2, max = 1000, command = self.setNumSamples)
-        widget.component('hull')['relief'] = Tkinter.RIDGE
+        widget.component('hull')['relief'] = tkinter.RIDGE
         widget['postCallback'] = self.sampleCurve
         widget['postCallback'] = self.sampleCurve
 
 
         frame = Frame(resampleFrame)
         frame = Frame(resampleFrame)
         self.createButton(
         self.createButton(
             frame, 'Resample', 'Make Even',
             frame, 'Resample', 'Make Even',
             'Apply timewarp so resulting path has constant velocity',
             'Apply timewarp so resulting path has constant velocity',
-            self.makeEven, side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+            self.makeEven, side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         self.createButton(
         self.createButton(
             frame, 'Resample', 'Face Forward',
             frame, 'Resample', 'Face Forward',
             'Compute HPR so resulting hpr curve faces along xyz tangent',
             'Compute HPR so resulting hpr curve faces along xyz tangent',
-            self.faceForward, side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
-        frame.pack(fill = Tkinter.X, expand = 0)
-        resampleFrame.pack(fill = Tkinter.X, expand = 0, pady = 2)
+            self.faceForward, side = tkinter.LEFT, fill = tkinter.X, expand = 1)
+        frame.pack(fill = tkinter.X, expand = 0)
+        resampleFrame.pack(fill = tkinter.X, expand = 0, pady = 2)
 
 
         # Desample
         # Desample
         desampleFrame = Frame(
         desampleFrame = Frame(
-            self.resamplePage, relief = Tkinter.SUNKEN, borderwidth = 2)
+            self.resamplePage, relief = tkinter.SUNKEN, borderwidth = 2)
         Label(desampleFrame, text = 'DESAMPLE CURVE',
         Label(desampleFrame, text = 'DESAMPLE CURVE',
               font=('MSSansSerif', 12, 'bold')).pack()
               font=('MSSansSerif', 12, 'bold')).pack()
         widget = self.createSlider(
         widget = self.createSlider(
@@ -422,16 +429,16 @@ class MopathRecorder(AppShell, DirectObject):
             'Specify number of points to skip between samples',
             'Specify number of points to skip between samples',
             min = 1, max = 100, resolution = 1,
             min = 1, max = 100, resolution = 1,
             command = self.setDesampleFrequency)
             command = self.setDesampleFrequency)
-        widget.component('hull')['relief'] = Tkinter.RIDGE
+        widget.component('hull')['relief'] = tkinter.RIDGE
         widget['postCallback'] = self.desampleCurve
         widget['postCallback'] = self.desampleCurve
-        desampleFrame.pack(fill = Tkinter.X, expand = 0, pady = 2)
+        desampleFrame.pack(fill = tkinter.X, expand = 0, pady = 2)
 
 
         ## REFINE PAGE ##
         ## REFINE PAGE ##
-        refineFrame = Frame(self.refinePage, relief = Tkinter.SUNKEN,
+        refineFrame = Frame(self.refinePage, relief = tkinter.SUNKEN,
                             borderwidth = 2)
                             borderwidth = 2)
         label = Label(refineFrame, text = 'REFINE CURVE',
         label = Label(refineFrame, text = 'REFINE CURVE',
                       font=('MSSansSerif', 12, 'bold'))
                       font=('MSSansSerif', 12, 'bold'))
-        label.pack(fill = Tkinter.X)
+        label.pack(fill = tkinter.X)
 
 
         widget = self.createSlider(refineFrame,
         widget = self.createSlider(refineFrame,
                                        'Refine Page', 'Refine From',
                                        'Refine Page', 'Refine From',
@@ -460,14 +467,14 @@ class MopathRecorder(AppShell, DirectObject):
                                        command = self.setRefineStop)
                                        command = self.setRefineStop)
         widget['preCallback'] = self.setRefineMode
         widget['preCallback'] = self.setRefineMode
         widget['postCallback'] = self.getPostPoints
         widget['postCallback'] = self.getPostPoints
-        refineFrame.pack(fill = Tkinter.X)
+        refineFrame.pack(fill = tkinter.X)
 
 
         ## EXTEND PAGE ##
         ## EXTEND PAGE ##
-        extendFrame = Frame(self.extendPage, relief = Tkinter.SUNKEN,
+        extendFrame = Frame(self.extendPage, relief = tkinter.SUNKEN,
                             borderwidth = 2)
                             borderwidth = 2)
         label = Label(extendFrame, text = 'EXTEND CURVE',
         label = Label(extendFrame, text = 'EXTEND CURVE',
                       font=('MSSansSerif', 12, 'bold'))
                       font=('MSSansSerif', 12, 'bold'))
-        label.pack(fill = Tkinter.X)
+        label.pack(fill = tkinter.X)
 
 
         widget = self.createSlider(extendFrame,
         widget = self.createSlider(extendFrame,
                                        'Extend Page', 'Extend From',
                                        'Extend Page', 'Extend From',
@@ -483,14 +490,14 @@ class MopathRecorder(AppShell, DirectObject):
             resolution = 0.01,
             resolution = 0.01,
             command = self.setControlStart)
             command = self.setControlStart)
         widget['preCallback'] = self.setExtendMode
         widget['preCallback'] = self.setExtendMode
-        extendFrame.pack(fill = Tkinter.X)
+        extendFrame.pack(fill = tkinter.X)
 
 
         ## CROP PAGE ##
         ## CROP PAGE ##
-        cropFrame = Frame(self.cropPage, relief = Tkinter.SUNKEN,
+        cropFrame = Frame(self.cropPage, relief = tkinter.SUNKEN,
                             borderwidth = 2)
                             borderwidth = 2)
         label = Label(cropFrame, text = 'CROP CURVE',
         label = Label(cropFrame, text = 'CROP CURVE',
                       font=('MSSansSerif', 12, 'bold'))
                       font=('MSSansSerif', 12, 'bold'))
-        label.pack(fill = Tkinter.X)
+        label.pack(fill = tkinter.X)
 
 
         widget = self.createSlider(
         widget = self.createSlider(
             cropFrame,
             cropFrame,
@@ -508,11 +515,11 @@ class MopathRecorder(AppShell, DirectObject):
 
 
         self.createButton(cropFrame, 'Crop Page', 'Crop Curve',
         self.createButton(cropFrame, 'Crop Page', 'Crop Curve',
                           'Crop curve to specified from to times',
                           'Crop curve to specified from to times',
-                          self.cropCurve, fill = Tkinter.NONE)
-        cropFrame.pack(fill = Tkinter.X)
+                          self.cropCurve, fill = tkinter.NONE)
+        cropFrame.pack(fill = tkinter.X)
 
 
         ## DRAW PAGE ##
         ## DRAW PAGE ##
-        drawFrame = Frame(self.drawPage, relief = Tkinter.SUNKEN,
+        drawFrame = Frame(self.drawPage, relief = tkinter.SUNKEN,
                            borderwidth = 2)
                            borderwidth = 2)
 
 
         self.sf = Pmw.ScrolledFrame(self.drawPage, horizflex = 'elastic')
         self.sf = Pmw.ScrolledFrame(self.drawPage, horizflex = 'elastic')
@@ -521,57 +528,57 @@ class MopathRecorder(AppShell, DirectObject):
 
 
         label = Label(sfFrame, text = 'CURVE RENDERING STYLE',
         label = Label(sfFrame, text = 'CURVE RENDERING STYLE',
                       font=('MSSansSerif', 12, 'bold'))
                       font=('MSSansSerif', 12, 'bold'))
-        label.pack(fill = Tkinter.X)
+        label.pack(fill = tkinter.X)
 
 
         frame = Frame(sfFrame)
         frame = Frame(sfFrame)
-        Label(frame, text = 'SHOW:').pack(side = Tkinter.LEFT, expand = 0)
+        Label(frame, text = 'SHOW:').pack(side = tkinter.LEFT, expand = 0)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Style', 'Path',
             frame, 'Style', 'Path',
             'On: path is visible', self.setPathVis, 1,
             'On: path is visible', self.setPathVis, 1,
-            side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+            side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Style', 'Knots',
             frame, 'Style', 'Knots',
             'On: path knots are visible', self.setKnotVis, 1,
             'On: path knots are visible', self.setKnotVis, 1,
-            side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+            side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Style', 'CVs',
             frame, 'Style', 'CVs',
             'On: path CVs are visible', self.setCvVis, 0,
             'On: path CVs are visible', self.setCvVis, 0,
-            side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+            side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Style', 'Hull',
             frame, 'Style', 'Hull',
             'On: path hull is visible', self.setHullVis, 0,
             'On: path hull is visible', self.setHullVis, 0,
-            side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+            side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Style', 'Trace',
             frame, 'Style', 'Trace',
             'On: record is visible', self.setTraceVis, 0,
             'On: record is visible', self.setTraceVis, 0,
-            side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
+            side = tkinter.LEFT, fill = tkinter.X, expand = 1)
         widget = self.createCheckbutton(
         widget = self.createCheckbutton(
             frame, 'Style', 'Marker',
             frame, 'Style', 'Marker',
             'On: playback marker is visible', self.setMarkerVis, 0,
             'On: playback marker is visible', self.setMarkerVis, 0,
-            side = Tkinter.LEFT, fill = Tkinter.X, expand = 1)
-        frame.pack(fill = Tkinter.X, expand = 1)
+            side = tkinter.LEFT, fill = tkinter.X, expand = 1)
+        frame.pack(fill = tkinter.X, expand = 1)
         # Sliders
         # Sliders
         widget = self.createSlider(
         widget = self.createSlider(
             sfFrame, 'Style', 'Num Segs',
             sfFrame, 'Style', 'Num Segs',
             'Set number of segments used to approximate each parametric unit',
             'Set number of segments used to approximate each parametric unit',
             min = 1.0, max = 400, resolution = 1.0,
             min = 1.0, max = 400, resolution = 1.0,
             value = 40,
             value = 40,
-            command = self.setNumSegs, side = Tkinter.TOP)
-        widget.component('hull')['relief'] = Tkinter.RIDGE
+            command = self.setNumSegs, side = tkinter.TOP)
+        widget.component('hull')['relief'] = tkinter.RIDGE
         widget = self.createSlider(
         widget = self.createSlider(
             sfFrame, 'Style', 'Num Ticks',
             sfFrame, 'Style', 'Num Ticks',
             'Set number of tick marks drawn for each unit of time',
             'Set number of tick marks drawn for each unit of time',
             min = 0.0, max = 10.0, resolution = 1.0,
             min = 0.0, max = 10.0, resolution = 1.0,
             value = 0.0,
             value = 0.0,
-            command = self.setNumTicks, side = Tkinter.TOP)
-        widget.component('hull')['relief'] = Tkinter.RIDGE
+            command = self.setNumTicks, side = tkinter.TOP)
+        widget.component('hull')['relief'] = tkinter.RIDGE
         widget = self.createSlider(
         widget = self.createSlider(
             sfFrame, 'Style', 'Tick Scale',
             sfFrame, 'Style', 'Tick Scale',
             'Set visible size of time tick marks',
             'Set visible size of time tick marks',
             min = 0.01, max = 100.0, resolution = 0.01,
             min = 0.01, max = 100.0, resolution = 0.01,
             value = 5.0,
             value = 5.0,
-            command = self.setTickScale, side = Tkinter.TOP)
-        widget.component('hull')['relief'] = Tkinter.RIDGE
+            command = self.setTickScale, side = tkinter.TOP)
+        widget.component('hull')['relief'] = tkinter.RIDGE
         self.createColorEntry(
         self.createColorEntry(
             sfFrame, 'Style', 'Path Color',
             sfFrame, 'Style', 'Path Color',
             'Color of curve',
             'Color of curve',
@@ -598,14 +605,14 @@ class MopathRecorder(AppShell, DirectObject):
             command = self.setHullColor,
             command = self.setHullColor,
             value = [255.0,128.0,128.0,255.0])
             value = [255.0,128.0,128.0,255.0])
 
 
-        #drawFrame.pack(fill = Tkinter.X)
+        #drawFrame.pack(fill = tkinter.X)
 
 
         ## OPTIONS PAGE ##
         ## OPTIONS PAGE ##
-        optionsFrame = Frame(self.optionsPage, relief = Tkinter.SUNKEN,
+        optionsFrame = Frame(self.optionsPage, relief = tkinter.SUNKEN,
                             borderwidth = 2)
                             borderwidth = 2)
         label = Label(optionsFrame, text = 'RECORDING OPTIONS',
         label = Label(optionsFrame, text = 'RECORDING OPTIONS',
                       font=('MSSansSerif', 12, 'bold'))
                       font=('MSSansSerif', 12, 'bold'))
-        label.pack(fill = Tkinter.X)
+        label.pack(fill = tkinter.X)
         # Hooks
         # Hooks
         frame = Frame(optionsFrame)
         frame = Frame(optionsFrame)
         widget = self.createLabeledEntry(
         widget = self.createLabeledEntry(
@@ -614,7 +621,7 @@ class MopathRecorder(AppShell, DirectObject):
             value = self.startStopHook,
             value = self.startStopHook,
             command = self.setStartStopHook)[0]
             command = self.setStartStopHook)[0]
         label = self.getWidget('Recording', 'Record Hook-Label')
         label = self.getWidget('Recording', 'Record Hook-Label')
-        label.configure(width = 16, anchor = Tkinter.W)
+        label.configure(width = 16, anchor = tkinter.W)
         self.setStartStopHook()
         self.setStartStopHook()
         widget = self.createLabeledEntry(
         widget = self.createLabeledEntry(
             frame, 'Recording', 'Keyframe Hook',
             frame, 'Recording', 'Keyframe Hook',
@@ -622,9 +629,9 @@ class MopathRecorder(AppShell, DirectObject):
             value = self.keyframeHook,
             value = self.keyframeHook,
             command = self.setKeyframeHook)[0]
             command = self.setKeyframeHook)[0]
         label = self.getWidget('Recording', 'Keyframe Hook-Label')
         label = self.getWidget('Recording', 'Keyframe Hook-Label')
-        label.configure(width = 16, anchor = Tkinter.W)
+        label.configure(width = 16, anchor = tkinter.W)
         self.setKeyframeHook()
         self.setKeyframeHook()
-        frame.pack(expand = 1, fill = Tkinter.X)
+        frame.pack(expand = 1, fill = tkinter.X)
         # PreRecordFunc
         # PreRecordFunc
         frame = Frame(optionsFrame)
         frame = Frame(optionsFrame)
         widget = self.createComboBox(
         widget = self.createComboBox(
@@ -632,17 +639,17 @@ class MopathRecorder(AppShell, DirectObject):
             'Function called before sampling each point',
             'Function called before sampling each point',
             PRF_UTILITIES, self.setPreRecordFunc,
             PRF_UTILITIES, self.setPreRecordFunc,
             history = 1, expand = 1)
             history = 1, expand = 1)
-        widget.configure(label_width = 16, label_anchor = Tkinter.W)
+        widget.configure(label_width = 16, label_anchor = tkinter.W)
         widget.configure(entryfield_entry_state = 'normal')
         widget.configure(entryfield_entry_state = 'normal')
         # Initialize preRecordFunc
         # Initialize preRecordFunc
         self.preRecordFunc = eval(PRF_UTILITIES[0])
         self.preRecordFunc = eval(PRF_UTILITIES[0])
         self.createCheckbutton(frame, 'Recording', 'PRF Active',
         self.createCheckbutton(frame, 'Recording', 'PRF Active',
                                'On: Pre Record Func enabled',
                                'On: Pre Record Func enabled',
                                None, 0,
                                None, 0,
-                               side = Tkinter.LEFT, fill = Tkinter.BOTH, expand = 0)
-        frame.pack(expand = 1, fill = Tkinter.X)
+                               side = tkinter.LEFT, fill = tkinter.BOTH, expand = 0)
+        frame.pack(expand = 1, fill = tkinter.X)
         # Pack record frame
         # Pack record frame
-        optionsFrame.pack(fill = Tkinter.X, pady = 2)
+        optionsFrame.pack(fill = tkinter.X, pady = 2)
 
 
         self.mainNotebook.setnaturalsize()
         self.mainNotebook.setnaturalsize()
 
 
@@ -682,16 +689,16 @@ class MopathRecorder(AppShell, DirectObject):
         marker if subnode selected
         marker if subnode selected
         """
         """
         taskMgr.remove(self.name + '-curveEditTask')
         taskMgr.remove(self.name + '-curveEditTask')
-        print nodePath.id()
-        if nodePath.id() in self.playbackMarkerIds:
+        print(nodePath.get_key())
+        if nodePath.get_key() in self.playbackMarkerIds:
             SEditor.select(self.playbackMarker)
             SEditor.select(self.playbackMarker)
-        elif nodePath.id() in self.tangentMarkerIds:
+        elif nodePath.get_key() in self.tangentMarkerIds:
             SEditor.select(self.tangentMarker)
             SEditor.select(self.tangentMarker)
-        elif nodePath.id() == self.playbackMarker.id():
+        elif nodePath.get_key() == self.playbackMarker.get_key():
             self.tangentGroup.show()
             self.tangentGroup.show()
             taskMgr.add(self.curveEditTask,
             taskMgr.add(self.curveEditTask,
                                      self.name + '-curveEditTask')
                                      self.name + '-curveEditTask')
-        elif nodePath.id() == self.tangentMarker.id():
+        elif nodePath.get_key() == self.tangentMarker.get_key():
             self.tangentGroup.show()
             self.tangentGroup.show()
             taskMgr.add(self.curveEditTask,
             taskMgr.add(self.curveEditTask,
                                      self.name + '-curveEditTask')
                                      self.name + '-curveEditTask')
@@ -699,7 +706,7 @@ class MopathRecorder(AppShell, DirectObject):
             self.tangentGroup.hide()
             self.tangentGroup.hide()
 
 
     def getChildIds(self, nodePath):
     def getChildIds(self, nodePath):
-        ids = [nodePath.id()]
+        ids = [nodePath.get_key()]
         kids = nodePath.getChildren()
         kids = nodePath.getChildren()
         for kid in kids:
         for kid in kids:
             ids += self.getChildIds(kid)
             ids += self.getChildIds(kid)
@@ -710,14 +717,14 @@ class MopathRecorder(AppShell, DirectObject):
         Hook called upon deselection of a node path used to select playback
         Hook called upon deselection of a node path used to select playback
         marker if subnode selected
         marker if subnode selected
         """
         """
-        if ((nodePath.id() == self.playbackMarker.id()) or
-            (nodePath.id() == self.tangentMarker.id())):
+        if ((nodePath.get_key() == self.playbackMarker.get_key()) or
+            (nodePath.get_key() == self.tangentMarker.get_key())):
             self.tangentGroup.hide()
             self.tangentGroup.hide()
 
 
     def curveEditTask(self,state):
     def curveEditTask(self,state):
         if self.curveCollection != None:
         if self.curveCollection != None:
             # Update curve position
             # Update curve position
-            if self.manipulandumId == self.playbackMarker.id():
+            if self.manipulandumId == self.playbackMarker.get_key():
                 # Show playback marker
                 # Show playback marker
                 self.playbackMarker.getChild(0).show()
                 self.playbackMarker.getChild(0).show()
                 pos = Point3(0)
                 pos = Point3(0)
@@ -731,7 +738,7 @@ class MopathRecorder(AppShell, DirectObject):
                 # Note: this calls recompute on the curves
                 # Note: this calls recompute on the curves
                 self.nurbsCurveDrawer.draw()
                 self.nurbsCurveDrawer.draw()
             # Update tangent
             # Update tangent
-            if self.manipulandumId == self.tangentMarker.id():
+            if self.manipulandumId == self.tangentMarker.get_key():
                 # If manipulating marker, update tangent
                 # If manipulating marker, update tangent
                 # Hide playback marker
                 # Hide playback marker
                 self.playbackMarker.getChild(0).hide()
                 self.playbackMarker.getChild(0).hide()
@@ -766,10 +773,10 @@ class MopathRecorder(AppShell, DirectObject):
     def manipulateObjectStartHook(self):
     def manipulateObjectStartHook(self):
         self.manipulandumId = None
         self.manipulandumId = None
         if SEditor.selected.last:
         if SEditor.selected.last:
-            if SEditor.selected.last.id() == self.playbackMarker.id():
-                self.manipulandumId = self.playbackMarker.id()
-            elif SEditor.selected.last.id() == self.tangentMarker.id():
-                self.manipulandumId = self.tangentMarker.id()
+            if SEditor.selected.last.get_key() == self.playbackMarker.get_key():
+                self.manipulandumId = self.playbackMarker.get_key()
+            elif SEditor.selected.last.get_key() == self.tangentMarker.get_key():
+                self.manipulandumId = self.tangentMarker.get_key()
 
 
     def manipulateObjectCleanupHook(self):
     def manipulateObjectCleanupHook(self):
         # Clear flag
         # Clear flag
@@ -799,7 +806,7 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def createNewPointSet(self, curveName = None):
     def createNewPointSet(self, curveName = None):
         if curveName == None:
         if curveName == None:
-            self.pointSetName = self.name + '-ps-' + `self.pointSetCount`
+            self.pointSetName = self.name + '-ps-' + repr(self.pointSetCount)
         else:
         else:
             self.pointSetName = curveName
             self.pointSetName = curveName
         # Update dictionary and record pointer to new point set
         # Update dictionary and record pointer to new point set
@@ -1137,7 +1144,7 @@ class MopathRecorder(AppShell, DirectObject):
     def computeCurves(self):
     def computeCurves(self):
         # Check to make sure curve fitters have points
         # Check to make sure curve fitters have points
         if (self.curveFitter.getNumSamples() == 0):
         if (self.curveFitter.getNumSamples() == 0):
-            print 'MopathRecorder.computeCurves: Must define curve first'
+            print('MopathRecorder.computeCurves: Must define curve first')
             return
             return
         # Create curves
         # Create curves
         # XYZ
         # XYZ
@@ -1282,8 +1289,8 @@ class MopathRecorder(AppShell, DirectObject):
             dictName = name
             dictName = name
         else:
         else:
             # Generate a unique name for the dict
             # Generate a unique name for the dict
-            dictName = name # + '-' + `nodePath.id()`
-        if not dict.has_key(dictName):
+            dictName = name # + '-' + repr(nodePath.get_key())
+        if dictName not in dict:
             # Update combo box to include new item
             # Update combo box to include new item
             names.append(dictName)
             names.append(dictName)
             listbox = menu.component('scrolledlist')
             listbox = menu.component('scrolledlist')
@@ -1386,7 +1393,7 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def desampleCurve(self):
     def desampleCurve(self):
         if (self.curveFitter.getNumSamples() == 0):
         if (self.curveFitter.getNumSamples() == 0):
-            print 'MopathRecorder.desampleCurve: Must define curve first'
+            print('MopathRecorder.desampleCurve: Must define curve first')
             return
             return
         # NOTE: This is destructive, points will be deleted from curve fitter
         # NOTE: This is destructive, points will be deleted from curve fitter
         self.curveFitter.desample(self.desampleFrequency)
         self.curveFitter.desample(self.desampleFrequency)
@@ -1400,7 +1407,7 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def sampleCurve(self, fCompute = 1, curveName = None):
     def sampleCurve(self, fCompute = 1, curveName = None):
         if self.curveCollection == None:
         if self.curveCollection == None:
-            print 'MopathRecorder.sampleCurve: Must define curve first'
+            print('MopathRecorder.sampleCurve: Must define curve first')
             return
             return
         # Reset curve fitters
         # Reset curve fitters
         self.curveFitter.reset()
         self.curveFitter.reset()
@@ -1617,7 +1624,7 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def cropCurve(self):
     def cropCurve(self):
         if self.pointSet == None:
         if self.pointSet == None:
-            print 'Empty Point Set'
+            print('Empty Point Set')
             return
             return
         # Keep handle on old points
         # Keep handle on old points
         oldPoints = self.pointSet
         oldPoints = self.pointSet
@@ -1653,15 +1660,15 @@ class MopathRecorder(AppShell, DirectObject):
         # Use first directory in model path
         # Use first directory in model path
         mPath = getModelPath()
         mPath = getModelPath()
         if mPath.getNumDirectories() > 0:
         if mPath.getNumDirectories() > 0:
-            if `mPath.getDirectory(0)` == '.':
+            if repr(mPath.getDirectory(0)) == '.':
                 path = '.'
                 path = '.'
             else:
             else:
                 path = mPath.getDirectory(0).toOsSpecific()
                 path = mPath.getDirectory(0).toOsSpecific()
         else:
         else:
             path = '.'
             path = '.'
         if not os.path.isdir(path):
         if not os.path.isdir(path):
-            print 'MopathRecorder Info: Empty Model Path!'
-            print 'Using current directory'
+            print('MopathRecorder Info: Empty Model Path!')
+            print('Using current directory')
             path = '.'
             path = '.'
         mopathFilename = askopenfilename(
         mopathFilename = askopenfilename(
             defaultextension = '.egg',
             defaultextension = '.egg',
@@ -1692,15 +1699,15 @@ class MopathRecorder(AppShell, DirectObject):
         # Use first directory in model path
         # Use first directory in model path
         mPath = getModelPath()
         mPath = getModelPath()
         if mPath.getNumDirectories() > 0:
         if mPath.getNumDirectories() > 0:
-            if `mPath.getDirectory(0)` == '.':
+            if repr(mPath.getDirectory(0)) == '.':
                 path = '.'
                 path = '.'
             else:
             else:
                 path = mPath.getDirectory(0).toOsSpecific()
                 path = mPath.getDirectory(0).toOsSpecific()
         else:
         else:
             path = '.'
             path = '.'
         if not os.path.isdir(path):
         if not os.path.isdir(path):
-            print 'MopathRecorder Info: Empty Model Path!'
-            print 'Using current directory'
+            print('MopathRecorder Info: Empty Model Path!')
+            print('Using current directory')
             path = '.'
             path = '.'
         mopathFilename = asksaveasfilename(
         mopathFilename = asksaveasfilename(
             defaultextension = '.egg',
             defaultextension = '.egg',
@@ -1734,28 +1741,28 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def createLabeledEntry(self, parent, category, text, balloonHelp,
     def createLabeledEntry(self, parent, category, text, balloonHelp,
                            value = '', command = None,
                            value = '', command = None,
-                           relief = 'sunken', side = Tkinter.LEFT,
+                           relief = 'sunken', side = tkinter.LEFT,
                            expand = 1, width = 12):
                            expand = 1, width = 12):
         frame = Frame(parent)
         frame = Frame(parent)
         variable = StringVar()
         variable = StringVar()
         variable.set(value)
         variable.set(value)
         label = Label(frame, text = text)
         label = Label(frame, text = text)
-        label.pack(side = Tkinter.LEFT, fill = Tkinter.X)
+        label.pack(side = tkinter.LEFT, fill = tkinter.X)
         self.bind(label, balloonHelp)
         self.bind(label, balloonHelp)
         self.widgetDict[category + '-' + text + '-Label'] = label
         self.widgetDict[category + '-' + text + '-Label'] = label
         entry = Entry(frame, width = width, relief = relief,
         entry = Entry(frame, width = width, relief = relief,
                       textvariable = variable)
                       textvariable = variable)
-        entry.pack(side = Tkinter.LEFT, fill = Tkinter.X, expand = expand)
+        entry.pack(side = tkinter.LEFT, fill = tkinter.X, expand = expand)
         self.bind(entry, balloonHelp)
         self.bind(entry, balloonHelp)
         self.widgetDict[category + '-' + text] = entry
         self.widgetDict[category + '-' + text] = entry
         self.variableDict[category + '-' + text] = variable
         self.variableDict[category + '-' + text] = variable
         if command:
         if command:
             entry.bind('<Return>', command)
             entry.bind('<Return>', command)
-        frame.pack(side = side, fill = Tkinter.X, expand = expand)
+        frame.pack(side = side, fill = tkinter.X, expand = expand)
         return (frame, label, entry)
         return (frame, label, entry)
 
 
     def createButton(self, parent, category, text, balloonHelp, command,
     def createButton(self, parent, category, text, balloonHelp, command,
-                     side = 'top', expand = 0, fill = Tkinter.X):
+                     side = 'top', expand = 0, fill = tkinter.X):
         widget = Button(parent, text = text)
         widget = Button(parent, text = text)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
@@ -1766,10 +1773,10 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def createCheckbutton(self, parent, category, text,
     def createCheckbutton(self, parent, category, text,
                           balloonHelp, command, initialState,
                           balloonHelp, command, initialState,
-                          side = 'top', fill = Tkinter.X, expand = 0):
+                          side = 'top', fill = tkinter.X, expand = 0):
         bool = BooleanVar()
         bool = BooleanVar()
         bool.set(initialState)
         bool.set(initialState)
-        widget = Checkbutton(parent, text = text, anchor = Tkinter.W,
+        widget = Checkbutton(parent, text = text, anchor = tkinter.W,
                          variable = bool)
                          variable = bool)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
@@ -1781,8 +1788,8 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def createRadiobutton(self, parent, side, category, text,
     def createRadiobutton(self, parent, side, category, text,
                           balloonHelp, variable, value,
                           balloonHelp, variable, value,
-                          command = None, fill = Tkinter.X, expand = 0):
-        widget = Radiobutton(parent, text = text, anchor = Tkinter.W,
+                          command = None, fill = tkinter.X, expand = 0):
+        widget = Radiobutton(parent, text = text, anchor = tkinter.W,
                              variable = variable, value = value)
                              variable = variable, value = value)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
@@ -1798,10 +1805,10 @@ class MopathRecorder(AppShell, DirectObject):
         kw['min'] = min
         kw['min'] = min
         kw['maxVelocity'] = maxVelocity
         kw['maxVelocity'] = maxVelocity
         kw['resolution'] = resolution
         kw['resolution'] = resolution
-        widget = apply(Floater, (parent,), kw)
+        widget = Floater(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
-        widget.pack(fill = Tkinter.X)
+        widget.pack(fill = tkinter.X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         self.widgetDict[category + '-' + text] = widget
         self.widgetDict[category + '-' + text] = widget
         return widget
         return widget
@@ -1809,10 +1816,10 @@ class MopathRecorder(AppShell, DirectObject):
     def createAngleDial(self, parent, category, text, balloonHelp,
     def createAngleDial(self, parent, category, text, balloonHelp,
                         command = None, **kw):
                         command = None, **kw):
         kw['text'] = text
         kw['text'] = text
-        widget = apply(AngleDial,(parent,), kw)
+        widget = AngleDial(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
-        widget.pack(fill = Tkinter.X)
+        widget.pack(fill = tkinter.X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         self.widgetDict[category + '-' + text] = widget
         self.widgetDict[category + '-' + text] = widget
         return widget
         return widget
@@ -1820,13 +1827,13 @@ class MopathRecorder(AppShell, DirectObject):
     def createSlider(self, parent, category, text, balloonHelp,
     def createSlider(self, parent, category, text, balloonHelp,
                          command = None, min = 0.0, max = 1.0,
                          command = None, min = 0.0, max = 1.0,
                          resolution = None,
                          resolution = None,
-                         side = Tkinter.TOP, fill = Tkinter.X, expand = 1, **kw):
+                         side = tkinter.TOP, fill = tkinter.X, expand = 1, **kw):
         kw['text'] = text
         kw['text'] = text
         kw['min'] = min
         kw['min'] = min
         kw['max'] = max
         kw['max'] = max
         kw['resolution'] = resolution
         kw['resolution'] = resolution
         #widget = apply(EntryScale, (parent,), kw)
         #widget = apply(EntryScale, (parent,), kw)
-        widget = apply(Slider, (parent,), kw)
+        widget = Slider(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(side = side, fill = fill, expand = expand)
         widget.pack(side = side, fill = fill, expand = expand)
@@ -1837,12 +1844,12 @@ class MopathRecorder(AppShell, DirectObject):
     def createEntryScale(self, parent, category, text, balloonHelp,
     def createEntryScale(self, parent, category, text, balloonHelp,
                          command = None, min = 0.0, max = 1.0,
                          command = None, min = 0.0, max = 1.0,
                          resolution = None,
                          resolution = None,
-                         side = Tkinter.TOP, fill = Tkinter.X, expand = 1, **kw):
+                         side = tkinter.TOP, fill = tkinter.X, expand = 1, **kw):
         kw['text'] = text
         kw['text'] = text
         kw['min'] = min
         kw['min'] = min
         kw['max'] = max
         kw['max'] = max
         kw['resolution'] = resolution
         kw['resolution'] = resolution
-        widget = apply(EntryScale, (parent,), kw)
+        widget = EntryScale(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(side = side, fill = fill, expand = expand)
         widget.pack(side = side, fill = fill, expand = expand)
@@ -1854,10 +1861,10 @@ class MopathRecorder(AppShell, DirectObject):
                            command = None, **kw):
                            command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
-        widget = apply(Vector2Entry, (parent,), kw)
+        widget = Vector2Entry(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
-        widget.pack(fill = Tkinter.X)
+        widget.pack(fill = tkinter.X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         self.widgetDict[category + '-' + text] = widget
         self.widgetDict[category + '-' + text] = widget
         return widget
         return widget
@@ -1866,10 +1873,10 @@ class MopathRecorder(AppShell, DirectObject):
                            command = None, **kw):
                            command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
-        widget = apply(Vector3Entry, (parent,), kw)
+        widget = Vector3Entry(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
-        widget.pack(fill = Tkinter.X)
+        widget.pack(fill = tkinter.X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         self.widgetDict[category + '-' + text] = widget
         self.widgetDict[category + '-' + text] = widget
         return widget
         return widget
@@ -1878,10 +1885,10 @@ class MopathRecorder(AppShell, DirectObject):
                          command = None, **kw):
                          command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
-        widget = apply(ColorEntry, (parent,) ,kw)
+        widget = ColorEntry(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
-        widget.pack(fill = Tkinter.X)
+        widget.pack(fill = tkinter.X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         self.widgetDict[category + '-' + text] = widget
         self.widgetDict[category + '-' + text] = widget
         return widget
         return widget
@@ -1891,13 +1898,13 @@ class MopathRecorder(AppShell, DirectObject):
         optionVar = StringVar()
         optionVar = StringVar()
         if len(items) > 0:
         if len(items) > 0:
             optionVar.set(items[0])
             optionVar.set(items[0])
-        widget = Pmw.OptionMenu(parent, labelpos = Tkinter.W, label_text = text,
+        widget = Pmw.OptionMenu(parent, labelpos = tkinter.W, label_text = text,
                                 label_width = 12, menu_tearoff = 1,
                                 label_width = 12, menu_tearoff = 1,
                                 menubutton_textvariable = optionVar,
                                 menubutton_textvariable = optionVar,
                                 items = items)
                                 items = items)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
-        widget.pack(fill = Tkinter.X)
+        widget.pack(fill = tkinter.X)
         self.bind(widget.component('menubutton'), balloonHelp)
         self.bind(widget.component('menubutton'), balloonHelp)
         self.widgetDict[category + '-' + text] = widget
         self.widgetDict[category + '-' + text] = widget
         self.variableDict[category + '-' + text] = optionVar
         self.variableDict[category + '-' + text] = optionVar
@@ -1905,9 +1912,9 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def createComboBox(self, parent, category, text, balloonHelp,
     def createComboBox(self, parent, category, text, balloonHelp,
                        items, command, history = 0,
                        items, command, history = 0,
-                       side = Tkinter.LEFT, expand = 0, fill = Tkinter.X):
+                       side = tkinter.LEFT, expand = 0, fill = tkinter.X):
         widget = Pmw.ComboBox(parent,
         widget = Pmw.ComboBox(parent,
-                              labelpos = Tkinter.W,
+                              labelpos = tkinter.W,
                               label_text = text,
                               label_text = text,
                               label_anchor = 'e',
                               label_anchor = 'e',
                               label_width = 12,
                               label_width = 12,
@@ -1959,14 +1966,14 @@ class MopathRecorder(AppShell, DirectObject):
 
 
     def bindMotionPathToNode(self):
     def bindMotionPathToNode(self):
         if self.curveCollection == None:
         if self.curveCollection == None:
-            print '----Error: you need to select or create a curve first!'
+            print('----Error: you need to select or create a curve first!')
             return
             return
         self.accept('MP_checkName', self.bindMotionPath)
         self.accept('MP_checkName', self.bindMotionPath)
         self.askName = namePathPanel(MopathRecorder.count)
         self.askName = namePathPanel(MopathRecorder.count)
         return
         return
 
 
     def bindMotionPath(self,name=None,test=None):
     def bindMotionPath(self,name=None,test=None):
-        print test
+        print(test)
         self.ignore('MP_checkName')
         self.ignore('MP_checkName')
         del self.askName
         del self.askName
         self.curveCollection.getCurve(0).setName(name)
         self.curveCollection.getCurve(0).setName(name)
@@ -1993,7 +2000,7 @@ class MopathRecorder(AppShell, DirectObject):
         If the list is not None, it will put the vurve back into the curve list.
         If the list is not None, it will put the vurve back into the curve list.
         else, do nothing.
         else, do nothing.
         '''
         '''
-        print curveList
+        print(curveList)
         self.ignore('curveListFor'+self.name)
         self.ignore('curveListFor'+self.name)
         if curveList != None:
         if curveList != None:
             for collection in curveList:
             for collection in curveList:
@@ -2037,8 +2044,8 @@ class namePathPanel(AppShell):
 
 
         dataFrame = Frame(mainFrame)
         dataFrame = Frame(mainFrame)
         label = Label(dataFrame, text='This name will be used as a reference for this Path.',font=('MSSansSerif', 10))
         label = Label(dataFrame, text='This name will be used as a reference for this Path.',font=('MSSansSerif', 10))
-        label.pack(side = Tkinter.TOP, expand = 0, fill = Tkinter.X)
-        dataFrame.pack(side = Tkinter.TOP, expand = 0, fill = Tkinter.X, padx=5, pady=10)
+        label.pack(side = tkinter.TOP, expand = 0, fill = tkinter.X)
+        dataFrame.pack(side = tkinter.TOP, expand = 0, fill = tkinter.X, padx=5, pady=10)
 
 
         dataFrame = Frame(mainFrame)
         dataFrame = Frame(mainFrame)
         self.inputZone = Pmw.EntryField(dataFrame, labelpos='w', label_text = 'Name Selected Path: ',
         self.inputZone = Pmw.EntryField(dataFrame, labelpos='w', label_text = 'Name Selected Path: ',
@@ -2046,14 +2053,14 @@ class namePathPanel(AppShell):
                                         label_font=('MSSansSerif', 10),
                                         label_font=('MSSansSerif', 10),
                                         validate = None,
                                         validate = None,
                                         entry_width = 20)
                                         entry_width = 20)
-        self.inputZone.pack(side = Tkinter.LEFT, fill=Tkinter.X,expand=0)
+        self.inputZone.pack(side = tkinter.LEFT, fill=tkinter.X,expand=0)
 
 
         self.button_ok = Button(dataFrame, text="OK", command=self.ok_press,width=10)
         self.button_ok = Button(dataFrame, text="OK", command=self.ok_press,width=10)
-        self.button_ok.pack(fill=Tkinter.X,expand=0,side=Tkinter.LEFT, padx = 3)
+        self.button_ok.pack(fill=tkinter.X,expand=0,side=tkinter.LEFT, padx = 3)
 
 
-        dataFrame.pack(side = Tkinter.TOP, expand = 0, fill = Tkinter.X, padx=10, pady=10)
+        dataFrame.pack(side = tkinter.TOP, expand = 0, fill = tkinter.X, padx=10, pady=10)
 
 
-        mainFrame.pack(expand = 1, fill = Tkinter.BOTH)
+        mainFrame.pack(expand = 1, fill = tkinter.BOTH)
 
 
 
 
 
 

+ 4 - 4
contrib/src/sceneeditor/seParticleEffect.py

@@ -1,4 +1,4 @@
-from pandac.PandaModules import *
+from panda3d.core import *
 import seParticles
 import seParticles
 import seForceGroup
 import seForceGroup
 from direct.directnotify import DirectNotifyGlobal
 from direct.directnotify import DirectNotifyGlobal
@@ -209,9 +209,9 @@ class ParticleEffect(NodePath):
         """loadConfig(filename)"""
         """loadConfig(filename)"""
         #try:
         #try:
         #    if vfs:
         #    if vfs:
-        print vfs.readFile(filename)
-        exec vfs.readFile(filename)
-        print "Particle Effect Reading using VFS"
+        print(vfs.readFile(filename))
+        exec(vfs.readFile(filename))
+        print("Particle Effect Reading using VFS")
         #    else:
         #    else:
         #       execfile(filename.toOsSpecific())
         #       execfile(filename.toOsSpecific())
         #       print "Shouldnt be wrong"
         #       print "Shouldnt be wrong"

+ 29 - 22
contrib/src/sceneeditor/seParticlePanel.py

@@ -2,9 +2,7 @@
 
 
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 from direct.tkwidgets.AppShell import AppShell
 from direct.tkwidgets.AppShell import AppShell
-from tkFileDialog import *
-from tkSimpleDialog import askstring
-import os, Pmw, Tkinter
+import os, Pmw, sys
 from direct.tkwidgets.Dial import AngleDial
 from direct.tkwidgets.Dial import AngleDial
 from direct.tkwidgets.Floater import Floater
 from direct.tkwidgets.Floater import Floater
 from direct.tkwidgets.Slider import Slider
 from direct.tkwidgets.Slider import Slider
@@ -15,6 +13,15 @@ import seForceGroup
 import seParticles
 import seParticles
 import seParticleEffect
 import seParticleEffect
 
 
+
+if sys.version_info >= (3, 0):
+    from tkinter.filedialog import *
+    from tkinter.simpledialog import askstring
+else:
+    from tkFileDialog import *
+    from tkSimpleDialog import askstring
+
+
 class ParticlePanel(AppShell):
 class ParticlePanel(AppShell):
     # Override class variables
     # Override class variables
     appname = 'Particle Panel'
     appname = 'Particle Panel'
@@ -774,7 +781,7 @@ class ParticlePanel(AppShell):
         kw['min'] = min
         kw['min'] = min
         kw['resolution'] = resolution
         kw['resolution'] = resolution
         kw['numDigits'] = numDigits
         kw['numDigits'] = numDigits
-        widget = apply(Floater, (parent,), kw)
+        widget = Floater(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
@@ -786,7 +793,7 @@ class ParticlePanel(AppShell):
                         command = None, **kw):
                         command = None, **kw):
         kw['text'] = text
         kw['text'] = text
         kw['style'] = 'mini'
         kw['style'] = 'mini'
-        widget = apply(AngleDial,(parent,), kw)
+        widget = AngleDial(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
@@ -801,7 +808,7 @@ class ParticlePanel(AppShell):
         kw['min'] = min
         kw['min'] = min
         kw['max'] = max
         kw['max'] = max
         kw['resolution'] = resolution
         kw['resolution'] = resolution
-        widget = apply(Slider, (parent,), kw)
+        widget = Slider(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
@@ -813,7 +820,7 @@ class ParticlePanel(AppShell):
                            command = None, **kw):
                            command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
-        widget = apply(Vector2Entry, (parent,), kw)
+        widget = Vector2Entry(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
@@ -825,7 +832,7 @@ class ParticlePanel(AppShell):
                            command = None, **kw):
                            command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
-        widget = apply(Vector3Entry, (parent,), kw)
+        widget = Vector3Entry(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
@@ -837,7 +844,7 @@ class ParticlePanel(AppShell):
                          command = None, **kw):
                          command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
-        widget = apply(ColorEntry, (parent,) ,kw)
+        widget = ColorEntry(parent, **kw)
         # Do this after the widget so command isn't called on creation
         # Do this after the widget so command isn't called on creation
         widget['command'] = command
         widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
@@ -992,7 +999,7 @@ class ParticlePanel(AppShell):
             self.mainNotebook.selectpage('System')
             self.mainNotebook.selectpage('System')
             self.updateInfo('System')
             self.updateInfo('System')
         else:
         else:
-            print 'ParticlePanel: No effect named ' + name
+            print('ParticlePanel: No effect named ' + name)
 
 
     def toggleEffect(self, effect, var):
     def toggleEffect(self, effect, var):
         if var.get():
         if var.get():
@@ -1041,15 +1048,15 @@ class ParticlePanel(AppShell):
         # Find path to particle directory
         # Find path to particle directory
         pPath = getParticlePath()
         pPath = getParticlePath()
         if pPath.getNumDirectories() > 0:
         if pPath.getNumDirectories() > 0:
-            if `pPath.getDirectory(0)` == '.':
+            if repr(pPath.getDirectory(0)) == '.':
                 path = '.'
                 path = '.'
             else:
             else:
                 path = pPath.getDirectory(0).toOsSpecific()
                 path = pPath.getDirectory(0).toOsSpecific()
         else:
         else:
             path = '.'
             path = '.'
         if not os.path.isdir(path):
         if not os.path.isdir(path):
-            print 'ParticlePanel Warning: Invalid default DNA directory!'
-            print 'Using current directory'
+            print('ParticlePanel Warning: Invalid default DNA directory!')
+            print('Using current directory')
             path = '.'
             path = '.'
         particleFilename = askopenfilename(
         particleFilename = askopenfilename(
             defaultextension = '.ptf',
             defaultextension = '.ptf',
@@ -1070,15 +1077,15 @@ class ParticlePanel(AppShell):
         # Find path to particle directory
         # Find path to particle directory
         pPath = getParticlePath()
         pPath = getParticlePath()
         if pPath.getNumDirectories() > 0:
         if pPath.getNumDirectories() > 0:
-            if `pPath.getDirectory(0)` == '.':
+            if repr(pPath.getDirectory(0)) == '.':
                 path = '.'
                 path = '.'
             else:
             else:
                 path = pPath.getDirectory(0).toOsSpecific()
                 path = pPath.getDirectory(0).toOsSpecific()
         else:
         else:
             path = '.'
             path = '.'
         if not os.path.isdir(path):
         if not os.path.isdir(path):
-            print 'ParticlePanel Warning: Invalid default DNA directory!'
-            print 'Using current directory'
+            print('ParticlePanel Warning: Invalid default DNA directory!')
+            print('Using current directory')
             path = '.'
             path = '.'
         particleFilename = asksaveasfilename(
         particleFilename = asksaveasfilename(
             defaultextension = '.ptf',
             defaultextension = '.ptf',
@@ -1654,7 +1661,7 @@ class ParticlePanel(AppShell):
     def setRendererSpriteNonAnimatedTheta(self, theta):
     def setRendererSpriteNonAnimatedTheta(self, theta):
         self.particles.renderer.setNonanimatedTheta(theta)
         self.particles.renderer.setNonanimatedTheta(theta)
     def setRendererSpriteBlendMethod(self, blendMethod):
     def setRendererSpriteBlendMethod(self, blendMethod):
-        print blendMethod
+        print(blendMethod)
         if blendMethod == 'PP_NO_BLEND':
         if blendMethod == 'PP_NO_BLEND':
             bMethod = BaseParticleRenderer.PPNOBLEND
             bMethod = BaseParticleRenderer.PPNOBLEND
         elif blendMethod == 'PP_BLEND_LINEAR':
         elif blendMethod == 'PP_BLEND_LINEAR':
@@ -1863,7 +1870,7 @@ class ParticlePanel(AppShell):
                                       count, force):
                                       count, force):
         def setVec(vec, f = force):
         def setVec(vec, f = force):
             f.setVector(vec[0], vec[1], vec[2])
             f.setVector(vec[0], vec[1], vec[2])
-        forceName = 'Vector Force-' + `count`
+        forceName = 'Vector Force-' + repr(count)
         frame = self.createForceFrame(forcePage, forceName, force)
         frame = self.createForceFrame(forcePage, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         vec = force.getLocalVector()
         vec = force.getLocalVector()
@@ -1875,7 +1882,7 @@ class ParticlePanel(AppShell):
 
 
     def createLinearRandomForceWidget(self, forcePage, pageName, count,
     def createLinearRandomForceWidget(self, forcePage, pageName, count,
                                 force, type):
                                 force, type):
-        forceName = type + ' Force-' + `count`
+        forceName = type + ' Force-' + repr(count)
         frame = self.createForceFrame(forcePage, forceName, force)
         frame = self.createForceFrame(forcePage, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         self.createForceActiveWidget(frame, pageName, forceName, force)
         self.createForceActiveWidget(frame, pageName, forceName, force)
@@ -1884,7 +1891,7 @@ class ParticlePanel(AppShell):
                                         count, force):
                                         count, force):
         def setCoef(coef, f = force):
         def setCoef(coef, f = force):
             f.setCoef(coef)
             f.setCoef(coef)
-        forceName = 'Friction Force-' + `count`
+        forceName = 'Friction Force-' + repr(count)
         frame = self.createForceFrame(forcePage, forceName, force)
         frame = self.createForceFrame(forcePage, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         self.createFloater(frame, pageName, forceName + ' Coef',
         self.createFloater(frame, pageName, forceName + ' Coef',
@@ -1895,7 +1902,7 @@ class ParticlePanel(AppShell):
 
 
     def createLinearCylinderVortexForceWidget(self, forcePage, pageName,
     def createLinearCylinderVortexForceWidget(self, forcePage, pageName,
                                               count, force):
                                               count, force):
-        forceName = 'Vortex Force-' + `count`
+        forceName = 'Vortex Force-' + repr(count)
         def setCoef(coef, f = force):
         def setCoef(coef, f = force):
             f.setCoef(coef)
             f.setCoef(coef)
         def setLength(length, f = force):
         def setLength(length, f = force):
@@ -1934,7 +1941,7 @@ class ParticlePanel(AppShell):
             f.setForceCenter(Point3(vec[0], vec[1], vec[2]))
             f.setForceCenter(Point3(vec[0], vec[1], vec[2]))
         def setRadius(radius, f = force):
         def setRadius(radius, f = force):
             f.setRadius(radius)
             f.setRadius(radius)
-        forceName = type + ' Force-' + `count`
+        forceName = type + ' Force-' + repr(count)
         frame = self.createForceFrame(forcePage, forceName, force)
         frame = self.createForceFrame(forcePage, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         self.createLinearForceWidgets(frame, pageName, forceName, force)
         var = self.createOptionMenu(
         var = self.createOptionMenu(

+ 5 - 25
contrib/src/sceneeditor/seParticles.py

@@ -1,28 +1,8 @@
-from pandac.PandaModules import *
+from panda3d.core import *
+from panda3d.physics import *
 from direct.particles.ParticleManagerGlobal import *
 from direct.particles.ParticleManagerGlobal import *
 from direct.showbase.PhysicsManagerGlobal import *
 from direct.showbase.PhysicsManagerGlobal import *
-#Manakel 2/12/2005: replace from pandac import by from pandac.PandaModules import
-from pandac.PandaModules import ParticleSystem
-from pandac.PandaModules import BaseParticleFactory
-from pandac.PandaModules import PointParticleFactory
-from pandac.PandaModules import ZSpinParticleFactory
 #import OrientedParticleFactory
 #import OrientedParticleFactory
-from pandac.PandaModules import BaseParticleRenderer
-from pandac.PandaModules import PointParticleRenderer
-from pandac.PandaModules import LineParticleRenderer
-from pandac.PandaModules import GeomParticleRenderer
-from pandac.PandaModules import SparkleParticleRenderer
-from pandac.PandaModules import SpriteParticleRenderer
-from pandac.PandaModules import BaseParticleEmitter
-from pandac.PandaModules import BoxEmitter
-from pandac.PandaModules import DiscEmitter
-from pandac.PandaModules import LineEmitter
-from pandac.PandaModules import PointEmitter
-from pandac.PandaModules import RectangleEmitter
-from pandac.PandaModules import RingEmitter
-from pandac.PandaModules import SphereSurfaceEmitter
-from pandac.PandaModules import SphereVolumeEmitter
-from pandac.PandaModules import TangentRingEmitter
 import string
 import string
 import os
 import os
 from direct.directnotify import DirectNotifyGlobal
 from direct.directnotify import DirectNotifyGlobal
@@ -113,7 +93,7 @@ class Particles(ParticleSystem):
         elif (type == "OrientedParticleFactory"):
         elif (type == "OrientedParticleFactory"):
             self.factory = OrientedParticleFactory.OrientedParticleFactory()
             self.factory = OrientedParticleFactory.OrientedParticleFactory()
         else:
         else:
-            print "unknown factory type: %s" % type
+            print("unknown factory type: %s" % type)
             return None
             return None
         self.factory.setLifespanBase(0.5)
         self.factory.setLifespanBase(0.5)
         ParticleSystem.ParticleSystem.setFactory(self, self.factory)
         ParticleSystem.ParticleSystem.setFactory(self, self.factory)
@@ -152,7 +132,7 @@ class Particles(ParticleSystem):
                 # See sourceFileName and sourceNodeName in SpriteParticleRenderer-extensions.py
                 # See sourceFileName and sourceNodeName in SpriteParticleRenderer-extensions.py
                 self.renderer.setTextureFromNode()
                 self.renderer.setTextureFromNode()
         else:
         else:
-            print "unknown renderer type: %s" % type
+            print("unknown renderer type: %s" % type)
             return None
             return None
         ParticleSystem.ParticleSystem.setRenderer(self, self.renderer)
         ParticleSystem.ParticleSystem.setRenderer(self, self.renderer)
 
 
@@ -183,7 +163,7 @@ class Particles(ParticleSystem):
         elif (type == "TangentRingEmitter"):
         elif (type == "TangentRingEmitter"):
             self.emitter = TangentRingEmitter.TangentRingEmitter()
             self.emitter = TangentRingEmitter.TangentRingEmitter()
         else:
         else:
-            print "unknown emitter type: %s" % type
+            print("unknown emitter type: %s" % type)
             return None
             return None
         ParticleSystem.ParticleSystem.setEmitter(self, self.emitter)
         ParticleSystem.ParticleSystem.setEmitter(self, self.emitter)
 
 

+ 34 - 27
contrib/src/sceneeditor/sePlacer.py

@@ -5,9 +5,16 @@ from direct.directtools.DirectGlobals import *
 from direct.tkwidgets.AppShell import AppShell
 from direct.tkwidgets.AppShell import AppShell
 from direct.tkwidgets.Dial import AngleDial
 from direct.tkwidgets.Dial import AngleDial
 from direct.tkwidgets.Floater import Floater
 from direct.tkwidgets.Floater import Floater
-from Tkinter import Button, Menubutton, Menu, StringVar
-from pandac.PandaModules import *
-import Tkinter, Pmw
+from panda3d.core import *
+import sys, Pmw
+
+if sys.version_info >= (3, 0):
+    from tkinter import Button, Menubutton, Menu, StringVar
+    import tkinter
+else:
+    from Tkinter import Button, Menubutton, Menu, StringVar
+    import Tkinter as tkinter
+
 """
 """
 TODO:
 TODO:
 Task to monitor pose
 Task to monitor pose
@@ -84,7 +91,7 @@ class Placer(AppShell):
     def createInterface(self):
     def createInterface(self):
         # The interior of the toplevel panel
         # The interior of the toplevel panel
         interior = self.interior()
         interior = self.interior()
-        interior['relief'] = Tkinter.FLAT
+        interior['relief'] = tkinter.FLAT
         # Add placer commands to menubar
         # Add placer commands to menubar
         self.menuBar.addmenu('Placer', 'Placer Panel Operations')
         self.menuBar.addmenu('Placer', 'Placer Panel Operations')
         self.menuBar.addmenuitem('Placer', 'command',
         self.menuBar.addmenuitem('Placer', 'command',
@@ -113,7 +120,7 @@ class Placer(AppShell):
         # Get a handle to the menu frame
         # Get a handle to the menu frame
         menuFrame = self.menuFrame
         menuFrame = self.menuFrame
         self.nodePathMenu = Pmw.ComboBox(
         self.nodePathMenu = Pmw.ComboBox(
-            menuFrame, labelpos = Tkinter.W, label_text = 'Node Path:',
+            menuFrame, labelpos = tkinter.W, label_text = 'Node Path:',
             entry_width = 20,
             entry_width = 20,
             selectioncommand = self.selectNodePathNamed,
             selectioncommand = self.selectNodePathNamed,
             scrolledlist_items = self.nodePathNames)
             scrolledlist_items = self.nodePathNames)
@@ -168,7 +175,7 @@ class Placer(AppShell):
                              tag_text = 'Position',
                              tag_text = 'Position',
                              tag_font=('MSSansSerif', 14),
                              tag_font=('MSSansSerif', 14),
                              tag_activebackground = '#909090',
                              tag_activebackground = '#909090',
-                             ring_relief = Tkinter.RIDGE)
+                             ring_relief = tkinter.RIDGE)
         posMenubutton = posGroup.component('tag')
         posMenubutton = posGroup.component('tag')
         self.bind(posMenubutton, 'Position menu operations')
         self.bind(posMenubutton, 'Position menu operations')
         posMenu = Menu(posMenubutton, tearoff = 0)
         posMenu = Menu(posMenubutton, tearoff = 0)
@@ -182,7 +189,7 @@ class Placer(AppShell):
         # Create the dials
         # Create the dials
         self.posX = self.createcomponent('posX', (), None,
         self.posX = self.createcomponent('posX', (), None,
                                          Floater, (posInterior,),
                                          Floater, (posInterior,),
-                                         text = 'X', relief = Tkinter.FLAT,
+                                         text = 'X', relief = tkinter.FLAT,
                                          value = 0.0,
                                          value = 0.0,
                                          label_foreground = 'Red')
                                          label_foreground = 'Red')
         self.posX['commandData'] = ['x']
         self.posX['commandData'] = ['x']
@@ -193,7 +200,7 @@ class Placer(AppShell):
 
 
         self.posY = self.createcomponent('posY', (), None,
         self.posY = self.createcomponent('posY', (), None,
                                          Floater, (posInterior,),
                                          Floater, (posInterior,),
-                                         text = 'Y', relief = Tkinter.FLAT,
+                                         text = 'Y', relief = tkinter.FLAT,
                                          value = 0.0,
                                          value = 0.0,
                                          label_foreground = '#00A000')
                                          label_foreground = '#00A000')
         self.posY['commandData'] = ['y']
         self.posY['commandData'] = ['y']
@@ -204,7 +211,7 @@ class Placer(AppShell):
 
 
         self.posZ = self.createcomponent('posZ', (), None,
         self.posZ = self.createcomponent('posZ', (), None,
                                          Floater, (posInterior,),
                                          Floater, (posInterior,),
-                                         text = 'Z', relief = Tkinter.FLAT,
+                                         text = 'Z', relief = tkinter.FLAT,
                                          value = 0.0,
                                          value = 0.0,
                                          label_foreground = 'Blue')
                                          label_foreground = 'Blue')
         self.posZ['commandData'] = ['z']
         self.posZ['commandData'] = ['z']
@@ -219,7 +226,7 @@ class Placer(AppShell):
                              tag_text = 'Orientation',
                              tag_text = 'Orientation',
                              tag_font=('MSSansSerif', 14),
                              tag_font=('MSSansSerif', 14),
                              tag_activebackground = '#909090',
                              tag_activebackground = '#909090',
-                             ring_relief = Tkinter.RIDGE)
+                             ring_relief = tkinter.RIDGE)
         hprMenubutton = hprGroup.component('tag')
         hprMenubutton = hprGroup.component('tag')
         self.bind(hprMenubutton, 'Orientation menu operations')
         self.bind(hprMenubutton, 'Orientation menu operations')
         hprMenu = Menu(hprMenubutton, tearoff = 0)
         hprMenu = Menu(hprMenubutton, tearoff = 0)
@@ -234,7 +241,7 @@ class Placer(AppShell):
                                          AngleDial, (hprInterior,),
                                          AngleDial, (hprInterior,),
                                          style = 'mini',
                                          style = 'mini',
                                          text = 'H', value = 0.0,
                                          text = 'H', value = 0.0,
-                                         relief = Tkinter.FLAT,
+                                         relief = tkinter.FLAT,
                                          label_foreground = 'blue')
                                          label_foreground = 'blue')
         self.hprH['commandData'] = ['h']
         self.hprH['commandData'] = ['h']
         self.hprH['preCallback'] = self.xformStart
         self.hprH['preCallback'] = self.xformStart
@@ -246,7 +253,7 @@ class Placer(AppShell):
                                          AngleDial, (hprInterior,),
                                          AngleDial, (hprInterior,),
                                          style = 'mini',
                                          style = 'mini',
                                          text = 'P', value = 0.0,
                                          text = 'P', value = 0.0,
-                                         relief = Tkinter.FLAT,
+                                         relief = tkinter.FLAT,
                                          label_foreground = 'red')
                                          label_foreground = 'red')
         self.hprP['commandData'] = ['p']
         self.hprP['commandData'] = ['p']
         self.hprP['preCallback'] = self.xformStart
         self.hprP['preCallback'] = self.xformStart
@@ -258,7 +265,7 @@ class Placer(AppShell):
                                          AngleDial, (hprInterior,),
                                          AngleDial, (hprInterior,),
                                          style = 'mini',
                                          style = 'mini',
                                          text = 'R', value = 0.0,
                                          text = 'R', value = 0.0,
-                                         relief = Tkinter.FLAT,
+                                         relief = tkinter.FLAT,
                                          label_foreground = '#00A000')
                                          label_foreground = '#00A000')
         self.hprR['commandData'] = ['r']
         self.hprR['commandData'] = ['r']
         self.hprR['preCallback'] = self.xformStart
         self.hprR['preCallback'] = self.xformStart
@@ -276,7 +283,7 @@ class Placer(AppShell):
                                tag_pyclass = Menubutton,
                                tag_pyclass = Menubutton,
                                tag_font=('MSSansSerif', 14),
                                tag_font=('MSSansSerif', 14),
                                tag_activebackground = '#909090',
                                tag_activebackground = '#909090',
-                               ring_relief = Tkinter.RIDGE)
+                               ring_relief = tkinter.RIDGE)
         self.scaleMenubutton = scaleGroup.component('tag')
         self.scaleMenubutton = scaleGroup.component('tag')
         self.bind(self.scaleMenubutton, 'Scale menu operations')
         self.bind(self.scaleMenubutton, 'Scale menu operations')
         self.scaleMenubutton['textvariable'] = self.scalingMode
         self.scaleMenubutton['textvariable'] = self.scalingMode
@@ -302,7 +309,7 @@ class Placer(AppShell):
         self.scaleX = self.createcomponent('scaleX', (), None,
         self.scaleX = self.createcomponent('scaleX', (), None,
                                            Floater, (scaleInterior,),
                                            Floater, (scaleInterior,),
                                            text = 'X Scale',
                                            text = 'X Scale',
-                                           relief = Tkinter.FLAT,
+                                           relief = tkinter.FLAT,
                                            min = 0.0001, value = 1.0,
                                            min = 0.0001, value = 1.0,
                                            resetValue = 1.0,
                                            resetValue = 1.0,
                                            label_foreground = 'Red')
                                            label_foreground = 'Red')
@@ -315,7 +322,7 @@ class Placer(AppShell):
         self.scaleY = self.createcomponent('scaleY', (), None,
         self.scaleY = self.createcomponent('scaleY', (), None,
                                            Floater, (scaleInterior,),
                                            Floater, (scaleInterior,),
                                            text = 'Y Scale',
                                            text = 'Y Scale',
-                                           relief = Tkinter.FLAT,
+                                           relief = tkinter.FLAT,
                                            min = 0.0001, value = 1.0,
                                            min = 0.0001, value = 1.0,
                                            resetValue = 1.0,
                                            resetValue = 1.0,
                                            label_foreground = '#00A000')
                                            label_foreground = '#00A000')
@@ -328,7 +335,7 @@ class Placer(AppShell):
         self.scaleZ = self.createcomponent('scaleZ', (), None,
         self.scaleZ = self.createcomponent('scaleZ', (), None,
                                            Floater, (scaleInterior,),
                                            Floater, (scaleInterior,),
                                            text = 'Z Scale',
                                            text = 'Z Scale',
-                                           relief = Tkinter.FLAT,
+                                           relief = tkinter.FLAT,
                                            min = 0.0001, value = 1.0,
                                            min = 0.0001, value = 1.0,
                                            resetValue = 1.0,
                                            resetValue = 1.0,
                                            label_foreground = 'Blue')
                                            label_foreground = 'Blue')
@@ -428,7 +435,7 @@ class Placer(AppShell):
                 background = self.nodePathMenuBG)
                 background = self.nodePathMenuBG)
             # Check to see if node path and ref node path are the same
             # Check to see if node path and ref node path are the same
             if ((self.refCS != None) and
             if ((self.refCS != None) and
-                (self.refCS.id() == self['nodePath'].id())):
+                (self.refCS.get_key() == self['nodePath'].get_key())):
                 # Yes they are, use temp CS as ref
                 # Yes they are, use temp CS as ref
                 # This calls updatePlacer
                 # This calls updatePlacer
                 self.setReferenceNodePath(self.tempCS)
                 self.setReferenceNodePath(self.tempCS)
@@ -473,7 +480,7 @@ class Placer(AppShell):
                     listbox = self.refNodePathMenu.component('scrolledlist')
                     listbox = self.refNodePathMenu.component('scrolledlist')
                     listbox.setlist(self.refNodePathNames)
                     listbox.setlist(self.refNodePathNames)
         # Check to see if node path and ref node path are the same
         # Check to see if node path and ref node path are the same
-        if (nodePath != None) and (nodePath.id() == self['nodePath'].id()):
+        if (nodePath != None) and (nodePath.get_key() == self['nodePath'].get_key()):
             # Yes they are, use temp CS and update listbox accordingly
             # Yes they are, use temp CS and update listbox accordingly
             nodePath = self.tempCS
             nodePath = self.tempCS
             self.refNodePathMenu.selectitem('parent')
             self.refNodePathMenu.selectitem('parent')
@@ -508,8 +515,8 @@ class Placer(AppShell):
             dictName = name
             dictName = name
         else:
         else:
             # Generate a unique name for the dict
             # Generate a unique name for the dict
-            dictName = name + '-' + `nodePath.id()`
-        if not dict.has_key(dictName):
+            dictName = name + '-' + repr(nodePath.get_key())
+        if dictName not in dict:
             # Update combo box to include new item
             # Update combo box to include new item
             names.append(dictName)
             names.append(dictName)
             listbox = menu.component('scrolledlist')
             listbox = menu.component('scrolledlist')
@@ -769,12 +776,12 @@ class Placer(AppShell):
             posString = '%.2f, %.2f, %.2f' % (pos[0], pos[1], pos[2])
             posString = '%.2f, %.2f, %.2f' % (pos[0], pos[1], pos[2])
             hprString = '%.2f, %.2f, %.2f' % (hpr[0], hpr[1], hpr[2])
             hprString = '%.2f, %.2f, %.2f' % (hpr[0], hpr[1], hpr[2])
             scaleString = '%.2f, %.2f, %.2f' % (scale[0], scale[1], scale[2])
             scaleString = '%.2f, %.2f, %.2f' % (scale[0], scale[1], scale[2])
-            print 'NodePath: %s' % name
-            print 'Pos: %s' % posString
-            print 'Hpr: %s' % hprString
-            print 'Scale: %s' % scaleString
-            print ('%s.setPosHprScale(%s, %s, %s)' %
-                   (name, posString, hprString, scaleString))
+            print('NodePath: %s' % name)
+            print('Pos: %s' % posString)
+            print('Hpr: %s' % hprString)
+            print('Scale: %s' % scaleString)
+            print(('%s.setPosHprScale(%s, %s, %s)' %
+                   (name, posString, hprString, scaleString)))
 
 
     def onDestroy(self, event):
     def onDestroy(self, event):
         # Remove hooks
         # Remove hooks

+ 16 - 9
contrib/src/sceneeditor/seSceneGraphExplorer.py

@@ -9,9 +9,16 @@
 #
 #
 #################################################################
 #################################################################
 from direct.showbase.DirectObject import DirectObject
 from direct.showbase.DirectObject import DirectObject
-from Tkinter import IntVar, Frame, Label
 from seTree import TreeNode, TreeItem
 from seTree import TreeNode, TreeItem
-import Pmw, Tkinter
+
+import Pmw, sys
+
+if sys.version_info >= (3, 0):
+    from tkinter import IntVar, Frame, Label
+    import tkinter
+else:
+    from Tkinter import IntVar, Frame, Label
+    import Tkinter as tkinter
 
 
 # changing these strings requires changing sceneEditor.py SGE_ strs too!
 # changing these strings requires changing sceneEditor.py SGE_ strs too!
 # This list of items will be showed on the pop out window when user right click on
 # This list of items will be showed on the pop out window when user right click on
@@ -57,7 +64,7 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
 
 
         # Setup up container
         # Setup up container
         interior = self.interior()
         interior = self.interior()
-        interior.configure(relief = Tkinter.GROOVE, borderwidth = 2)
+        interior.configure(relief = tkinter.GROOVE, borderwidth = 2)
 
 
         # Create a label and an entry
         # Create a label and an entry
         self._scrolledCanvas = self.createcomponent(
         self._scrolledCanvas = self.createcomponent(
@@ -69,7 +76,7 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
         self._canvas = self._scrolledCanvas.component('canvas')
         self._canvas = self._scrolledCanvas.component('canvas')
         self._canvas['scrollregion'] = ('0i', '0i', '2i', '4i')
         self._canvas['scrollregion'] = ('0i', '0i', '2i', '4i')
         self._scrolledCanvas.resizescrollregion()
         self._scrolledCanvas.resizescrollregion()
-        self._scrolledCanvas.pack(padx = 3, pady = 3, expand=1, fill = Tkinter.BOTH)
+        self._scrolledCanvas.pack(padx = 3, pady = 3, expand=1, fill = tkinter.BOTH)
 
 
         self._canvas.bind('<ButtonPress-2>', self.mouse2Down)
         self._canvas.bind('<ButtonPress-2>', self.mouse2Down)
         self._canvas.bind('<B2-Motion>', self.mouse2Motion)
         self._canvas.bind('<B2-Motion>', self.mouse2Motion)
@@ -91,8 +98,8 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
             (), None,
             (), None,
             Label, (interior,),
             Label, (interior,),
             text = 'Active Reparent Target: ',
             text = 'Active Reparent Target: ',
-            anchor = Tkinter.W, justify = Tkinter.LEFT)
-        self._label.pack(fill = Tkinter.X)
+            anchor = tkinter.W, justify = tkinter.LEFT)
+        self._label.pack(fill = tkinter.X)
 
 
         # Add update parent label
         # Add update parent label
         def updateLabel(nodePath = None, s = self):
         def updateLabel(nodePath = None, s = self):
@@ -141,11 +148,11 @@ class seSceneGraphExplorer(Pmw.MegaWidget, DirectObject):
         self._node.deselecttree()
         self._node.deselecttree()
 
 
     def selectNodePath(self,nodePath, callBack=True):
     def selectNodePath(self,nodePath, callBack=True):
-        item = self._node.find(nodePath.id())
+        item = self._node.find(nodePath.get_key())
         if item!= None:
         if item!= None:
             item.select(callBack)
             item.select(callBack)
         else:
         else:
-            print '----SGE: Error Selection'
+            print('----SGE: Error Selection')
 
 
 class SceneGraphExplorerItem(TreeItem):
 class SceneGraphExplorerItem(TreeItem):
 
 
@@ -164,7 +171,7 @@ class SceneGraphExplorerItem(TreeItem):
         return name
         return name
 
 
     def GetKey(self):
     def GetKey(self):
-        return self.nodePath.id()
+        return self.nodePath.get_key()
 
 
     def IsEditable(self):
     def IsEditable(self):
         # All nodes' names can be edited nowadays.
         # All nodes' names can be edited nowadays.

+ 20 - 11
contrib/src/sceneeditor/seSelection.py

@@ -11,7 +11,7 @@
 # (If we do change original directools, it will force user has to install the latest version of OUR Panda)
 # (If we do change original directools, it will force user has to install the latest version of OUR Panda)
 #
 #
 #################################################################
 #################################################################
-from pandac.PandaModules import GeomNode
+from panda3d.core import GeomNode
 from direct.directtools.DirectGlobals import *
 from direct.directtools.DirectGlobals import *
 from direct.directtools.DirectUtil import *
 from direct.directtools.DirectUtil import *
 from seGeometry import *
 from seGeometry import *
@@ -70,7 +70,7 @@ class SelectedNodePaths(DirectObject):
         """ Select the specified node path.  Multiselect as required """
         """ Select the specified node path.  Multiselect as required """
         # Do nothing if nothing selected
         # Do nothing if nothing selected
         if not nodePath:
         if not nodePath:
-            print 'Nothing selected!!'
+            print('Nothing selected!!')
             return None
             return None
 
 
         # Reset selected objects and highlight if multiSelect is false
         # Reset selected objects and highlight if multiSelect is false
@@ -78,7 +78,7 @@ class SelectedNodePaths(DirectObject):
             self.deselectAll()
             self.deselectAll()
 
 
         # Get this pointer
         # Get this pointer
-        id = nodePath.id()
+        id = nodePath.get_key()
         # First see if its already in the selected dictionary
         # First see if its already in the selected dictionary
         dnp = self.getSelectedDict(id)
         dnp = self.getSelectedDict(id)
         # If so, we're done
         # If so, we're done
@@ -96,7 +96,7 @@ class SelectedNodePaths(DirectObject):
                 # Show its bounding box
                 # Show its bounding box
                 dnp.highlight()
                 dnp.highlight()
             # Add it to the selected dictionary
             # Add it to the selected dictionary
-            self.selectedDict[dnp.id()] = dnp
+            self.selectedDict[dnp.get_key()] = dnp
         # And update last
         # And update last
         __builtins__["last"] = self.last = dnp
         __builtins__["last"] = self.last = dnp
         return dnp
         return dnp
@@ -104,7 +104,7 @@ class SelectedNodePaths(DirectObject):
     def deselect(self, nodePath):
     def deselect(self, nodePath):
         """ Deselect the specified node path """
         """ Deselect the specified node path """
         # Get this pointer
         # Get this pointer
-        id = nodePath.id()
+        id = nodePath.get_key()
         # See if it is in the selected dictionary
         # See if it is in the selected dictionary
         dnp = self.getSelectedDict(id)
         dnp = self.getSelectedDict(id)
         if dnp:
         if dnp:
@@ -124,7 +124,7 @@ class SelectedNodePaths(DirectObject):
         Return a list of all selected node paths.  No verification of
         Return a list of all selected node paths.  No verification of
         connectivity is performed on the members of the list
         connectivity is performed on the members of the list
         """
         """
-        return self.selectedDict.values()[:]
+        return list(self.selectedDict.values())
 
 
     def __getitem__(self,index):
     def __getitem__(self,index):
         return self.getSelectedAsList()[index]
         return self.getSelectedAsList()[index]
@@ -141,7 +141,7 @@ class SelectedNodePaths(DirectObject):
             return None
             return None
 
 
     def getDeselectedAsList(self):
     def getDeselectedAsList(self):
-        return self.deselectedDict.values()[:]
+        return list(self.deselectedDict.values())
 
 
     def getDeselectedDict(self, id):
     def getDeselectedDict(self, id):
         """
         """
@@ -204,15 +204,24 @@ class SelectedNodePaths(DirectObject):
         # Remove all selected nodePaths from the Scene Graph
         # Remove all selected nodePaths from the Scene Graph
         self.forEachSelectedNodePathDo(NodePath.remove)
         self.forEachSelectedNodePathDo(NodePath.remove)
 
 
+    def toggleVis(self, nodePath):
+        if nodePath.is_hidden():
+            nodePath.show()
+        else:
+            nodePath.hide()
+
     def toggleVisSelected(self):
     def toggleVisSelected(self):
         selected = self.last
         selected = self.last
         # Toggle visibility of selected node paths
         # Toggle visibility of selected node paths
         if selected:
         if selected:
-            selected.toggleVis()
+            if selected.is_hidden():
+                selected.show()
+            else:
+                selected.hide()
 
 
     def toggleVisAll(self):
     def toggleVisAll(self):
         # Toggle viz for all selected node paths
         # Toggle viz for all selected node paths
-        self.forEachSelectedNodePathDo(NodePath.toggleVis)
+        self.forEachSelectedNodePathDo(self.toggleVis)
 
 
     def isolateSelected(self):
     def isolateSelected(self):
         selected = self.last
         selected = self.last
@@ -221,7 +230,7 @@ class SelectedNodePaths(DirectObject):
 
 
     def getDirectNodePath(self, nodePath):
     def getDirectNodePath(self, nodePath):
         # Get this pointer
         # Get this pointer
-        id = nodePath.id()
+        id = nodePath.get_key()
         # First check selected dict
         # First check selected dict
         dnp = self.getSelectedDict(id)
         dnp = self.getSelectedDict(id)
         if dnp:
         if dnp:
@@ -376,7 +385,7 @@ class DirectBoundingBox:
         return '%.2f %.2f %.2f' % (vec[0], vec[1], vec[2])
         return '%.2f %.2f %.2f' % (vec[0], vec[1], vec[2])
 
 
     def __repr__(self):
     def __repr__(self):
-        return (`self.__class__` +
+        return (repr(self.__class__) +
                 '\nNodePath:\t%s\n' % self.nodePath.getName() +
                 '\nNodePath:\t%s\n' % self.nodePath.getName() +
                 'Min:\t\t%s\n' % self.vecAsString(self.min) +
                 'Min:\t\t%s\n' % self.vecAsString(self.min) +
                 'Max:\t\t%s\n' % self.vecAsString(self.max) +
                 'Max:\t\t%s\n' % self.vecAsString(self.max) +

+ 9 - 6
contrib/src/sceneeditor/seSession.py

@@ -388,7 +388,7 @@ class SeSession(DirectObject):  ### Customized DirectSession
             messenger.send('DIRECT_preSelectNodePath', [dnp])
             messenger.send('DIRECT_preSelectNodePath', [dnp])
             if fResetAncestry:
             if fResetAncestry:
                 # Update ancestry
                 # Update ancestry
-                self.ancestry = dnp.getAncestors()
+                self.ancestry = list(dnp.getAncestors())
                 self.ancestry.reverse()
                 self.ancestry.reverse()
                 self.ancestryIndex = 0
                 self.ancestryIndex = 0
             # Update the selectedNPReadout
             # Update the selectedNPReadout
@@ -479,8 +479,8 @@ class SeSession(DirectObject):  ### Customized DirectSession
 
 
 
 
     def isNotCycle(self, nodePath, parent):
     def isNotCycle(self, nodePath, parent):
-        if nodePath.id() == parent.id():
-            print 'DIRECT.reparent: Invalid parent'
+        if nodePath.get_key() == parent.get_key():
+            print('DIRECT.reparent: Invalid parent')
             return 0
             return 0
         elif parent.hasParent():
         elif parent.hasParent():
             return self.isNotCycle(nodePath, parent.getParent())
             return self.isNotCycle(nodePath, parent.getParent())
@@ -520,7 +520,10 @@ class SeSession(DirectObject):  ### Customized DirectSession
             nodePath = self.selected.last
             nodePath = self.selected.last
         if nodePath:
         if nodePath:
             # Now toggle node path's visibility state
             # Now toggle node path's visibility state
-            nodePath.toggleVis()
+            if nodePath.is_hidden():
+                nodePath.show()
+            else:
+                nodePath.hide()
 
 
     def removeNodePath(self, nodePath = 'None Given'):
     def removeNodePath(self, nodePath = 'None Given'):
         if nodePath == 'None Given':
         if nodePath == 'None Given':
@@ -732,8 +735,8 @@ class SeSession(DirectObject):  ### Customized DirectSession
         hprB = base.camera.getHpr()
         hprB = base.camera.getHpr()
         posE = Point3((radius*-1.41)+center.getX(), (radius*-1.41)+center.getY(), (radius*1.41)+center.getZ())
         posE = Point3((radius*-1.41)+center.getX(), (radius*-1.41)+center.getY(), (radius*1.41)+center.getZ())
         hprE = Point3(-45, -38, 0)
         hprE = Point3(-45, -38, 0)
-        print posB, hprB
-        print posE, hprE
+        print(posB, hprB)
+        print(posE, hprE)
         posInterval1 = base.camera.posInterval(time, posE, bakeInStart = 1)
         posInterval1 = base.camera.posInterval(time, posE, bakeInStart = 1)
         posInterval2 = base.camera.posInterval(time, posB, bakeInStart = 1)
         posInterval2 = base.camera.posInterval(time, posB, bakeInStart = 1)
 
 

+ 15 - 9
contrib/src/sceneeditor/seTree.py

@@ -12,15 +12,21 @@
 #
 #
 #################################################################
 #################################################################
 
 
-import os, sys, string, Pmw, Tkinter
+import os, sys, string, Pmw
 from direct.showbase.DirectObject import DirectObject
 from direct.showbase.DirectObject import DirectObject
-from Tkinter import IntVar, Menu, PhotoImage, Label, Frame, Entry
-from pandac.PandaModules import *
+from panda3d.core import *
+
+if sys.version_info >= (3, 0):
+    import tkinter
+    from tkinter import IntVar, Menu, PhotoImage, Label, Frame, Entry
+else:
+    import Tkinter as tkinter
+    from Tkinter import IntVar, Menu, PhotoImage, Label, Frame, Entry
 
 
 # Initialize icon directory
 # Initialize icon directory
 ICONDIR = getModelPath().findFile(Filename('icons')).toOsSpecific()
 ICONDIR = getModelPath().findFile(Filename('icons')).toOsSpecific()
 if not os.path.isdir(ICONDIR):
 if not os.path.isdir(ICONDIR):
-    raise RuntimeError, "can't find DIRECT icon directory (%s)" % `ICONDIR`
+    raise RuntimeError("can't find DIRECT icon directory (%r)" % ICONDIR)
 
 
 class TreeNode:
 class TreeNode:
 
 
@@ -187,9 +193,9 @@ class TreeNode:
             oldcursor = self.canvas['cursor']
             oldcursor = self.canvas['cursor']
             self.canvas['cursor'] = "watch"
             self.canvas['cursor'] = "watch"
             self.canvas.update()
             self.canvas.update()
-            self.canvas.delete(Tkinter.ALL)     # XXX could be more subtle
+            self.canvas.delete(tkinter.ALL)     # XXX could be more subtle
             self.draw(7, 2)
             self.draw(7, 2)
-            x0, y0, x1, y1 = self.canvas.bbox(Tkinter.ALL)
+            x0, y0, x1, y1 = self.canvas.bbox(tkinter.ALL)
             self.canvas.configure(scrollregion=(0, 0, x1, y1))
             self.canvas.configure(scrollregion=(0, 0, x1, y1))
             self.canvas['cursor'] = oldcursor
             self.canvas['cursor'] = oldcursor
 
 
@@ -208,7 +214,7 @@ class TreeNode:
         self.kidKeys = []
         self.kidKeys = []
         for item in sublist:
         for item in sublist:
             key = item.GetKey()
             key = item.GetKey()
-            if self.children.has_key(key):
+            if key in self.children:
                 child = self.children[key]
                 child = self.children[key]
             else:
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
                 child = TreeNode(self.canvas, self, item, self.menuList)
@@ -309,7 +315,7 @@ class TreeNode:
     def edit(self, event=None):
     def edit(self, event=None):
         self.entry = Entry(self.label, bd=0, highlightthickness=1, width=0)
         self.entry = Entry(self.label, bd=0, highlightthickness=1, width=0)
         self.entry.insert(0, self.label['text'])
         self.entry.insert(0, self.label['text'])
-        self.entry.selection_range(0, Tkinter.END)
+        self.entry.selection_range(0, tkinter.END)
         self.entry.pack(ipadx=5)
         self.entry.pack(ipadx=5)
         self.entry.focus_set()
         self.entry.focus_set()
         self.entry.bind("<Return>", self.edit_finish)
         self.entry.bind("<Return>", self.edit_finish)
@@ -344,7 +350,7 @@ class TreeNode:
         for item in sublist:
         for item in sublist:
             key = item.GetKey()
             key = item.GetKey()
             # Use existing child or create new TreeNode if none exists
             # Use existing child or create new TreeNode if none exists
-            if self.children.has_key(key):
+            if key in self.children:
                 child = self.children[key]
                 child = self.children[key]
             else:
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
                 child = TreeNode(self.canvas, self, item, self.menuList)

+ 0 - 12
direct/src/actor/Actor.py

@@ -653,15 +653,11 @@ class Actor(DirectObject, NodePath):
         """
         """
         # make sure we don't call this twice in a row
         # make sure we don't call this twice in a row
         # and pollute the the switches dictionary
         # and pollute the the switches dictionary
-##         sortedKeys = list(self.switches.keys())
-##         sortedKeys.sort()
         child = self.__LODNode.find(str(lodName))
         child = self.__LODNode.find(str(lodName))
         index = self.__LODNode.node().findChild(child.node())
         index = self.__LODNode.node().findChild(child.node())
         self.__LODNode.node().forceSwitch(index)
         self.__LODNode.node().forceSwitch(index)
 
 
     def printLOD(self):
     def printLOD(self):
-##         sortedKeys = list(self.switches.keys())
-##         sortedKeys.sort()
         sortedKeys = self.__sortedLODNames
         sortedKeys = self.__sortedLODNames
         for eachLod in sortedKeys:
         for eachLod in sortedKeys:
             print("python switches for %s: in: %d, out %d" % (eachLod,
             print("python switches for %s: in: %d, out %d" % (eachLod,
@@ -679,12 +675,6 @@ class Actor(DirectObject, NodePath):
         """
         """
         Restore all switch distance info (usually after a useLOD call)"""
         Restore all switch distance info (usually after a useLOD call)"""
         self.__LODNode.node().clearForceSwitch()
         self.__LODNode.node().clearForceSwitch()
-##         sortedKeys = list(self.switches.keys())
-##         sortedKeys.sort()
-##         for eachLod in sortedKeys:
-##             index = sortedKeys.index(eachLod)
-##             self.__LODNode.node().setSwitch(index, self.switches[eachLod][0],
-##                                      self.switches[eachLod][1])
 
 
     def addLOD(self, lodName, inDist=0, outDist=0, center=None):
     def addLOD(self, lodName, inDist=0, outDist=0, center=None):
         """addLOD(self, string)
         """addLOD(self, string)
@@ -706,8 +696,6 @@ class Actor(DirectObject, NodePath):
         # save the switch distance info
         # save the switch distance info
         self.switches[lodName] = [inDist, outDist]
         self.switches[lodName] = [inDist, outDist]
         # add the switch distance info
         # add the switch distance info
-##         sortedKeys = list(self.switches.keys())
-##         sortedKeys.sort()
         self.__LODNode.node().setSwitch(self.getLODIndex(lodName), inDist, outDist)
         self.__LODNode.node().setSwitch(self.getLODIndex(lodName), inDist, outDist)
 
 
     def getLODIndex(self, lodName):
     def getLODIndex(self, lodName):

+ 0 - 9
direct/src/configfiles/direct.init

@@ -1,9 +0,0 @@
-ATTACH dmodels
-ATTACH panda
-MODREL ETC_PATH etc
-DOCSH set parent=`dirname $DIRECT`
-DOCSH if ( ${?PANDA_ROOT} ) then
-DOCSH   setenv PYTHONPATH "${PYTHONPATH};"`cygpath -w "$parent"`
-DOCSH else
-DOCSH   setenv PYTHONPATH "${PYTHONPATH}:$parent"
-DOCSH endif

+ 5 - 2
direct/src/dcparse/dcparse.cxx

@@ -19,6 +19,9 @@
 #include "indent.h"
 #include "indent.h"
 #include "panda_getopt.h"
 #include "panda_getopt.h"
 
 
+using std::cerr;
+using std::cout;
+
 void
 void
 usage() {
 usage() {
   cerr <<
   cerr <<
@@ -103,8 +106,8 @@ write_complete_field_list(const DCFile &file) {
         cout << field->get_class()->get_name() << "::";
         cout << field->get_class()->get_name() << "::";
       }
       }
       cout << field->get_name();
       cout << field->get_name();
-      if (field->as_atomic_field() != (DCAtomicField *)NULL ||
-          field->as_molecular_field() != (DCMolecularField *)NULL) {
+      if (field->as_atomic_field() != nullptr ||
+          field->as_molecular_field() != nullptr) {
         // It's a "method".
         // It's a "method".
         cout << "()";
         cout << "()";
       }
       }

+ 81 - 7
direct/src/dcparser/dcArrayParameter.cxx

@@ -16,6 +16,8 @@
 #include "dcClassParameter.h"
 #include "dcClassParameter.h"
 #include "hashGenerator.h"
 #include "hashGenerator.h"
 
 
+using std::string;
+
 /**
 /**
  *
  *
  */
  */
@@ -58,7 +60,7 @@ DCArrayParameter(DCParameter *element_type, const DCUnsignedIntRange &size) :
   _pack_type = PT_array;
   _pack_type = PT_array;
 
 
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type != (DCSimpleParameter *)NULL) {
+  if (simple_type != nullptr) {
     if (simple_type->get_type() == ST_char) {
     if (simple_type->get_type() == ST_char) {
       // We make a special case for char[] arrays: these we format as a
       // We make a special case for char[] arrays: these we format as a
       // string.  (It will still accept an array of ints packed into it.)  We
       // string.  (It will still accept an array of ints packed into it.)  We
@@ -148,7 +150,7 @@ get_array_size() const {
  */
  */
 DCParameter *DCArrayParameter::
 DCParameter *DCArrayParameter::
 append_array_specification(const DCUnsignedIntRange &size) {
 append_array_specification(const DCUnsignedIntRange &size) {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     // If this was a typedef, wrap it directly.
     // If this was a typedef, wrap it directly.
     return new DCArrayParameter(this, size);
     return new DCArrayParameter(this, size);
   }
   }
@@ -201,13 +203,13 @@ validate_num_nested_fields(int num_nested_fields) const {
  * identifier.
  * identifier.
  */
  */
 void DCArrayParameter::
 void DCArrayParameter::
-output_instance(ostream &out, bool brief, const string &prename,
+output_instance(std::ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
-    ostringstream strm;
+    std::ostringstream strm;
 
 
     strm << "[";
     strm << "[";
     _array_size_range.output(strm);
     _array_size_range.output(strm);
@@ -236,7 +238,7 @@ pack_string(DCPackData &pack_data, const string &value,
             bool &pack_error, bool &range_error) const {
             bool &pack_error, bool &range_error) const {
   // We can only pack a string if the array element type is char or int8.
   // We can only pack a string if the array element type is char or int8.
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type == (DCSimpleParameter *)NULL) {
+  if (simple_type == nullptr) {
     pack_error = true;
     pack_error = true;
     return;
     return;
   }
   }
@@ -260,6 +262,38 @@ pack_string(DCPackData &pack_data, const string &value,
   }
   }
 }
 }
 
 
+/**
+ * Packs the indicated numeric or string value into the stream.
+ */
+void DCArrayParameter::
+pack_blob(DCPackData &pack_data, const vector_uchar &value,
+          bool &pack_error, bool &range_error) const {
+  // We can only pack a string if the array element type is char or int8.
+  DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
+  if (simple_type == nullptr) {
+    pack_error = true;
+    return;
+  }
+
+  size_t blob_size = value.size();
+
+  switch (simple_type->get_type()) {
+  case ST_char:
+  case ST_uint8:
+  case ST_int8:
+    _array_size_range.validate(blob_size, range_error);
+    if (_num_length_bytes != 0) {
+      nassertv(_num_length_bytes == 2);
+      do_pack_uint16(pack_data.get_write_pointer(2), blob_size);
+    }
+    pack_data.append_data((const char *)value.data(), blob_size);
+    break;
+
+  default:
+    pack_error = true;
+  }
+}
+
 /**
 /**
  * Packs the arrayParameter's specified default value (or a sensible default
  * Packs the arrayParameter's specified default value (or a sensible default
  * if no value is specified) into the stream.  Returns true if the default
  * if no value is specified) into the stream.  Returns true if the default
@@ -306,7 +340,7 @@ unpack_string(const char *data, size_t length, size_t &p, string &value,
               bool &pack_error, bool &range_error) const {
               bool &pack_error, bool &range_error) const {
   // We can only unpack a string if the array element type is char or int8.
   // We can only unpack a string if the array element type is char or int8.
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type == (DCSimpleParameter *)NULL) {
+  if (simple_type == nullptr) {
     pack_error = true;
     pack_error = true;
     return;
     return;
   }
   }
@@ -337,6 +371,46 @@ unpack_string(const char *data, size_t length, size_t &p, string &value,
   }
   }
 }
 }
 
 
+/**
+ * Unpacks the current numeric or string value from the stream.
+ */
+void DCArrayParameter::
+unpack_blob(const char *data, size_t length, size_t &p, vector_uchar &value,
+            bool &pack_error, bool &range_error) const {
+  // We can only unpack a string if the array element type is char or int8.
+  DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
+  if (simple_type == nullptr) {
+    pack_error = true;
+    return;
+  }
+
+  size_t blob_size;
+
+  switch (simple_type->get_type()) {
+  case ST_char:
+  case ST_uint8:
+  case ST_int8:
+    if (_num_length_bytes != 0) {
+      blob_size = do_unpack_uint16(data + p);
+      p += 2;
+    } else {
+      nassertv(_array_size >= 0);
+      blob_size = _array_size;
+    }
+    if (p + blob_size > length) {
+      pack_error = true;
+      return;
+    }
+    value = vector_uchar((const unsigned char *)data + p,
+                         (const unsigned char *)data + p + blob_size);
+    p += blob_size;
+    break;
+
+  default:
+    pack_error = true;
+  }
+}
+
 /**
 /**
  * Returns true if the other interface is bitwise the same as this one--that
  * Returns true if the other interface is bitwise the same as this one--that
  * is, a uint32 only matches a uint32, etc.  Names of components, and range
  * is, a uint32 only matches a uint32, etc.  Names of components, and range

+ 9 - 5
direct/src/dcparser/dcArrayParameter.h

@@ -23,7 +23,7 @@
  * parameter type accepts an arbitrary (or possibly fixed) number of nested
  * parameter type accepts an arbitrary (or possibly fixed) number of nested
  * fields, all of which are of the same type.
  * fields, all of which are of the same type.
  */
  */
-class DCArrayParameter : public DCParameter {
+class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
 public:
 public:
   DCArrayParameter(DCParameter *element_type,
   DCArrayParameter(DCParameter *element_type,
                    const DCUnsignedIntRange &size = DCUnsignedIntRange());
                    const DCUnsignedIntRange &size = DCUnsignedIntRange());
@@ -46,14 +46,18 @@ public:
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual bool validate_num_nested_fields(int num_nested_fields) const;
   virtual bool validate_num_nested_fields(int num_nested_fields) const;
 
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
-  virtual void pack_string(DCPackData &pack_data, const string &value,
+  virtual void pack_string(DCPackData &pack_data, const std::string &value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
+  virtual void pack_blob(DCPackData &pack_data, const vector_uchar &value,
+                         bool &pack_error, bool &range_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual void unpack_string(const char *data, size_t length, size_t &p,
   virtual void unpack_string(const char *data, size_t length, size_t &p,
-                             string &value, bool &pack_error, bool &range_error) const;
+                             std::string &value, bool &pack_error, bool &range_error) const;
+  virtual void unpack_blob(const char *data, size_t length, size_t &p,
+                           vector_uchar &value, bool &pack_error, bool &range_error) const;
 
 
 protected:
 protected:
   virtual bool do_check_match(const DCPackerInterface *other) const;
   virtual bool do_check_match(const DCPackerInterface *other) const;

+ 14 - 12
direct/src/dcparser/dcAtomicField.cxx

@@ -19,6 +19,8 @@
 
 
 #include <math.h>
 #include <math.h>
 
 
+using std::string;
+
 /**
 /**
  *
  *
  */
  */
@@ -73,7 +75,7 @@ get_num_elements() const {
  */
  */
 DCParameter *DCAtomicField::
 DCParameter *DCAtomicField::
 get_element(int n) const {
 get_element(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), NULL);
+  nassertr(n >= 0 && n < (int)_elements.size(), nullptr);
   return _elements[n];
   return _elements[n];
 }
 }
 
 
@@ -86,11 +88,11 @@ get_element(int n) const {
  * If the element is an array-type element, the returned value will include
  * If the element is an array-type element, the returned value will include
  * the two-byte length preceding the array data.
  * the two-byte length preceding the array data.
  *
  *
- * This is deprecated; use get_element() instead.
+ * @deprecated use get_element() instead.
  */
  */
-string DCAtomicField::
+vector_uchar DCAtomicField::
 get_element_default(int n) const {
 get_element_default(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), string());
+  nassertr(n >= 0 && n < (int)_elements.size(), vector_uchar());
   return _elements[n]->get_default_value();
   return _elements[n]->get_default_value();
 }
 }
 
 
@@ -98,7 +100,7 @@ get_element_default(int n) const {
  * Returns true if the nth element of the field has a default value specified,
  * Returns true if the nth element of the field has a default value specified,
  * false otherwise.
  * false otherwise.
  *
  *
- * This is deprecated; use get_element() instead.
+ * @deprecated use get_element() instead.
  */
  */
 bool DCAtomicField::
 bool DCAtomicField::
 has_element_default(int n) const {
 has_element_default(int n) const {
@@ -111,7 +113,7 @@ has_element_default(int n) const {
  * for documentary purposes; it does not generally affect operation.  If a
  * for documentary purposes; it does not generally affect operation.  If a
  * name is not specified, this will be the empty string.
  * name is not specified, this will be the empty string.
  *
  *
- * This method is deprecated; use get_element()->get_name() instead.
+ * @deprecated use get_element()->get_name() instead.
  */
  */
 string DCAtomicField::
 string DCAtomicField::
 get_element_name(int n) const {
 get_element_name(int n) const {
@@ -127,7 +129,7 @@ DCSubatomicType DCAtomicField::
 get_element_type(int n) const {
 get_element_type(int n) const {
   nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid);
   nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid);
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
-  nassertr(simple_parameter != (DCSimpleParameter *)NULL, ST_invalid);
+  nassertr(simple_parameter != nullptr, ST_invalid);
   return simple_parameter->get_type();
   return simple_parameter->get_type();
 }
 }
 
 
@@ -143,7 +145,7 @@ int DCAtomicField::
 get_element_divisor(int n) const {
 get_element_divisor(int n) const {
   nassertr(n >= 0 && n < (int)_elements.size(), 1);
   nassertr(n >= 0 && n < (int)_elements.size(), 1);
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
-  nassertr(simple_parameter != (DCSimpleParameter *)NULL, 1);
+  nassertr(simple_parameter != nullptr, 1);
   return simple_parameter->get_divisor();
   return simple_parameter->get_divisor();
 }
 }
 
 
@@ -151,7 +153,7 @@ get_element_divisor(int n) const {
  *
  *
  */
  */
 void DCAtomicField::
 void DCAtomicField::
-output(ostream &out, bool brief) const {
+output(std::ostream &out, bool brief) const {
   out << _name << "(";
   out << _name << "(";
 
 
   if (!_elements.empty()) {
   if (!_elements.empty()) {
@@ -174,7 +176,7 @@ output(ostream &out, bool brief) const {
  * stream.
  * stream.
  */
  */
 void DCAtomicField::
 void DCAtomicField::
-write(ostream &out, bool brief, int indent_level) const {
+write(std::ostream &out, bool brief, int indent_level) const {
   indent(out, indent_level);
   indent(out, indent_level);
   output(out, brief);
   output(out, brief);
   out << ";";
   out << ";";
@@ -207,7 +209,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 DCPackerInterface *DCAtomicField::
 DCPackerInterface *DCAtomicField::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), NULL);
+  nassertr(n >= 0 && n < (int)_elements.size(), nullptr);
   return _elements[n];
   return _elements[n];
 }
 }
 
 
@@ -270,7 +272,7 @@ do_check_match_atomic_field(const DCAtomicField *other) const {
  *
  *
  */
  */
 void DCAtomicField::
 void DCAtomicField::
-output_element(ostream &out, bool brief, DCParameter *element) const {
+output_element(std::ostream &out, bool brief, DCParameter *element) const {
   element->output(out, brief);
   element->output(out, brief);
 
 
   if (!brief && element->has_default_value()) {
   if (!brief && element->has_default_value()) {

+ 7 - 7
direct/src/dcparser/dcAtomicField.h

@@ -27,9 +27,9 @@
  * This defines an interface to the Distributed Class, and is always
  * This defines an interface to the Distributed Class, and is always
  * implemented as a remote procedure method.
  * implemented as a remote procedure method.
  */
  */
-class DCAtomicField : public DCField {
+class EXPCL_DIRECT_DCPARSER DCAtomicField : public DCField {
 public:
 public:
-  DCAtomicField(const string &name, DCClass *dclass, bool bogus_field);
+  DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field);
   virtual ~DCAtomicField();
   virtual ~DCAtomicField();
 
 
 PUBLISHED:
 PUBLISHED:
@@ -40,17 +40,17 @@ PUBLISHED:
   DCParameter *get_element(int n) const;
   DCParameter *get_element(int n) const;
 
 
   // These five methods are deprecated and will be removed soon.
   // These five methods are deprecated and will be removed soon.
-  string get_element_default(int n) const;
+  vector_uchar get_element_default(int n) const;
   bool has_element_default(int n) const;
   bool has_element_default(int n) const;
-  string get_element_name(int n) const;
+  std::string get_element_name(int n) const;
   DCSubatomicType get_element_type(int n) const;
   DCSubatomicType get_element_type(int n) const;
   int get_element_divisor(int n) const;
   int get_element_divisor(int n) const;
 
 
 public:
 public:
   void add_element(DCParameter *element);
   void add_element(DCParameter *element);
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;
@@ -60,7 +60,7 @@ protected:
   virtual bool do_check_match_atomic_field(const DCAtomicField *other) const;
   virtual bool do_check_match_atomic_field(const DCAtomicField *other) const;
 
 
 private:
 private:
-  void output_element(ostream &out, bool brief, DCParameter *element) const;
+  void output_element(std::ostream &out, bool brief, DCParameter *element) const;
 
 
   typedef pvector<DCParameter *> Elements;
   typedef pvector<DCParameter *> Elements;
   Elements _elements;
   Elements _elements;

+ 1 - 1
direct/src/dcparser/dcClass.I

@@ -22,7 +22,7 @@ get_dc_file() const {
 /**
 /**
  * Returns the name of this class.
  * Returns the name of this class.
  */
  */
-INLINE const string &DCClass::
+INLINE const std::string &DCClass::
 get_name() const {
 get_name() const {
   return _name;
   return _name;
 }
 }

+ 61 - 50
direct/src/dcparser/dcClass.cxx

@@ -25,6 +25,10 @@
 #include "py_panda.h"
 #include "py_panda.h"
 #endif
 #endif
 
 
+using std::ostream;
+using std::ostringstream;
+using std::string;
+
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
 #include "pStatTimer.h"
 #include "pStatTimer.h"
 
 
@@ -80,11 +84,11 @@ DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
   _bogus_class(bogus_class)
   _bogus_class(bogus_class)
 {
 {
   _number = -1;
   _number = -1;
-  _constructor = NULL;
+  _constructor = nullptr;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  _class_def = NULL;
-  _owner_class_def = NULL;
+  _class_def = nullptr;
+  _owner_class_def = nullptr;
 #endif
 #endif
 }
 }
 
 
@@ -93,7 +97,7 @@ DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
  */
  */
 DCClass::
 DCClass::
 ~DCClass() {
 ~DCClass() {
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     delete _constructor;
     delete _constructor;
   }
   }
 
 
@@ -137,7 +141,7 @@ get_num_parents() const {
  */
  */
 DCClass *DCClass::
 DCClass *DCClass::
 get_parent(int n) const {
 get_parent(int n) const {
-  nassertr(n >= 0 && n < (int)_parents.size(), NULL);
+  nassertr(n >= 0 && n < (int)_parents.size(), nullptr);
   return _parents[n];
   return _parents[n];
 }
 }
 
 
@@ -147,7 +151,7 @@ get_parent(int n) const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_constructor() const {
 has_constructor() const {
-  return (_constructor != (DCField *)NULL);
+  return (_constructor != nullptr);
 }
 }
 
 
 /**
 /**
@@ -177,13 +181,13 @@ DCField *DCClass::
 get_field(int n) const {
 get_field(int n) const {
   #ifndef NDEBUG //[
   #ifndef NDEBUG //[
   if (n < 0 || n >= (int)_fields.size()) {
   if (n < 0 || n >= (int)_fields.size()) {
-    cerr << *this << " "
+    std::cerr << *this << " "
          << "n:" << n << " _fields.size():"
          << "n:" << n << " _fields.size():"
-         << (int)_fields.size() << endl;
+         << (int)_fields.size() << std::endl;
     // __asm { int 3 }
     // __asm { int 3 }
   }
   }
   #endif //]
   #endif //]
-  nassertr_always(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr_always(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 
@@ -205,13 +209,13 @@ get_field_by_name(const string &name) const {
   Parents::const_iterator pi;
   Parents::const_iterator pi;
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
     DCField *result = (*pi)->get_field_by_name(name);
     DCField *result = (*pi)->get_field_by_name(name);
-    if (result != (DCField *)NULL) {
+    if (result != nullptr) {
       return result;
       return result;
     }
     }
   }
   }
 
 
   // Nobody knew what this field is.
   // Nobody knew what this field is.
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -232,7 +236,7 @@ get_field_by_index(int index_number) const {
   Parents::const_iterator pi;
   Parents::const_iterator pi;
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
     DCField *result = (*pi)->get_field_by_index(index_number);
     DCField *result = (*pi)->get_field_by_index(index_number);
-    if (result != (DCField *)NULL) {
+    if (result != nullptr) {
       // Cache this result for future lookups.
       // Cache this result for future lookups.
       ((DCClass *)this)->_fields_by_index[index_number] = result;
       ((DCClass *)this)->_fields_by_index[index_number] = result;
       return result;
       return result;
@@ -240,7 +244,7 @@ get_field_by_index(int index_number) const {
   }
   }
 
 
   // Nobody knew what this field is.
   // Nobody knew what this field is.
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -250,7 +254,7 @@ get_field_by_index(int index_number) const {
 int DCClass::
 int DCClass::
 get_num_inherited_fields() const {
 get_num_inherited_fields() const {
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
-      _dc_file != (DCFile *)NULL) {
+      _dc_file != nullptr) {
     _dc_file->check_inherited_fields();
     _dc_file->check_inherited_fields();
     if (_inherited_fields.empty()) {
     if (_inherited_fields.empty()) {
       ((DCClass *)this)->rebuild_inherited_fields();
       ((DCClass *)this)->rebuild_inherited_fields();
@@ -283,12 +287,12 @@ get_num_inherited_fields() const {
 DCField *DCClass::
 DCField *DCClass::
 get_inherited_field(int n) const {
 get_inherited_field(int n) const {
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
-      _dc_file != (DCFile *)NULL) {
+      _dc_file != nullptr) {
     _dc_file->check_inherited_fields();
     _dc_file->check_inherited_fields();
     if (_inherited_fields.empty()) {
     if (_inherited_fields.empty()) {
       ((DCClass *)this)->rebuild_inherited_fields();
       ((DCClass *)this)->rebuild_inherited_fields();
     }
     }
-    nassertr(n >= 0 && n < (int)_inherited_fields.size(), NULL);
+    nassertr(n >= 0 && n < (int)_inherited_fields.size(), nullptr);
     return _inherited_fields[n];
     return _inherited_fields[n];
 
 
   } else {
   } else {
@@ -349,7 +353,7 @@ output(ostream &out) const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_class_def() const {
 has_class_def() const {
-  return (_class_def != NULL);
+  return (_class_def != nullptr);
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -373,7 +377,7 @@ set_class_def(PyObject *class_def) {
  */
  */
 PyObject *DCClass::
 PyObject *DCClass::
 get_class_def() const {
 get_class_def() const {
-  if (_class_def == NULL) {
+  if (_class_def == nullptr) {
     Py_INCREF(Py_None);
     Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
@@ -390,7 +394,7 @@ get_class_def() const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_owner_class_def() const {
 has_owner_class_def() const {
-  return (_owner_class_def != NULL);
+  return (_owner_class_def != nullptr);
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -414,7 +418,7 @@ set_owner_class_def(PyObject *owner_class_def) {
  */
  */
 PyObject *DCClass::
 PyObject *DCClass::
 get_owner_class_def() const {
 get_owner_class_def() const {
-  if (_owner_class_def == NULL) {
+  if (_owner_class_def == nullptr) {
     Py_INCREF(Py_None);
     Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
@@ -441,7 +445,7 @@ receive_update(PyObject *distobj, DatagramIterator &di) const {
 
 
     int field_id = packer.raw_unpack_uint16();
     int field_id = packer.raw_unpack_uint16();
     DCField *field = get_field_by_index(field_id);
     DCField *field = get_field_by_index(field_id);
-    if (field == (DCField *)NULL) {
+    if (field == nullptr) {
             ostringstream strm;
             ostringstream strm;
             strm
             strm
                 << "Received update for field " << field_id << ", not in class "
                 << "Received update for field " << field_id << ", not in class "
@@ -478,7 +482,7 @@ receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required() && field->is_broadcast()) {
         field->is_required() && field->is_broadcast()) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -513,7 +517,7 @@ receive_update_broadcast_required_owner(PyObject *distobj,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required() && (field->is_ownrecv() || field->is_broadcast())) {
         field->is_required() && (field->is_ownrecv() || field->is_broadcast())) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -546,7 +550,7 @@ receive_update_all_required(PyObject *distobj, DatagramIterator &di) const {
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required()) {
         field->is_required()) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -583,9 +587,9 @@ receive_update_other(PyObject *distobj, DatagramIterator &di) const {
  */
  */
 void DCClass::
 void DCClass::
 direct_update(PyObject *distobj, const string &field_name,
 direct_update(PyObject *distobj, const string &field_name,
-              const string &value_blob) {
+              const vector_uchar &value_blob) {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  nassertv_always(field != NULL);
+  nassertv_always(field != nullptr);
 
 
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(value_blob);
   packer.set_unpack_data(value_blob);
@@ -602,7 +606,14 @@ direct_update(PyObject *distobj, const string &field_name,
 void DCClass::
 void DCClass::
 direct_update(PyObject *distobj, const string &field_name,
 direct_update(PyObject *distobj, const string &field_name,
               const Datagram &datagram) {
               const Datagram &datagram) {
-  direct_update(distobj, field_name, datagram.get_message());
+  DCField *field = get_field_by_name(field_name);
+  nassertv_always(field != nullptr);
+
+  DCPacker packer;
+  packer.set_unpack_data((const char *)datagram.get_data(), datagram.get_length(), false);
+  packer.begin_unpack(field);
+  field->receive_update(packer, distobj);
+  packer.end_unpack();
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -645,7 +656,7 @@ bool DCClass::
 pack_required_field(DCPacker &packer, PyObject *distobj,
 pack_required_field(DCPacker &packer, PyObject *distobj,
                     const DCField *field) const {
                     const DCField *field) const {
   const DCParameter *parameter = field->as_parameter();
   const DCParameter *parameter = field->as_parameter();
-  if (parameter != (DCParameter *)NULL) {
+  if (parameter != nullptr) {
     // This is the easy case: to pack a parameter, we just look on the class
     // This is the easy case: to pack a parameter, we just look on the class
     // object for the data element.
     // object for the data element.
     string field_name = field->get_name();
     string field_name = field->get_name();
@@ -668,7 +679,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     }
     }
     PyObject *result =
     PyObject *result =
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
-    nassertr(result != (PyObject *)NULL, false);
+    nassertr(result != nullptr, false);
 
 
     // Now pack the value into the datagram.
     // Now pack the value into the datagram.
     bool pack_ok = parameter->pack_args(packer, result);
     bool pack_ok = parameter->pack_args(packer, result);
@@ -677,7 +688,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     return pack_ok;
     return pack_ok;
   }
   }
 
 
-  if (field->as_molecular_field() != (DCMolecularField *)NULL) {
+  if (field->as_molecular_field() != nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "Cannot pack molecular field " << field->get_name()
     strm << "Cannot pack molecular field " << field->get_name()
          << " for generate";
          << " for generate";
@@ -686,7 +697,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
   }
   }
 
 
   const DCAtomicField *atom = field->as_atomic_field();
   const DCAtomicField *atom = field->as_atomic_field();
-  nassertr(atom != (DCAtomicField *)NULL, false);
+  nassertr(atom != nullptr, false);
 
 
   // We need to get the initial value of this field.  There isn't a good,
   // We need to get the initial value of this field.  There isn't a good,
   // robust way to get this; presently, we just mangle the "setFoo()" name of
   // robust way to get this; presently, we just mangle the "setFoo()" name of
@@ -740,16 +751,16 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
   }
   }
   PyObject *func =
   PyObject *func =
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
-  nassertr(func != (PyObject *)NULL, false);
+  nassertr(func != nullptr, false);
 
 
   PyObject *empty_args = PyTuple_New(0);
   PyObject *empty_args = PyTuple_New(0);
   PyObject *result = PyObject_CallObject(func, empty_args);
   PyObject *result = PyObject_CallObject(func, empty_args);
   Py_DECREF(empty_args);
   Py_DECREF(empty_args);
   Py_DECREF(func);
   Py_DECREF(func);
-  if (result == (PyObject *)NULL) {
+  if (result == nullptr) {
     // We don't set this as an exception, since presumably the Python method
     // We don't set this as an exception, since presumably the Python method
     // itself has already triggered a Python exception.
     // itself has already triggered a Python exception.
-    cerr << "Error when calling " << getter_name << "\n";
+    std::cerr << "Error when calling " << getter_name << "\n";
     return false;
     return false;
   }
   }
 
 
@@ -789,7 +800,7 @@ Datagram DCClass::
 client_format_update(const string &field_name, DOID_TYPE do_id,
 client_format_update(const string &field_name, DOID_TYPE do_id,
                      PyObject *args) const {
                      PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -810,7 +821,7 @@ Datagram DCClass::
 ai_format_update(const string &field_name, DOID_TYPE do_id,
 ai_format_update(const string &field_name, DOID_TYPE do_id,
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -832,7 +843,7 @@ Datagram DCClass::
 ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
 ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const {
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -871,7 +882,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields; ++i) {
   for (int i = 0; i < num_fields; ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
+    if (field->is_required() && field->as_molecular_field() == nullptr) {
       packer.begin_pack(field);
       packer.begin_pack(field);
       if (!pack_required_field(packer, distobj, field)) {
       if (!pack_required_field(packer, distobj, field)) {
         return Datagram();
         return Datagram();
@@ -897,7 +908,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
     Py_XDECREF(py_field_name);
     Py_XDECREF(py_field_name);
 
 
     DCField *field = get_field_by_name(field_name);
     DCField *field = get_field_by_name(field_name);
-    if (field == (DCField *)NULL) {
+    if (field == nullptr) {
       ostringstream strm;
       ostringstream strm;
       strm << "No field named " << field_name << " in class " << get_name()
       strm << "No field named " << field_name << " in class " << get_name()
            << "\n";
            << "\n";
@@ -956,7 +967,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields; ++i) {
   for (int i = 0; i < num_fields; ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
+    if (field->is_required() && field->as_molecular_field() == nullptr) {
       packer.begin_pack(field);
       packer.begin_pack(field);
       if (!pack_required_field(packer, distobj, field)) {
       if (!pack_required_field(packer, distobj, field)) {
         return Datagram();
         return Datagram();
@@ -980,7 +991,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
       Py_XDECREF(py_field_name);
       Py_XDECREF(py_field_name);
 
 
       DCField *field = get_field_by_name(field_name);
       DCField *field = get_field_by_name(field_name);
-      if (field == (DCField *)NULL) {
+      if (field == nullptr) {
         ostringstream strm;
         ostringstream strm;
         strm << "No field named " << field_name << " in class " << get_name()
         strm << "No field named " << field_name << " in class " << get_name()
              << "\n";
              << "\n";
@@ -1042,7 +1053,7 @@ write(ostream &out, bool brief, int indent_level) const {
   }
   }
   out << "\n";
   out << "\n";
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->write(out, brief, indent_level + 2);
     _constructor->write(out, brief, indent_level + 2);
   }
   }
 
 
@@ -1098,7 +1109,7 @@ output_instance(ostream &out, bool brief, const string &prename,
 
 
   out << " {";
   out << " {";
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->output(out, brief);
     _constructor->output(out, brief);
     out << "; ";
     out << "; ";
   }
   }
@@ -1134,7 +1145,7 @@ generate_hash(HashGenerator &hashgen) const {
     hashgen.add_int((*pi)->get_number());
     hashgen.add_int((*pi)->get_number());
   }
   }
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->generate_hash(hashgen);
     _constructor->generate_hash(hashgen);
   }
   }
 
 
@@ -1236,7 +1247,7 @@ shadow_inherited_field(const string &name) {
   }
   }
 
 
   // If we get here, the named field wasn't in the list.  Huh.
   // If we get here, the named field wasn't in the list.  Huh.
-  nassertv(false);
+  nassert_raise("named field not in list");
 }
 }
 
 
 /**
 /**
@@ -1247,20 +1258,20 @@ shadow_inherited_field(const string &name) {
  */
  */
 bool DCClass::
 bool DCClass::
 add_field(DCField *field) {
 add_field(DCField *field) {
-  nassertr(field->get_class() == this || field->get_class() == NULL, false);
+  nassertr(field->get_class() == this || field->get_class() == nullptr, false);
   field->set_class(this);
   field->set_class(this);
-  if (_dc_file != (DCFile *)NULL) {
+  if (_dc_file != nullptr) {
     _dc_file->mark_inherited_fields_stale();
     _dc_file->mark_inherited_fields_stale();
   }
   }
 
 
   if (!field->get_name().empty()) {
   if (!field->get_name().empty()) {
     if (field->get_name() == _name) {
     if (field->get_name() == _name) {
       // This field is a constructor.
       // This field is a constructor.
-      if (_constructor != (DCField *)NULL) {
+      if (_constructor != nullptr) {
         // We already have a constructor.
         // We already have a constructor.
         return false;
         return false;
       }
       }
-      if (field->as_atomic_field() == (DCAtomicField *)NULL) {
+      if (field->as_atomic_field() == nullptr) {
         // The constructor must be an atomic field.
         // The constructor must be an atomic field.
         return false;
         return false;
       }
       }
@@ -1278,7 +1289,7 @@ add_field(DCField *field) {
     }
     }
   }
   }
 
 
-  if (_dc_file != (DCFile *)NULL &&
+  if (_dc_file != nullptr &&
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
     if (dc_multiple_inheritance) {
     if (dc_multiple_inheritance) {
       _dc_file->set_new_index_number(field);
       _dc_file->set_new_index_number(field);

+ 18 - 18
direct/src/dcparser/dcClass.h

@@ -41,9 +41,9 @@ class DCParameter;
 /**
 /**
  * Defines a particular DistributedClass as read from an input .dc file.
  * Defines a particular DistributedClass as read from an input .dc file.
  */
  */
-class DCClass : public DCDeclaration {
+class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
 public:
 public:
-  DCClass(DCFile *dc_file, const string &name,
+  DCClass(DCFile *dc_file, const std::string &name,
           bool is_struct, bool bogus_class);
           bool is_struct, bool bogus_class);
   ~DCClass();
   ~DCClass();
 
 
@@ -53,7 +53,7 @@ PUBLISHED:
 
 
   INLINE DCFile *get_dc_file() const;
   INLINE DCFile *get_dc_file() const;
 
 
-  INLINE const string &get_name() const;
+  INLINE const std::string &get_name() const;
   INLINE int get_number() const;
   INLINE int get_number() const;
 
 
   int get_num_parents() const;
   int get_num_parents() const;
@@ -65,7 +65,7 @@ PUBLISHED:
   int get_num_fields() const;
   int get_num_fields() const;
   DCField *get_field(int n) const;
   DCField *get_field(int n) const;
 
 
-  DCField *get_field_by_name(const string &name) const;
+  DCField *get_field_by_name(const std::string &name) const;
   DCField *get_field_by_index(int index_number) const;
   DCField *get_field_by_index(int index_number) const;
 
 
   int get_num_inherited_fields() const;
   int get_num_inherited_fields() const;
@@ -78,7 +78,7 @@ PUBLISHED:
   INLINE void start_generate();
   INLINE void start_generate();
   INLINE void stop_generate();
   INLINE void stop_generate();
 
 
-  virtual void output(ostream &out) const;
+  virtual void output(std::ostream &out) const;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
   bool has_class_def() const;
   bool has_class_def() const;
@@ -94,9 +94,9 @@ PUBLISHED:
   void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const;
   void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const;
   void receive_update_other(PyObject *distobj, DatagramIterator &di) const;
   void receive_update_other(PyObject *distobj, DatagramIterator &di) const;
 
 
-  void direct_update(PyObject *distobj, const string &field_name,
-                     const string &value_blob);
-  void direct_update(PyObject *distobj, const string &field_name,
+  void direct_update(PyObject *distobj, const std::string &field_name,
+                     const vector_uchar &value_blob);
+  void direct_update(PyObject *distobj, const std::string &field_name,
                      const Datagram &datagram);
                      const Datagram &datagram);
   bool pack_required_field(Datagram &datagram, PyObject *distobj,
   bool pack_required_field(Datagram &datagram, PyObject *distobj,
                            const DCField *field) const;
                            const DCField *field) const;
@@ -105,11 +105,11 @@ PUBLISHED:
 
 
 
 
 
 
-  Datagram client_format_update(const string &field_name,
+  Datagram client_format_update(const std::string &field_name,
                                 DOID_TYPE do_id, PyObject *args) const;
                                 DOID_TYPE do_id, PyObject *args) const;
-  Datagram ai_format_update(const string &field_name, DOID_TYPE do_id,
+  Datagram ai_format_update(const std::string &field_name, DOID_TYPE do_id,
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
-  Datagram ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
+  Datagram ai_format_update_msg_type(const std::string &field_name, DOID_TYPE do_id,
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const;
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const;
   Datagram ai_format_generate(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE parent_id, ZONEID_TYPE zone_id,
   Datagram ai_format_generate(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE parent_id, ZONEID_TYPE zone_id,
                               CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
                               CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
@@ -120,10 +120,10 @@ PUBLISHED:
 #endif
 #endif
 
 
 public:
 public:
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
-  void output_instance(ostream &out, bool brief, const string &prename,
-                       const string &name, const string &postname) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
+  void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                       const std::string &name, const std::string &postname) const;
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
   void clear_inherited_fields();
   void clear_inherited_fields();
   void rebuild_inherited_fields();
   void rebuild_inherited_fields();
@@ -133,7 +133,7 @@ public:
   void set_number(int number);
   void set_number(int number);
 
 
 private:
 private:
-  void shadow_inherited_field(const string &name);
+  void shadow_inherited_field(const std::string &name);
 
 
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   PStatCollector _class_update_pcollector;
   PStatCollector _class_update_pcollector;
@@ -144,7 +144,7 @@ private:
 
 
   DCFile *_dc_file;
   DCFile *_dc_file;
 
 
-  string _name;
+  std::string _name;
   bool _is_struct;
   bool _is_struct;
   bool _bogus_class;
   bool _bogus_class;
   int _number;
   int _number;
@@ -157,7 +157,7 @@ private:
   typedef pvector<DCField *> Fields;
   typedef pvector<DCField *> Fields;
   Fields _fields, _inherited_fields;
   Fields _fields, _inherited_fields;
 
 
-  typedef pmap<string, DCField *> FieldsByName;
+  typedef pmap<std::string, DCField *> FieldsByName;
   FieldsByName _fields_by_name;
   FieldsByName _fields_by_name;
 
 
   typedef pmap<int, DCField *> FieldsByIndex;
   typedef pmap<int, DCField *> FieldsByIndex;

+ 4 - 4
direct/src/dcparser/dcClassParameter.cxx

@@ -119,7 +119,7 @@ get_class() const {
  */
  */
 DCPackerInterface *DCClassParameter::
 DCPackerInterface *DCClassParameter::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_nested_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_nested_fields.size(), nullptr);
   return _nested_fields[n];
   return _nested_fields[n];
 }
 }
 
 
@@ -128,9 +128,9 @@ get_nested_field(int n) const {
  * identifier.
  * identifier.
  */
  */
 void DCClassParameter::
 void DCClassParameter::
-output_instance(ostream &out, bool brief, const string &prename,
-                const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+output_instance(std::ostream &out, bool brief, const std::string &prename,
+                const std::string &name, const std::string &postname) const {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {

+ 3 - 3
direct/src/dcparser/dcClassParameter.h

@@ -23,7 +23,7 @@ class DCClass;
  * This represents a class (or struct) object used as a parameter itself.
  * This represents a class (or struct) object used as a parameter itself.
  * This means that all the fields of the class get packed into the message.
  * This means that all the fields of the class get packed into the message.
  */
  */
-class DCClassParameter : public DCParameter {
+class EXPCL_DIRECT_DCPARSER DCClassParameter : public DCParameter {
 public:
 public:
   DCClassParameter(const DCClass *dclass);
   DCClassParameter(const DCClass *dclass);
   DCClassParameter(const DCClassParameter &copy);
   DCClassParameter(const DCClassParameter &copy);
@@ -39,8 +39,8 @@ PUBLISHED:
 public:
 public:
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;
 
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
 protected:
 protected:

+ 6 - 6
direct/src/dcparser/dcDeclaration.cxx

@@ -26,7 +26,7 @@ DCDeclaration::
  */
  */
 DCClass *DCDeclaration::
 DCClass *DCDeclaration::
 as_class() {
 as_class() {
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -34,7 +34,7 @@ as_class() {
  */
  */
 const DCClass *DCDeclaration::
 const DCClass *DCDeclaration::
 as_class() const {
 as_class() const {
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -42,7 +42,7 @@ as_class() const {
  */
  */
 DCSwitch *DCDeclaration::
 DCSwitch *DCDeclaration::
 as_switch() {
 as_switch() {
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -50,14 +50,14 @@ as_switch() {
  */
  */
 const DCSwitch *DCDeclaration::
 const DCSwitch *DCDeclaration::
 as_switch() const {
 as_switch() const {
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 void DCDeclaration::
 void DCDeclaration::
-output(ostream &out) const {
+output(std::ostream &out) const {
   output(out, true);
   output(out, true);
 }
 }
 
 
@@ -65,6 +65,6 @@ output(ostream &out) const {
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 void DCDeclaration::
 void DCDeclaration::
-write(ostream &out, int indent_level) const {
+write(std::ostream &out, int indent_level) const {
   write(out, false, indent_level);
   write(out, false, indent_level);
 }
 }

+ 6 - 6
direct/src/dcparser/dcDeclaration.h

@@ -26,7 +26,7 @@ class DCSwitch;
  * only purpose is so that classes and typedefs can be stored in one list
  * only purpose is so that classes and typedefs can be stored in one list
  * together so they can be ordered correctly on output.
  * together so they can be ordered correctly on output.
  */
  */
-class DCDeclaration {
+class EXPCL_DIRECT_DCPARSER DCDeclaration {
 public:
 public:
   virtual ~DCDeclaration();
   virtual ~DCDeclaration();
 
 
@@ -36,15 +36,15 @@ PUBLISHED:
   virtual DCSwitch *as_switch();
   virtual DCSwitch *as_switch();
   virtual const DCSwitch *as_switch() const;
   virtual const DCSwitch *as_switch() const;
 
 
-  virtual void output(ostream &out) const;
-  void write(ostream &out, int indent_level) const;
+  virtual void output(std::ostream &out) const;
+  void write(std::ostream &out, int indent_level) const;
 
 
 public:
 public:
-  virtual void output(ostream &out, bool brief) const=0;
-  virtual void write(ostream &out, bool brief, int indent_level) const=0;
+  virtual void output(std::ostream &out, bool brief) const=0;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const=0;
 };
 };
 
 
-INLINE ostream &operator << (ostream &out, const DCDeclaration &decl) {
+INLINE std::ostream &operator << (std::ostream &out, const DCDeclaration &decl) {
   decl.output(out);
   decl.output(out);
   return out;
   return out;
 }
 }

+ 5 - 5
direct/src/dcparser/dcField.I

@@ -42,7 +42,7 @@ has_default_value() const {
  * explicitly set (e.g.  has_default_value() returns true), returns that
  * explicitly set (e.g.  has_default_value() returns true), returns that
  * value; otherwise, returns an implicit default for the field.
  * value; otherwise, returns an implicit default for the field.
  */
  */
-INLINE const string &DCField::
+INLINE const vector_uchar &DCField::
 get_default_value() const {
 get_default_value() const {
   if (_default_value_stale) {
   if (_default_value_stale) {
     ((DCField *)this)->refresh_default_value();
     ((DCField *)this)->refresh_default_value();
@@ -138,7 +138,7 @@ is_airecv() const {
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 INLINE void DCField::
 INLINE void DCField::
-output(ostream &out) const {
+output(std::ostream &out) const {
   output(out, true);
   output(out, true);
 }
 }
 
 
@@ -146,7 +146,7 @@ output(ostream &out) const {
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 INLINE void DCField::
 INLINE void DCField::
-write(ostream &out, int indent_level) const {
+write(std::ostream &out, int indent_level) const {
   write(out, false, indent_level);
   write(out, false, indent_level);
 }
 }
 
 
@@ -172,8 +172,8 @@ set_class(DCClass *dclass) {
  * Establishes a default value for this field.
  * Establishes a default value for this field.
  */
  */
 INLINE void DCField::
 INLINE void DCField::
-set_default_value(const string &default_value) {
-  _default_value = default_value;
+set_default_value(vector_uchar default_value) {
+  _default_value = std::move(default_value);
   _has_default_value = true;
   _has_default_value = true;
   _default_value_stale = false;
   _default_value_stale = false;
 }
 }

+ 38 - 35
direct/src/dcparser/dcField.cxx

@@ -26,12 +26,14 @@
 #include "pStatTimer.h"
 #include "pStatTimer.h"
 #endif
 #endif
 
 
+using std::string;
+
 /**
 /**
  *
  *
  */
  */
 DCField::
 DCField::
 DCField() :
 DCField() :
-  _dclass(NULL)
+  _dclass(nullptr)
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   ,
   ,
   _field_update_pcollector("DCField")
   _field_update_pcollector("DCField")
@@ -108,7 +110,7 @@ as_field() const {
  */
  */
 DCAtomicField *DCField::
 DCAtomicField *DCField::
 as_atomic_field() {
 as_atomic_field() {
-  return (DCAtomicField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -117,7 +119,7 @@ as_atomic_field() {
  */
  */
 const DCAtomicField *DCField::
 const DCAtomicField *DCField::
 as_atomic_field() const {
 as_atomic_field() const {
-  return (DCAtomicField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -126,7 +128,7 @@ as_atomic_field() const {
  */
  */
 DCMolecularField *DCField::
 DCMolecularField *DCField::
 as_molecular_field() {
 as_molecular_field() {
-  return (DCMolecularField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -135,7 +137,7 @@ as_molecular_field() {
  */
  */
 const DCMolecularField *DCField::
 const DCMolecularField *DCField::
 as_molecular_field() const {
 as_molecular_field() const {
-  return (DCMolecularField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -143,7 +145,7 @@ as_molecular_field() const {
  */
  */
 DCParameter *DCField::
 DCParameter *DCField::
 as_parameter() {
 as_parameter() {
-  return (DCParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -151,7 +153,7 @@ as_parameter() {
  */
  */
 const DCParameter *DCField::
 const DCParameter *DCField::
 as_parameter() const {
 as_parameter() const {
-  return (DCParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -160,7 +162,7 @@ as_parameter() const {
  * is an error.
  * is an error.
  */
  */
 string DCField::
 string DCField::
-format_data(const string &packed_data, bool show_field_names) {
+format_data(const vector_uchar &packed_data, bool show_field_names) {
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(packed_data);
   packer.set_unpack_data(packed_data);
   packer.begin_unpack(this);
   packer.begin_unpack(this);
@@ -176,20 +178,20 @@ format_data(const string &packed_data, bool show_field_names) {
  * above) that represents the value of this field, parse the string and return
  * above) that represents the value of this field, parse the string and return
  * the corresponding packed data.  Returns empty string if there is an error.
  * the corresponding packed data.  Returns empty string if there is an error.
  */
  */
-string DCField::
+vector_uchar DCField::
 parse_string(const string &formatted_string) {
 parse_string(const string &formatted_string) {
   DCPacker packer;
   DCPacker packer;
   packer.begin_pack(this);
   packer.begin_pack(this);
   if (!packer.parse_and_pack(formatted_string)) {
   if (!packer.parse_and_pack(formatted_string)) {
     // Parse error.
     // Parse error.
-    return string();
+    return vector_uchar();
   }
   }
   if (!packer.end_pack()) {
   if (!packer.end_pack()) {
     // Data type mismatch.
     // Data type mismatch.
-    return string();
+    return vector_uchar();
   }
   }
 
 
-  return packer.get_string();
+  return packer.get_bytes();
 }
 }
 
 
 /**
 /**
@@ -198,7 +200,7 @@ parse_string(const string &formatted_string) {
  * record.  Returns true if all fields are valid, false otherwise.
  * record.  Returns true if all fields are valid, false otherwise.
  */
  */
 bool DCField::
 bool DCField::
-validate_ranges(const string &packed_data) const {
+validate_ranges(const vector_uchar &packed_data) const {
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(packed_data);
   packer.set_unpack_data(packed_data);
   packer.begin_unpack(this);
   packer.begin_unpack(this);
@@ -207,7 +209,7 @@ validate_ranges(const string &packed_data) const {
     return false;
     return false;
   }
   }
 
 
-  return (packer.get_num_unpacked_bytes() == packed_data.length());
+  return (packer.get_num_unpacked_bytes() == packed_data.size());
 }
 }
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
@@ -232,10 +234,10 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
   }
   }
 
 
   if (!Notify::ptr()->has_assert_failed()) {
   if (!Notify::ptr()->has_assert_failed()) {
-    ostringstream strm;
+    std::ostringstream strm;
     PyObject *exc_type = PyExc_Exception;
     PyObject *exc_type = PyExc_Exception;
 
 
-    if (as_parameter() != (DCParameter *)NULL) {
+    if (as_parameter() != nullptr) {
       // If it's a parameter-type field, the value may or may not be a
       // If it's a parameter-type field, the value may or may not be a
       // sequence.
       // sequence.
       if (packer.had_pack_error()) {
       if (packer.had_pack_error()) {
@@ -251,7 +253,7 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
     } else {
     } else {
       // If it's a molecular or atomic field, the value should be a sequence.
       // If it's a molecular or atomic field, the value should be a sequence.
       PyObject *tuple = PySequence_Tuple(sequence);
       PyObject *tuple = PySequence_Tuple(sequence);
-      if (tuple == (PyObject *)NULL) {
+      if (tuple == nullptr) {
         strm << "Value for " << get_name() << " not a sequence: " \
         strm << "Value for " << get_name() << " not a sequence: " \
              << get_pystr(sequence);
              << get_pystr(sequence);
         exc_type = PyExc_TypeError;
         exc_type = PyExc_TypeError;
@@ -287,8 +289,8 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
  */
  */
 PyObject *DCField::
 PyObject *DCField::
 unpack_args(DCPacker &packer) const {
 unpack_args(DCPacker &packer) const {
-  nassertr(!packer.had_error(), NULL);
-  nassertr(packer.get_current_field() == this, NULL);
+  nassertr(!packer.had_error(), nullptr);
+  nassertr(packer.get_current_field() == this, nullptr);
 
 
   size_t start_byte = packer.get_num_unpacked_bytes();
   size_t start_byte = packer.get_num_unpacked_bytes();
   PyObject *object = packer.unpack_object();
   PyObject *object = packer.unpack_object();
@@ -303,7 +305,7 @@ unpack_args(DCPacker &packer) const {
   }
   }
 
 
   if (!Notify::ptr()->has_assert_failed()) {
   if (!Notify::ptr()->has_assert_failed()) {
-    ostringstream strm;
+    std::ostringstream strm;
     PyObject *exc_type = PyExc_Exception;
     PyObject *exc_type = PyExc_Exception;
 
 
     if (packer.had_pack_error()) {
     if (packer.had_pack_error()) {
@@ -315,7 +317,7 @@ unpack_args(DCPacker &packer) const {
       dg.dump_hex(strm);
       dg.dump_hex(strm);
       size_t error_byte = packer.get_num_unpacked_bytes() - start_byte;
       size_t error_byte = packer.get_num_unpacked_bytes() - start_byte;
       strm << "Error detected on byte " << error_byte
       strm << "Error detected on byte " << error_byte
-           << " (" << hex << error_byte << dec << " hex)";
+           << " (" << std::hex << error_byte << std::dec << " hex)";
 
 
       exc_type = PyExc_RuntimeError;
       exc_type = PyExc_RuntimeError;
     } else {
     } else {
@@ -329,7 +331,7 @@ unpack_args(DCPacker &packer) const {
   }
   }
 
 
   Py_XDECREF(object);
   Py_XDECREF(object);
-  return NULL;
+  return nullptr;
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -340,10 +342,10 @@ unpack_args(DCPacker &packer) const {
  */
  */
 void DCField::
 void DCField::
 receive_update(DCPacker &packer, PyObject *distobj) const {
 receive_update(DCPacker &packer, PyObject *distobj) const {
-  if (as_parameter() != (DCParameter *)NULL) {
+  if (as_parameter() != nullptr) {
     // If it's a parameter-type field, just store a new value on the object.
     // If it's a parameter-type field, just store a new value on the object.
     PyObject *value = unpack_args(packer);
     PyObject *value = unpack_args(packer);
-    if (value != (PyObject *)NULL) {
+    if (value != nullptr) {
       PyObject_SetAttrString(distobj, (char *)_name.c_str(), value);
       PyObject_SetAttrString(distobj, (char *)_name.c_str(), value);
     }
     }
     Py_DECREF(value);
     Py_DECREF(value);
@@ -362,9 +364,9 @@ receive_update(DCPacker &packer, PyObject *distobj) const {
       // method.
       // method.
       PyObject *args = unpack_args(packer);
       PyObject *args = unpack_args(packer);
 
 
-      if (args != (PyObject *)NULL) {
+      if (args != nullptr) {
         PyObject *func = PyObject_GetAttrString(distobj, (char *)_name.c_str());
         PyObject *func = PyObject_GetAttrString(distobj, (char *)_name.c_str());
-        nassertv(func != (PyObject *)NULL);
+        nassertv(func != nullptr);
 
 
         PyObject *result;
         PyObject *result;
         {
         {
@@ -486,7 +488,7 @@ pack_default_value(DCPackData &pack_data, bool &) const {
   // The default behavior is to pack the default value if we got it;
   // The default behavior is to pack the default value if we got it;
   // otherwise, to return false and let the packer visit our nested elements.
   // otherwise, to return false and let the packer visit our nested elements.
   if (!_default_value_stale) {
   if (!_default_value_stale) {
-    pack_data.append_data(_default_value.data(), _default_value.length());
+    pack_data.append_data((const char *)_default_value.data(), _default_value.size());
     return true;
     return true;
   }
   }
 
 
@@ -499,7 +501,7 @@ pack_default_value(DCPackData &pack_data, bool &) const {
 void DCField::
 void DCField::
 set_name(const string &name) {
 set_name(const string &name) {
   DCPackerInterface::set_name(name);
   DCPackerInterface::set_name(name);
-  if (_dclass != (DCClass *)NULL) {
+  if (_dclass != nullptr) {
     _dclass->_dc_file->mark_inherited_fields_stale();
     _dclass->_dc_file->mark_inherited_fields_stale();
   }
   }
 }
 }
@@ -510,12 +512,12 @@ set_name(const string &name) {
  */
  */
 string DCField::
 string DCField::
 get_pystr(PyObject *value) {
 get_pystr(PyObject *value) {
-  if (value == NULL) {
+  if (value == nullptr) {
     return "(null)";
     return "(null)";
   }
   }
 
 
   PyObject *str = PyObject_Str(value);
   PyObject *str = PyObject_Str(value);
-  if (str != NULL) {
+  if (str != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     string result = PyUnicode_AsUTF8(str);
     string result = PyUnicode_AsUTF8(str);
 #else
 #else
@@ -526,7 +528,7 @@ get_pystr(PyObject *value) {
   }
   }
 
 
   PyObject *repr = PyObject_Repr(value);
   PyObject *repr = PyObject_Repr(value);
-  if (repr != NULL) {
+  if (repr != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     string result = PyUnicode_AsUTF8(repr);
     string result = PyUnicode_AsUTF8(repr);
 #else
 #else
@@ -536,9 +538,9 @@ get_pystr(PyObject *value) {
     return result;
     return result;
   }
   }
 
 
-  if (value->ob_type != NULL) {
+  if (value->ob_type != nullptr) {
     PyObject *typestr = PyObject_Str((PyObject *)(value->ob_type));
     PyObject *typestr = PyObject_Str((PyObject *)(value->ob_type));
-    if (typestr != NULL) {
+    if (typestr != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       string result = PyUnicode_AsUTF8(typestr);
       string result = PyUnicode_AsUTF8(typestr);
 #else
 #else
@@ -562,9 +564,10 @@ refresh_default_value() {
   packer.begin_pack(this);
   packer.begin_pack(this);
   packer.pack_default_value();
   packer.pack_default_value();
   if (!packer.end_pack()) {
   if (!packer.end_pack()) {
-    cerr << "Error while packing default value for " << get_name() << "\n";
+    std::cerr << "Error while packing default value for " << get_name() << "\n";
   } else {
   } else {
-    _default_value.assign(packer.get_data(), packer.get_length());
+    const unsigned char *data = (const unsigned char *)packer.get_data();
+    _default_value = vector_uchar(data, data + packer.get_length());
   }
   }
   _default_value_stale = false;
   _default_value_stale = false;
 }
 }

+ 15 - 15
direct/src/dcparser/dcField.h

@@ -34,10 +34,10 @@ class HashGenerator;
 /**
 /**
  * A single field of a Distributed Class, either atomic or molecular.
  * A single field of a Distributed Class, either atomic or molecular.
  */
  */
-class DCField : public DCPackerInterface, public DCKeywordList {
+class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeywordList {
 public:
 public:
   DCField();
   DCField();
-  DCField(const string &name, DCClass *dclass);
+  DCField(const std::string &name, DCClass *dclass);
   virtual ~DCField();
   virtual ~DCField();
 
 
 PUBLISHED:
 PUBLISHED:
@@ -53,13 +53,13 @@ PUBLISHED:
   virtual DCParameter *as_parameter();
   virtual DCParameter *as_parameter();
   virtual const DCParameter *as_parameter() const;
   virtual const DCParameter *as_parameter() const;
 
 
-  string format_data(const string &packed_data, bool show_field_names = true);
-  string parse_string(const string &formatted_string);
+  std::string format_data(const vector_uchar &packed_data, bool show_field_names = true);
+  vector_uchar parse_string(const std::string &formatted_string);
 
 
-  bool validate_ranges(const string &packed_data) const;
+  bool validate_ranges(const vector_uchar &packed_data) const;
 
 
   INLINE bool has_default_value() const;
   INLINE bool has_default_value() const;
-  INLINE const string &get_default_value() const;
+  INLINE const vector_uchar &get_default_value() const;
 
 
   INLINE bool is_bogus_field() const;
   INLINE bool is_bogus_field() const;
 
 
@@ -73,8 +73,8 @@ PUBLISHED:
   INLINE bool is_ownrecv() const;
   INLINE bool is_ownrecv() const;
   INLINE bool is_airecv() const;
   INLINE bool is_airecv() const;
 
 
-  INLINE void output(ostream &out) const;
-  INLINE void write(ostream &out, int indent_level) const;
+  INLINE void output(std::ostream &out) const;
+  INLINE void write(std::ostream &out, int indent_level) const;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
   bool pack_args(DCPacker &packer, PyObject *sequence) const;
   bool pack_args(DCPacker &packer, PyObject *sequence) const;
@@ -90,18 +90,18 @@ PUBLISHED:
 #endif
 #endif
 
 
 public:
 public:
-  virtual void output(ostream &out, bool brief) const=0;
-  virtual void write(ostream &out, bool brief, int indent_level) const=0;
+  virtual void output(std::ostream &out, bool brief) const=0;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const=0;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
-  virtual void set_name(const string &name);
+  virtual void set_name(const std::string &name);
 
 
   INLINE void set_number(int number);
   INLINE void set_number(int number);
   INLINE void set_class(DCClass *dclass);
   INLINE void set_class(DCClass *dclass);
-  INLINE void set_default_value(const string &default_value);
+  INLINE void set_default_value(vector_uchar default_value);
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  static string get_pystr(PyObject *value);
+  static std::string get_pystr(PyObject *value);
 #endif
 #endif
 
 
 protected:
 protected:
@@ -115,14 +115,14 @@ protected:
   bool _bogus_field;
   bool _bogus_field;
 
 
 private:
 private:
-  string _default_value;
+  vector_uchar _default_value;
 
 
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   PStatCollector _field_update_pcollector;
   PStatCollector _field_update_pcollector;
 #endif
 #endif
 };
 };
 
 
-INLINE ostream &operator << (ostream &out, const DCField &field) {
+INLINE std::ostream &operator << (std::ostream &out, const DCField &field) {
   field.output(out);
   field.output(out);
   return out;
   return out;
 }
 }

+ 18 - 15
direct/src/dcparser/dcFile.cxx

@@ -28,6 +28,9 @@
 #include "configVariableList.h"
 #include "configVariableList.h"
 #endif
 #endif
 
 
+using std::cerr;
+using std::string;
+
 
 
 /**
 /**
  *
  *
@@ -122,8 +125,8 @@ read(Filename filename) {
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   filename.set_text();
   filename.set_text();
   VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
   VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
-  istream *in = vfs->open_read_file(filename, true);
-  if (in == (istream *)NULL) {
+  std::istream *in = vfs->open_read_file(filename, true);
+  if (in == nullptr) {
     cerr << "Cannot open " << filename << " for reading.\n";
     cerr << "Cannot open " << filename << " for reading.\n";
     return false;
     return false;
   }
   }
@@ -163,7 +166,7 @@ read(Filename filename) {
  * (in which case the file might have been partially read).
  * (in which case the file might have been partially read).
  */
  */
 bool DCFile::
 bool DCFile::
-read(istream &in, const string &filename) {
+read(std::istream &in, const string &filename) {
   cerr << "DCFile::read of " << filename << "\n";
   cerr << "DCFile::read of " << filename << "\n";
   dc_init_parser(in, filename, *this);
   dc_init_parser(in, filename, *this);
   dcyyparse();
   dcyyparse();
@@ -203,7 +206,7 @@ write(Filename filename, bool brief) const {
  * Returns true if the description is successfully written, false otherwise.
  * Returns true if the description is successfully written, false otherwise.
  */
  */
 bool DCFile::
 bool DCFile::
-write(ostream &out, bool brief) const {
+write(std::ostream &out, bool brief) const {
   if (!_imports.empty()) {
   if (!_imports.empty()) {
     Imports::const_iterator ii;
     Imports::const_iterator ii;
     for (ii = _imports.begin(); ii != _imports.end(); ++ii) {
     for (ii = _imports.begin(); ii != _imports.end(); ++ii) {
@@ -247,7 +250,7 @@ get_num_classes() const {
  */
  */
 DCClass *DCFile::
 DCClass *DCFile::
 get_class(int n) const {
 get_class(int n) const {
-  nassertr(n >= 0 && n < (int)_classes.size(), NULL);
+  nassertr(n >= 0 && n < (int)_classes.size(), nullptr);
   return _classes[n];
   return _classes[n];
 }
 }
 
 
@@ -263,7 +266,7 @@ get_class_by_name(const string &name) const {
     return (*ni).second->as_class();
     return (*ni).second->as_class();
   }
   }
 
 
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -278,7 +281,7 @@ get_switch_by_name(const string &name) const {
     return (*ni).second->as_switch();
     return (*ni).second->as_switch();
   }
   }
 
 
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -291,13 +294,13 @@ get_switch_by_name(const string &name) const {
  */
  */
 DCField *DCFile::
 DCField *DCFile::
 get_field_by_index(int index_number) const {
 get_field_by_index(int index_number) const {
-  nassertr(dc_multiple_inheritance, NULL);
+  nassertr(dc_multiple_inheritance, nullptr);
 
 
   if (index_number >= 0 && index_number < (int)_fields_by_index.size()) {
   if (index_number >= 0 && index_number < (int)_fields_by_index.size()) {
     return _fields_by_index[index_number];
     return _fields_by_index[index_number];
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -352,7 +355,7 @@ get_num_typedefs() const {
  */
  */
 DCTypedef *DCFile::
 DCTypedef *DCFile::
 get_typedef(int n) const {
 get_typedef(int n) const {
-  nassertr(n >= 0 && n < (int)_typedefs.size(), NULL);
+  nassertr(n >= 0 && n < (int)_typedefs.size(), nullptr);
   return _typedefs[n];
   return _typedefs[n];
 }
 }
 
 
@@ -368,7 +371,7 @@ get_typedef_by_name(const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -394,9 +397,9 @@ get_keyword(int n) const {
 const DCKeyword *DCFile::
 const DCKeyword *DCFile::
 get_keyword_by_name(const string &name) const {
 get_keyword_by_name(const string &name) const {
   const DCKeyword *keyword = _keywords.get_keyword_by_name(name);
   const DCKeyword *keyword = _keywords.get_keyword_by_name(name);
-  if (keyword == (const DCKeyword *)NULL) {
+  if (keyword == nullptr) {
     keyword = _default_keywords.get_keyword_by_name(name);
     keyword = _default_keywords.get_keyword_by_name(name);
-    if (keyword != (const DCKeyword *)NULL) {
+    if (keyword != nullptr) {
       // One of the historical default keywords was used, but wasn't defined.
       // One of the historical default keywords was used, but wasn't defined.
       // Define it implicitly right now.
       // Define it implicitly right now.
       ((DCFile *)this)->_keywords.add_keyword(keyword);
       ((DCFile *)this)->_keywords.add_keyword(keyword);
@@ -612,11 +615,11 @@ setup_default_keywords() {
     { "clrecv", 0x0040 },
     { "clrecv", 0x0040 },
     { "ownsend", 0x0080 },
     { "ownsend", 0x0080 },
     { "airecv", 0x0100 },
     { "airecv", 0x0100 },
-    { NULL, 0 }
+    { nullptr, 0 }
   };
   };
 
 
   _default_keywords.clear_keywords();
   _default_keywords.clear_keywords();
-  for (int i = 0; default_keywords[i].name != NULL; ++i) {
+  for (int i = 0; default_keywords[i].name != nullptr; ++i) {
     DCKeyword *keyword =
     DCKeyword *keyword =
       new DCKeyword(default_keywords[i].name,
       new DCKeyword(default_keywords[i].name,
                     default_keywords[i].flag);
                     default_keywords[i].flag);

+ 16 - 16
direct/src/dcparser/dcFile.h

@@ -29,7 +29,7 @@ class DCDeclaration;
  * Represents the complete list of Distributed Class descriptions as read from
  * Represents the complete list of Distributed Class descriptions as read from
  * a .dc file.
  * a .dc file.
  */
  */
-class DCFile {
+class EXPCL_DIRECT_DCPARSER DCFile {
 PUBLISHED:
 PUBLISHED:
   DCFile();
   DCFile();
   ~DCFile();
   ~DCFile();
@@ -41,32 +41,32 @@ PUBLISHED:
 #endif
 #endif
 
 
   bool read(Filename filename);
   bool read(Filename filename);
-  bool read(istream &in, const string &filename = string());
+  bool read(std::istream &in, const std::string &filename = std::string());
 
 
   bool write(Filename filename, bool brief) const;
   bool write(Filename filename, bool brief) const;
-  bool write(ostream &out, bool brief) const;
+  bool write(std::ostream &out, bool brief) const;
 
 
   int get_num_classes() const;
   int get_num_classes() const;
   DCClass *get_class(int n) const;
   DCClass *get_class(int n) const;
-  DCClass *get_class_by_name(const string &name) const;
-  DCSwitch *get_switch_by_name(const string &name) const;
+  DCClass *get_class_by_name(const std::string &name) const;
+  DCSwitch *get_switch_by_name(const std::string &name) const;
 
 
   DCField *get_field_by_index(int index_number) const;
   DCField *get_field_by_index(int index_number) const;
 
 
   INLINE bool all_objects_valid() const;
   INLINE bool all_objects_valid() const;
 
 
   int get_num_import_modules() const;
   int get_num_import_modules() const;
-  string get_import_module(int n) const;
+  std::string get_import_module(int n) const;
   int get_num_import_symbols(int n) const;
   int get_num_import_symbols(int n) const;
-  string get_import_symbol(int n, int i) const;
+  std::string get_import_symbol(int n, int i) const;
 
 
   int get_num_typedefs() const;
   int get_num_typedefs() const;
   DCTypedef *get_typedef(int n) const;
   DCTypedef *get_typedef(int n) const;
-  DCTypedef *get_typedef_by_name(const string &name) const;
+  DCTypedef *get_typedef_by_name(const std::string &name) const;
 
 
   int get_num_keywords() const;
   int get_num_keywords() const;
   const DCKeyword *get_keyword(int n) const;
   const DCKeyword *get_keyword(int n) const;
-  const DCKeyword *get_keyword_by_name(const string &name) const;
+  const DCKeyword *get_keyword_by_name(const std::string &name) const;
 
 
   unsigned long get_hash() const;
   unsigned long get_hash() const;
 
 
@@ -74,10 +74,10 @@ public:
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
   bool add_class(DCClass *dclass);
   bool add_class(DCClass *dclass);
   bool add_switch(DCSwitch *dswitch);
   bool add_switch(DCSwitch *dswitch);
-  void add_import_module(const string &import_module);
-  void add_import_symbol(const string &import_symbol);
+  void add_import_module(const std::string &import_module);
+  void add_import_symbol(const std::string &import_symbol);
   bool add_typedef(DCTypedef *dtypedef);
   bool add_typedef(DCTypedef *dtypedef);
-  bool add_keyword(const string &name);
+  bool add_keyword(const std::string &name);
   void add_thing_to_delete(DCDeclaration *decl);
   void add_thing_to_delete(DCDeclaration *decl);
 
 
   void set_new_index_number(DCField *field);
   void set_new_index_number(DCField *field);
@@ -91,13 +91,13 @@ private:
   typedef pvector<DCClass *> Classes;
   typedef pvector<DCClass *> Classes;
   Classes _classes;
   Classes _classes;
 
 
-  typedef pmap<string, DCDeclaration *> ThingsByName;
+  typedef pmap<std::string, DCDeclaration *> ThingsByName;
   ThingsByName _things_by_name;
   ThingsByName _things_by_name;
 
 
-  typedef pvector<string> ImportSymbols;
+  typedef pvector<std::string> ImportSymbols;
   class Import {
   class Import {
   public:
   public:
-    string _module;
+    std::string _module;
     ImportSymbols _symbols;
     ImportSymbols _symbols;
   };
   };
 
 
@@ -107,7 +107,7 @@ private:
   typedef pvector<DCTypedef *> Typedefs;
   typedef pvector<DCTypedef *> Typedefs;
   Typedefs _typedefs;
   Typedefs _typedefs;
 
 
-  typedef pmap<string, DCTypedef *> TypedefsByName;
+  typedef pmap<std::string, DCTypedef *> TypedefsByName;
   TypedefsByName _typedefs_by_name;
   TypedefsByName _typedefs_by_name;
 
 
   DCKeywordList _keywords;
   DCKeywordList _keywords;

+ 4 - 4
direct/src/dcparser/dcKeyword.cxx

@@ -19,7 +19,7 @@
  *
  *
  */
  */
 DCKeyword::
 DCKeyword::
-DCKeyword(const string &name, int historical_flag) :
+DCKeyword(const std::string &name, int historical_flag) :
   _name(name),
   _name(name),
   _historical_flag(historical_flag)
   _historical_flag(historical_flag)
 {
 {
@@ -35,7 +35,7 @@ DCKeyword::
 /**
 /**
  * Returns the name of this keyword.
  * Returns the name of this keyword.
  */
  */
-const string &DCKeyword::
+const std::string &DCKeyword::
 get_name() const {
 get_name() const {
   return _name;
   return _name;
 }
 }
@@ -64,7 +64,7 @@ clear_historical_flag() {
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 void DCKeyword::
 void DCKeyword::
-output(ostream &out, bool brief) const {
+output(std::ostream &out, bool brief) const {
   out << "keyword " << _name;
   out << "keyword " << _name;
 }
 }
 
 
@@ -72,7 +72,7 @@ output(ostream &out, bool brief) const {
  *
  *
  */
  */
 void DCKeyword::
 void DCKeyword::
-write(ostream &out, bool, int indent_level) const {
+write(std::ostream &out, bool, int indent_level) const {
   indent(out, indent_level)
   indent(out, indent_level)
     << "keyword " << _name << ";\n";
     << "keyword " << _name << ";\n";
 }
 }

+ 6 - 6
direct/src/dcparser/dcKeyword.h

@@ -25,24 +25,24 @@ class HashGenerator;
  * define a communication property associated with a field, for instance
  * define a communication property associated with a field, for instance
  * "broadcast" or "airecv".
  * "broadcast" or "airecv".
  */
  */
-class DCKeyword : public DCDeclaration {
+class EXPCL_DIRECT_DCPARSER DCKeyword : public DCDeclaration {
 public:
 public:
-  DCKeyword(const string &name, int historical_flag = ~0);
+  DCKeyword(const std::string &name, int historical_flag = ~0);
   virtual ~DCKeyword();
   virtual ~DCKeyword();
 
 
 PUBLISHED:
 PUBLISHED:
-  const string &get_name() const;
+  const std::string &get_name() const;
 
 
 public:
 public:
   int get_historical_flag() const;
   int get_historical_flag() const;
   void clear_historical_flag();
   void clear_historical_flag();
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
 
 
 private:
 private:
-  const string _name;
+  const std::string _name;
 
 
   // This flag is only kept for historical reasons, so we can preserve the
   // This flag is only kept for historical reasons, so we can preserve the
   // file's hash code if no new flags are in use.
   // file's hash code if no new flags are in use.

+ 5 - 5
direct/src/dcparser/dcKeywordList.cxx

@@ -57,7 +57,7 @@ DCKeywordList::
  * Returns true if this list includes the indicated keyword, false otherwise.
  * Returns true if this list includes the indicated keyword, false otherwise.
  */
  */
 bool DCKeywordList::
 bool DCKeywordList::
-has_keyword(const string &name) const {
+has_keyword(const std::string &name) const {
   return (_keywords_by_name.find(name) != _keywords_by_name.end());
   return (_keywords_by_name.find(name) != _keywords_by_name.end());
 }
 }
 
 
@@ -83,7 +83,7 @@ get_num_keywords() const {
  */
  */
 const DCKeyword *DCKeywordList::
 const DCKeyword *DCKeywordList::
 get_keyword(int n) const {
 get_keyword(int n) const {
-  nassertr(n >= 0 && n < (int)_keywords.size(), NULL);
+  nassertr(n >= 0 && n < (int)_keywords.size(), nullptr);
   return _keywords[n];
   return _keywords[n];
 }
 }
 
 
@@ -92,14 +92,14 @@ get_keyword(int n) const {
  * is no keyword in the list with that name.
  * is no keyword in the list with that name.
  */
  */
 const DCKeyword *DCKeywordList::
 const DCKeyword *DCKeywordList::
-get_keyword_by_name(const string &name) const {
+get_keyword_by_name(const std::string &name) const {
   KeywordsByName::const_iterator ni;
   KeywordsByName::const_iterator ni;
   ni = _keywords_by_name.find(name);
   ni = _keywords_by_name.find(name);
   if (ni != _keywords_by_name.end()) {
   if (ni != _keywords_by_name.end()) {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -148,7 +148,7 @@ clear_keywords() {
  *
  *
  */
  */
 void DCKeywordList::
 void DCKeywordList::
-output_keywords(ostream &out) const {
+output_keywords(std::ostream &out) const {
   Keywords::const_iterator ki;
   Keywords::const_iterator ki;
   for (ki = _keywords.begin(); ki != _keywords.end(); ++ki) {
   for (ki = _keywords.begin(); ki != _keywords.end(); ++ki) {
     out << " " << (*ki)->get_name();
     out << " " << (*ki)->get_name();

+ 5 - 5
direct/src/dcparser/dcKeywordList.h

@@ -23,7 +23,7 @@ class HashGenerator;
  * This is a list of keywords (see DCKeyword) that may be set on a particular
  * This is a list of keywords (see DCKeyword) that may be set on a particular
  * field.
  * field.
  */
  */
-class DCKeywordList {
+class EXPCL_DIRECT_DCPARSER DCKeywordList {
 public:
 public:
   DCKeywordList();
   DCKeywordList();
   DCKeywordList(const DCKeywordList &copy);
   DCKeywordList(const DCKeywordList &copy);
@@ -31,11 +31,11 @@ public:
   ~DCKeywordList();
   ~DCKeywordList();
 
 
 PUBLISHED:
 PUBLISHED:
-  bool has_keyword(const string &name) const;
+  bool has_keyword(const std::string &name) const;
   bool has_keyword(const DCKeyword *keyword) const;
   bool has_keyword(const DCKeyword *keyword) const;
   int get_num_keywords() const;
   int get_num_keywords() const;
   const DCKeyword *get_keyword(int n) const;
   const DCKeyword *get_keyword(int n) const;
-  const DCKeyword *get_keyword_by_name(const string &name) const;
+  const DCKeyword *get_keyword_by_name(const std::string &name) const;
 
 
   bool compare_keywords(const DCKeywordList &other) const;
   bool compare_keywords(const DCKeywordList &other) const;
 
 
@@ -45,14 +45,14 @@ public:
   bool add_keyword(const DCKeyword *keyword);
   bool add_keyword(const DCKeyword *keyword);
   void clear_keywords();
   void clear_keywords();
 
 
-  void output_keywords(ostream &out) const;
+  void output_keywords(std::ostream &out) const;
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
 
 
 private:
 private:
   typedef pvector<const DCKeyword *> Keywords;
   typedef pvector<const DCKeyword *> Keywords;
   Keywords _keywords;
   Keywords _keywords;
 
 
-  typedef pmap<string, const DCKeyword *> KeywordsByName;
+  typedef pmap<std::string, const DCKeyword *> KeywordsByName;
   KeywordsByName _keywords_by_name;
   KeywordsByName _keywords_by_name;
 
 
   int _flags;
   int _flags;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 165 - 143
direct/src/dcparser/dcLexer.cxx.prebuilt


+ 47 - 43
direct/src/dcparser/dcLexer.lxx

@@ -1,7 +1,7 @@
 /*
 /*
 // Filename: dcLexer.lxx
 // Filename: dcLexer.lxx
 // Created by:  drose (05Oct00)
 // Created by:  drose (05Oct00)
-// 
+//
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 */
 */
 
 
@@ -35,11 +35,11 @@ static int error_count = 0;
 static int warning_count = 0;
 static int warning_count = 0;
 
 
 // This is the pointer to the current input stream.
 // This is the pointer to the current input stream.
-static istream *input_p = NULL;
+static std::istream *input_p = nullptr;
 
 
 // This is the name of the dc file we're parsing.  We keep it so we
 // This is the name of the dc file we're parsing.  We keep it so we
 // can print it out for error messages.
 // can print it out for error messages.
-static string dc_filename;
+static std::string dc_filename;
 
 
 // This is the initial token state returned by the lexer.  It allows
 // This is the initial token state returned by the lexer.  It allows
 // the yacc grammar to start from initial points.
 // the yacc grammar to start from initial points.
@@ -51,7 +51,7 @@ static int initial_token;
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
 void
 void
-dc_init_lexer(istream &in, const string &filename) {
+dc_init_lexer(std::istream &in, const std::string &filename) {
   input_p = &in;
   input_p = &in;
   dc_filename = filename;
   dc_filename = filename;
   line_number = 0;
   line_number = 0;
@@ -96,30 +96,34 @@ dcyywrap(void) {
 }
 }
 
 
 void
 void
-dcyyerror(const string &msg) {
+dcyyerror(const std::string &msg) {
+  using std::cerr;
+
   cerr << "\nError";
   cerr << "\nError";
   if (!dc_filename.empty()) {
   if (!dc_filename.empty()) {
     cerr << " in " << dc_filename;
     cerr << " in " << dc_filename;
   }
   }
-  cerr 
+  cerr
     << " at line " << line_number << ", column " << col_number << ":\n"
     << " at line " << line_number << ", column " << col_number << ":\n"
     << current_line << "\n";
     << current_line << "\n";
-  indent(cerr, col_number-1) 
+  indent(cerr, col_number-1)
     << "^\n" << msg << "\n\n";
     << "^\n" << msg << "\n\n";
-  
+
   error_count++;
   error_count++;
 }
 }
 
 
 void
 void
-dcyywarning(const string &msg) {
+dcyywarning(const std::string &msg) {
+  using std::cerr;
+
   cerr << "\nWarning";
   cerr << "\nWarning";
   if (!dc_filename.empty()) {
   if (!dc_filename.empty()) {
     cerr << " in " << dc_filename;
     cerr << " in " << dc_filename;
   }
   }
-  cerr 
+  cerr
     << " at line " << line_number << ", column " << col_number << ":\n"
     << " at line " << line_number << ", column " << col_number << ":\n"
     << current_line << "\n";
     << current_line << "\n";
-  indent(cerr, col_number-1) 
+  indent(cerr, col_number-1)
     << "^\n" << msg << "\n\n";
     << "^\n" << msg << "\n\n";
 
 
   warning_count++;
   warning_count++;
@@ -129,7 +133,7 @@ dcyywarning(const string &msg) {
 // stdio FILE pointer.  This is flex-specific.
 // stdio FILE pointer.  This is flex-specific.
 static void
 static void
 input_chars(char *buffer, int &result, int max_size) {
 input_chars(char *buffer, int &result, int max_size) {
-  nassertv(input_p != NULL);
+  nassertv(input_p != nullptr);
   if (*input_p) {
   if (*input_p) {
     input_p->read(buffer, max_size);
     input_p->read(buffer, max_size);
     result = input_p->gcount();
     result = input_p->gcount();
@@ -150,7 +154,7 @@ input_chars(char *buffer, int &result, int max_size) {
 
 
       // Truncate it at the newline.
       // Truncate it at the newline.
       char *end = strchr(current_line, '\n');
       char *end = strchr(current_line, '\n');
-      if (end != NULL) {
+      if (end != nullptr) {
         *end = '\0';
         *end = '\0';
       }
       }
     }
     }
@@ -165,7 +169,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }
@@ -187,9 +191,9 @@ read_char(int &line, int &col) {
 
 
 // scan_quoted_string reads a string delimited by quotation marks and
 // scan_quoted_string reads a string delimited by quotation marks and
 // returns it.
 // returns it.
-static string
+static std::string
 scan_quoted_string(char quote_mark) {
 scan_quoted_string(char quote_mark) {
-  string result;
+  std::string result;
 
 
   // We don't touch the current line number and column number during
   // We don't touch the current line number and column number during
   // scanning, so that if we detect an error while scanning the string
   // scanning, so that if we detect an error while scanning the string
@@ -309,9 +313,9 @@ scan_quoted_string(char quote_mark) {
 
 
 // scan_hex_string reads a string of hexadecimal digits delimited by
 // scan_hex_string reads a string of hexadecimal digits delimited by
 // angle brackets and returns the representative string.
 // angle brackets and returns the representative string.
-static string
+static vector_uchar
 scan_hex_string() {
 scan_hex_string() {
-  string result;
+  vector_uchar result;
 
 
   // We don't touch the current line number and column number during
   // We don't touch the current line number and column number during
   // scanning, so that if we detect an error while scanning the string
   // scanning, so that if we detect an error while scanning the string
@@ -341,24 +345,24 @@ scan_hex_string() {
       line_number = line;
       line_number = line;
       col_number = col;
       col_number = col;
       dcyyerror("Invalid hex digit.");
       dcyyerror("Invalid hex digit.");
-      return string();
+      return vector_uchar();
     }
     }
 
 
     odd = !odd;
     odd = !odd;
     if (odd) {
     if (odd) {
       last = value;
       last = value;
     } else {
     } else {
-      result += (char)((last << 4) | value);
+      result.push_back((unsigned char)((last << 4) | value));
     }
     }
     c = read_char(line, col);
     c = read_char(line, col);
   }
   }
 
 
   if (c == EOF) {
   if (c == EOF) {
     dcyyerror("This hex string is unterminated.");
     dcyyerror("This hex string is unterminated.");
-    return string();
+    return vector_uchar();
   } else if (odd) {
   } else if (odd) {
     dcyyerror("Odd number of hex digits.");
     dcyyerror("Odd number of hex digits.");
-    return string();
+    return vector_uchar();
   }
   }
 
 
   line_number = line;
   line_number = line;
@@ -378,7 +382,7 @@ eat_c_comment() {
   int col = col_number;
   int col = col_number;
 
 
   int c, last_c;
   int c, last_c;
-  
+
   last_c = '\0';
   last_c = '\0';
   c = read_char(line, col);
   c = read_char(line, col);
   while (c != EOF && !(last_c == '*' && c == '/')) {
   while (c != EOF && !(last_c == '*' && c == '/')) {
@@ -436,12 +440,12 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   yyless(1);
   yyless(1);
 }
 }
 
 
-[ \t\r] { 
+[ \t\r] {
   // Eat whitespace.
   // Eat whitespace.
   accept();
   accept();
 }
 }
 
 
-"//".* { 
+"//".* {
   // Eat C++-style comments.
   // Eat C++-style comments.
   accept();
   accept();
 }
 }
@@ -449,7 +453,7 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
 "/*" {
 "/*" {
   // Eat C-style comments.
   // Eat C-style comments.
   accept();
   accept();
-  eat_c_comment(); 
+  eat_c_comment();
 }
 }
 
 
 
 
@@ -603,7 +607,7 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   return KW_CHAR;
   return KW_CHAR;
 }
 }
 
 
-{UNSIGNED_INTEGERNUM} { 
+{UNSIGNED_INTEGERNUM} {
   // An unsigned integer number.
   // An unsigned integer number.
   accept();
   accept();
 
 
@@ -622,11 +626,11 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
     dcyylval.u.uint64 = next_value + (*p - '0');
     dcyylval.u.uint64 = next_value + (*p - '0');
     ++p;
     ++p;
   }
   }
-  
+
   return UNSIGNED_INTEGER;
   return UNSIGNED_INTEGER;
 }
 }
 
 
-{SIGNED_INTEGERNUM} { 
+{SIGNED_INTEGERNUM} {
   // A signed integer number.
   // A signed integer number.
   accept();
   accept();
 
 
@@ -667,14 +671,14 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
     }
     }
-  }    
-  
+  }
+
   return SIGNED_INTEGER;
   return SIGNED_INTEGER;
 }
 }
 
 
 {UNSIGNED_HEXNUM} {
 {UNSIGNED_HEXNUM} {
   // A hexadecimal integer number.
   // A hexadecimal integer number.
-  accept(); 
+  accept();
 
 
   // As above, we'll decode the hex string by hand.
   // As above, we'll decode the hex string by hand.
   dcyylval.str = dcyytext;
   dcyylval.str = dcyytext;
@@ -696,15 +700,15 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
     ++p;
     ++p;
   }
   }
 
 
-  return UNSIGNED_INTEGER; 
+  return UNSIGNED_INTEGER;
 }
 }
 
 
-{REALNUM} { 
+{REALNUM} {
   // A floating-point number.
   // A floating-point number.
-  accept(); 
-  dcyylval.u.real = patof(dcyytext); 
+  accept();
+  dcyylval.u.real = patof(dcyytext);
   dcyylval.str = dcyytext;
   dcyylval.str = dcyytext;
-  return REAL; 
+  return REAL;
 }
 }
 
 
 ["] {
 ["] {
@@ -724,18 +728,18 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
 [<] {
 [<] {
   // Long hex string.
   // Long hex string.
   accept();
   accept();
-  dcyylval.str = scan_hex_string();
+  dcyylval.bytes = scan_hex_string();
   return HEX_STRING;
   return HEX_STRING;
 }
 }
 
 
-[A-Za-z_][A-Za-z_0-9]* { 
+[A-Za-z_][A-Za-z_0-9]* {
   // Identifier or keyword.
   // Identifier or keyword.
   accept();
   accept();
   dcyylval.str = dcyytext;
   dcyylval.str = dcyytext;
 
 
-  if (dc_file != (DCFile *)NULL) {
+  if (dc_file != nullptr) {
     const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str);
     const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str);
-    if (keyword != (DCKeyword *)NULL) {
+    if (keyword != nullptr) {
       dcyylval.u.keyword = keyword;
       dcyylval.u.keyword = keyword;
       return KEYWORD;
       return KEYWORD;
     }
     }
@@ -746,7 +750,7 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
 
 
 . {
 . {
   // Send any other printable character as itself.
   // Send any other printable character as itself.
-  accept(); 
+  accept();
   return dcyytext[0];
   return dcyytext[0];
 }
 }
-  
+

+ 3 - 3
direct/src/dcparser/dcLexerDefs.h

@@ -16,14 +16,14 @@
 
 
 #include "dcbase.h"
 #include "dcbase.h"
 
 
-void dc_init_lexer(istream &in, const string &filename);
+void dc_init_lexer(std::istream &in, const std::string &filename);
 void dc_start_parameter_value();
 void dc_start_parameter_value();
 void dc_start_parameter_description();
 void dc_start_parameter_description();
 int dc_error_count();
 int dc_error_count();
 int dc_warning_count();
 int dc_warning_count();
 
 
-void dcyyerror(const string &msg);
-void dcyywarning(const string &msg);
+void dcyyerror(const std::string &msg);
+void dcyywarning(const std::string &msg);
 
 
 int dcyylex();
 int dcyylex();
 
 

+ 5 - 5
direct/src/dcparser/dcMolecularField.cxx

@@ -22,7 +22,7 @@
  *
  *
  */
  */
 DCMolecularField::
 DCMolecularField::
-DCMolecularField(const string &name, DCClass *dclass) : DCField(name, dclass) {
+DCMolecularField(const std::string &name, DCClass *dclass) : DCField(name, dclass) {
   _got_keywords = false;
   _got_keywords = false;
 }
 }
 
 
@@ -59,7 +59,7 @@ get_num_atomics() const {
  */
  */
 DCAtomicField *DCMolecularField::
 DCAtomicField *DCMolecularField::
 get_atomic(int n) const {
 get_atomic(int n) const {
-  nassertr(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 
@@ -109,7 +109,7 @@ add_atomic(DCAtomicField *atomic) {
  *
  *
  */
  */
 void DCMolecularField::
 void DCMolecularField::
-output(ostream &out, bool brief) const {
+output(std::ostream &out, bool brief) const {
   out << _name;
   out << _name;
 
 
   if (!_fields.empty()) {
   if (!_fields.empty()) {
@@ -130,7 +130,7 @@ output(ostream &out, bool brief) const {
  * stream.
  * stream.
  */
  */
 void DCMolecularField::
 void DCMolecularField::
-write(ostream &out, bool brief, int indent_level) const {
+write(std::ostream &out, bool brief, int indent_level) const {
   indent(out, indent_level);
   indent(out, indent_level);
   output(out, brief);
   output(out, brief);
   if (!brief) {
   if (!brief) {
@@ -161,7 +161,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 DCPackerInterface *DCMolecularField::
 DCPackerInterface *DCMolecularField::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_nested_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_nested_fields.size(), nullptr);
   return _nested_fields[n];
   return _nested_fields[n];
 }
 }
 
 

+ 4 - 4
direct/src/dcparser/dcMolecularField.h

@@ -25,9 +25,9 @@ class DCParameter;
  * This represents a combination of two or more related atomic fields, that
  * This represents a combination of two or more related atomic fields, that
  * will often be treated as a unit.
  * will often be treated as a unit.
  */
  */
-class DCMolecularField : public DCField {
+class EXPCL_DIRECT_DCPARSER DCMolecularField : public DCField {
 public:
 public:
-  DCMolecularField(const string &name, DCClass *dclass);
+  DCMolecularField(const std::string &name, DCClass *dclass);
 
 
 PUBLISHED:
 PUBLISHED:
   virtual DCMolecularField *as_molecular_field();
   virtual DCMolecularField *as_molecular_field();
@@ -39,8 +39,8 @@ PUBLISHED:
 public:
 public:
   void add_atomic(DCAtomicField *atomic);
   void add_atomic(DCAtomicField *atomic);
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;

+ 20 - 20
direct/src/dcparser/dcNumericRange.I

@@ -52,13 +52,13 @@ operator = (const DCNumericRange<NUM> &copy) {
  * otherwise.
  * otherwise.
  */
  */
 template <class NUM>
 template <class NUM>
-bool DCNumericRange<NUM>::
+INLINE bool DCNumericRange<NUM>::
 is_in_range(Number num) const {
 is_in_range(Number num) const {
   if (_ranges.empty()) {
   if (_ranges.empty()) {
     return true;
     return true;
   }
   }
 
 
-  TYPENAME Ranges::const_iterator ri;
+  typename Ranges::const_iterator ri;
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
     if (num >= (*ri)._min && num <= (*ri)._max) {
     if (num >= (*ri)._min && num <= (*ri)._max) {
       return true;
       return true;
@@ -96,7 +96,7 @@ has_one_value() const {
  * by the numeric range.
  * by the numeric range.
  */
  */
 template <class NUM>
 template <class NUM>
-INLINE TYPENAME DCNumericRange<NUM>::Number DCNumericRange<NUM>::
+INLINE typename DCNumericRange<NUM>::Number DCNumericRange<NUM>::
 get_one_value() const {
 get_one_value() const {
   nassertr(has_one_value(), 0);
   nassertr(has_one_value(), 0);
   return _ranges[0]._min;
   return _ranges[0]._min;
@@ -106,11 +106,11 @@ get_one_value() const {
  *
  *
  */
  */
 template <class NUM>
 template <class NUM>
-void DCNumericRange<NUM>::
+INLINE void DCNumericRange<NUM>::
 generate_hash(HashGenerator &hashgen) const {
 generate_hash(HashGenerator &hashgen) const {
   if (!_ranges.empty()) {
   if (!_ranges.empty()) {
     hashgen.add_int(_ranges.size());
     hashgen.add_int(_ranges.size());
-    TYPENAME Ranges::const_iterator ri;
+    typename Ranges::const_iterator ri;
     for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
     for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
       // We don't account for the fractional part of floating-point ranges
       // We don't account for the fractional part of floating-point ranges
       // here.  Shouldn't be a real issue.
       // here.  Shouldn't be a real issue.
@@ -124,10 +124,10 @@ generate_hash(HashGenerator &hashgen) const {
  *
  *
  */
  */
 template <class NUM>
 template <class NUM>
-void DCNumericRange<NUM>::
-output(ostream &out, Number divisor) const {
+INLINE void DCNumericRange<NUM>::
+output(std::ostream &out, Number divisor) const {
   if (!_ranges.empty()) {
   if (!_ranges.empty()) {
-    TYPENAME Ranges::const_iterator ri;
+    typename Ranges::const_iterator ri;
     ri = _ranges.begin();
     ri = _ranges.begin();
     output_minmax(out, divisor, *ri);
     output_minmax(out, divisor, *ri);
     ++ri;
     ++ri;
@@ -144,14 +144,14 @@ output(ostream &out, Number divisor) const {
  * characters.
  * characters.
  */
  */
 template <class NUM>
 template <class NUM>
-void DCNumericRange<NUM>::
-output_char(ostream &out, Number divisor) const {
+INLINE void DCNumericRange<NUM>::
+output_char(std::ostream &out, Number divisor) const {
   if (divisor != 1) {
   if (divisor != 1) {
     output(out, divisor);
     output(out, divisor);
 
 
   } else {
   } else {
     if (!_ranges.empty()) {
     if (!_ranges.empty()) {
-      TYPENAME Ranges::const_iterator ri;
+      typename Ranges::const_iterator ri;
       ri = _ranges.begin();
       ri = _ranges.begin();
       output_minmax_char(out, *ri);
       output_minmax_char(out, *ri);
       ++ri;
       ++ri;
@@ -179,7 +179,7 @@ clear() {
  * minmax overlaps an existing minmax.
  * minmax overlaps an existing minmax.
  */
  */
 template <class NUM>
 template <class NUM>
-bool DCNumericRange<NUM>::
+INLINE bool DCNumericRange<NUM>::
 add_range(Number min, Number max) {
 add_range(Number min, Number max) {
   // Check for an overlap.  This is probably indicative of a typo and should
   // Check for an overlap.  This is probably indicative of a typo and should
   // be reported.
   // be reported.
@@ -187,7 +187,7 @@ add_range(Number min, Number max) {
     return false;
     return false;
   }
   }
 
 
-  TYPENAME Ranges::const_iterator ri;
+  typename Ranges::const_iterator ri;
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
     if ((min >= (*ri)._min && min <= (*ri)._max) ||
     if ((min >= (*ri)._min && min <= (*ri)._max) ||
         (max >= (*ri)._min && max <= (*ri)._max) ||
         (max >= (*ri)._min && max <= (*ri)._max) ||
@@ -227,7 +227,7 @@ get_num_ranges() const {
  * Returns the minimum value defined by the nth component.
  * Returns the minimum value defined by the nth component.
  */
  */
 template <class NUM>
 template <class NUM>
-INLINE TYPENAME DCNumericRange<NUM>::Number DCNumericRange<NUM>::
+INLINE typename DCNumericRange<NUM>::Number DCNumericRange<NUM>::
 get_min(int n) const {
 get_min(int n) const {
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   return _ranges[n]._min;
   return _ranges[n]._min;
@@ -237,7 +237,7 @@ get_min(int n) const {
  * Returns the maximum value defined by the nth component.
  * Returns the maximum value defined by the nth component.
  */
  */
 template <class NUM>
 template <class NUM>
-INLINE TYPENAME DCNumericRange<NUM>::Number DCNumericRange<NUM>::
+INLINE typename DCNumericRange<NUM>::Number DCNumericRange<NUM>::
 get_max(int n) const {
 get_max(int n) const {
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   return _ranges[n]._max;
   return _ranges[n]._max;
@@ -248,7 +248,7 @@ get_max(int n) const {
  */
  */
 template <class NUM>
 template <class NUM>
 INLINE void DCNumericRange<NUM>::
 INLINE void DCNumericRange<NUM>::
-output_minmax(ostream &out, Number divisor, const MinMax &range) const {
+output_minmax(std::ostream &out, Number divisor, const MinMax &range) const {
   if (divisor == 1) {
   if (divisor == 1) {
     if (range._min == range._max) {
     if (range._min == range._max) {
       out << range._min;
       out << range._min;
@@ -271,12 +271,12 @@ output_minmax(ostream &out, Number divisor, const MinMax &range) const {
  */
  */
 template <class NUM>
 template <class NUM>
 INLINE void DCNumericRange<NUM>::
 INLINE void DCNumericRange<NUM>::
-output_minmax_char(ostream &out, const MinMax &range) const {
+output_minmax_char(std::ostream &out, const MinMax &range) const {
   if (range._min == range._max) {
   if (range._min == range._max) {
-    DCPacker::enquote_string(out, '\'', string(1, range._min));
+    DCPacker::enquote_string(out, '\'', std::string(1, range._min));
   } else {
   } else {
-    DCPacker::enquote_string(out, '\'', string(1, range._min));
+    DCPacker::enquote_string(out, '\'', std::string(1, range._min));
     out << "-";
     out << "-";
-    DCPacker::enquote_string(out, '\'', string(1, range._max));
+    DCPacker::enquote_string(out, '\'', std::string(1, range._max));
   }
   }
 }
 }

+ 8 - 8
direct/src/dcparser/dcNumericRange.h

@@ -23,7 +23,7 @@
  * to constrain simple numeric types, as well as array sizes.
  * to constrain simple numeric types, as well as array sizes.
  */
  */
 template <class NUM>
 template <class NUM>
-class DCNumericRange {
+class EXPCL_DIRECT_DCPARSER DCNumericRange {
 public:
 public:
   typedef NUM Number;
   typedef NUM Number;
 
 
@@ -32,20 +32,20 @@ public:
   INLINE DCNumericRange(const DCNumericRange &copy);
   INLINE DCNumericRange(const DCNumericRange &copy);
   INLINE void operator = (const DCNumericRange &copy);
   INLINE void operator = (const DCNumericRange &copy);
 
 
-  bool is_in_range(Number num) const;
+  INLINE bool is_in_range(Number num) const;
   INLINE void validate(Number num, bool &range_error) const;
   INLINE void validate(Number num, bool &range_error) const;
 
 
   INLINE bool has_one_value() const;
   INLINE bool has_one_value() const;
   INLINE Number get_one_value() const;
   INLINE Number get_one_value() const;
 
 
-  void generate_hash(HashGenerator &hashgen) const;
+  INLINE void generate_hash(HashGenerator &hashgen) const;
 
 
-  void output(ostream &out, Number divisor = 1) const;
-  void output_char(ostream &out, Number divisor = 1) const;
+  INLINE void output(std::ostream &out, Number divisor = 1) const;
+  INLINE void output_char(std::ostream &out, Number divisor = 1) const;
 
 
 public:
 public:
   INLINE void clear();
   INLINE void clear();
-  bool add_range(Number min, Number max);
+  INLINE bool add_range(Number min, Number max);
 
 
   INLINE bool is_empty() const;
   INLINE bool is_empty() const;
   INLINE int get_num_ranges() const;
   INLINE int get_num_ranges() const;
@@ -60,8 +60,8 @@ private:
     Number _min;
     Number _min;
     Number _max;
     Number _max;
   };
   };
-  INLINE void output_minmax(ostream &out, Number divisor, const MinMax &range) const;
-  INLINE void output_minmax_char(ostream &out, const MinMax &range) const;
+  INLINE void output_minmax(std::ostream &out, Number divisor, const MinMax &range) const;
+  INLINE void output_minmax_char(std::ostream &out, const MinMax &range) const;
 
 
   typedef pvector<MinMax> Ranges;
   typedef pvector<MinMax> Ranges;
   Ranges _ranges;
   Ranges _ranges;

+ 6 - 6
direct/src/dcparser/dcPackData.I

@@ -16,7 +16,7 @@
  */
  */
 INLINE DCPackData::
 INLINE DCPackData::
 DCPackData() {
 DCPackData() {
-  _buffer = NULL;
+  _buffer = nullptr;
   _allocated_size = 0;
   _allocated_size = 0;
   _used_length = 0;
   _used_length = 0;
 }
 }
@@ -26,7 +26,7 @@ DCPackData() {
  */
  */
 INLINE DCPackData::
 INLINE DCPackData::
 ~DCPackData() {
 ~DCPackData() {
-  if (_buffer != (const char *)NULL) {
+  if (_buffer != nullptr) {
     delete[] _buffer;
     delete[] _buffer;
   }
   }
 }
 }
@@ -82,16 +82,16 @@ rewrite_data(size_t position, const char *buffer, size_t size) {
  */
  */
 INLINE char *DCPackData::
 INLINE char *DCPackData::
 get_rewrite_pointer(size_t position, size_t size) {
 get_rewrite_pointer(size_t position, size_t size) {
-  nassertr(position + size <= _used_length, NULL);
+  nassertr(position + size <= _used_length, nullptr);
   return _buffer + position;
   return _buffer + position;
 }
 }
 
 
 /**
 /**
  * Returns the data buffer as a string.  Also see get_data().
  * Returns the data buffer as a string.  Also see get_data().
  */
  */
-INLINE string DCPackData::
+INLINE std::string DCPackData::
 get_string() const {
 get_string() const {
-  return string(_buffer, _used_length);
+  return std::string(_buffer, _used_length);
 }
 }
 
 
 /**
 /**
@@ -129,7 +129,7 @@ INLINE char *DCPackData::
 take_data() {
 take_data() {
   char *data = _buffer;
   char *data = _buffer;
 
 
-  _buffer = NULL;
+  _buffer = nullptr;
   _allocated_size = 0;
   _allocated_size = 0;
   _used_length = 0;
   _used_length = 0;
 
 

+ 1 - 1
direct/src/dcparser/dcPackData.cxx

@@ -27,7 +27,7 @@ set_used_length(size_t size) {
     if (_used_length > 0) {
     if (_used_length > 0) {
       memcpy(new_buf, _buffer, _used_length);
       memcpy(new_buf, _buffer, _used_length);
     }
     }
-    if (_buffer != NULL) {
+    if (_buffer != nullptr) {
       delete[] _buffer;
       delete[] _buffer;
     }
     }
     _buffer = new_buf;
     _buffer = new_buf;

+ 2 - 2
direct/src/dcparser/dcPackData.h

@@ -19,7 +19,7 @@
 /**
 /**
  * This is a block of data that receives the results of DCPacker.
  * This is a block of data that receives the results of DCPacker.
  */
  */
-class DCPackData {
+class EXPCL_DIRECT_DCPARSER DCPackData {
 PUBLISHED:
 PUBLISHED:
   INLINE DCPackData();
   INLINE DCPackData();
   INLINE ~DCPackData();
   INLINE ~DCPackData();
@@ -34,7 +34,7 @@ public:
   INLINE char *get_rewrite_pointer(size_t position, size_t size);
   INLINE char *get_rewrite_pointer(size_t position, size_t size);
 
 
 PUBLISHED:
 PUBLISHED:
-  INLINE string get_string() const;
+  INLINE std::string get_string() const;
   INLINE size_t get_length() const;
   INLINE size_t get_length() const;
 public:
 public:
   INLINE const char *get_data() const;
   INLINE const char *get_data() const;

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно