Ver código fonte

Merge branch 'master' into input-overhaul

rdb 9 anos atrás
pai
commit
6689e69822
100 arquivos alterados com 3229 adições e 3134 exclusões
  1. 162 258
      contrib/src/ai/aiBehaviors.cxx
  2. 12 28
      contrib/src/ai/aiBehaviors.h
  3. 10 12
      contrib/src/ai/aiCharacter.cxx
  4. 11 13
      contrib/src/ai/aiCharacter.h
  5. 2 4
      contrib/src/ai/aiGlobals.h
  6. 59 94
      contrib/src/ai/aiPathFinder.cxx
  7. 10 13
      contrib/src/ai/aiPathFinder.h
  8. 46 73
      contrib/src/ai/aiWorld.cxx
  9. 17 35
      contrib/src/ai/aiWorld.h
  10. 17 24
      contrib/src/ai/arrival.cxx
  11. 3 4
      contrib/src/ai/arrival.h
  12. 17 24
      contrib/src/ai/evade.cxx
  13. 3 5
      contrib/src/ai/evade.h
  14. 17 24
      contrib/src/ai/flee.cxx
  15. 3 5
      contrib/src/ai/flee.h
  16. 7 11
      contrib/src/ai/flock.cxx
  17. 7 11
      contrib/src/ai/flock.h
  18. 5 8
      contrib/src/ai/meshNode.cxx
  19. 11 10
      contrib/src/ai/meshNode.h
  20. 40 43
      contrib/src/ai/obstacleAvoidance.cxx
  21. 6 7
      contrib/src/ai/obstacleAvoidance.h
  22. 58 93
      contrib/src/ai/pathFind.cxx
  23. 12 14
      contrib/src/ai/pathFind.h
  24. 19 31
      contrib/src/ai/pathFollow.cxx
  25. 18 19
      contrib/src/ai/pursue.cxx
  26. 3 4
      contrib/src/ai/pursue.h
  27. 9 13
      contrib/src/ai/seek.cxx
  28. 3 4
      contrib/src/ai/seek.h
  29. 16 25
      contrib/src/ai/wander.cxx
  30. 3 4
      contrib/src/ai/wander.h
  31. 14 3
      direct/src/actor/Actor.py
  32. 53 53
      direct/src/dcparser/dcClass.cxx
  33. 12 12
      direct/src/dcparser/dcDeclaration.cxx
  34. 8 8
      direct/src/dcparser/dcField.I
  35. 6 6
      direct/src/dcparser/dcKeyword.cxx
  36. 18 18
      direct/src/dcparser/dcSwitch.cxx
  37. 2 2
      direct/src/dcparser/dcSwitchParameter.h
  38. 5 5
      direct/src/dcparser/dcTypedef.cxx
  39. 2 0
      direct/src/directbase/DirectStart.py
  40. 2 2
      direct/src/directbase/ppython.cxx
  41. 45 42
      direct/src/directd/directd.h
  42. 4 2
      direct/src/directdServer/directdClient.h
  43. 11 8
      direct/src/directdServer/directdServer.h
  44. 486 355
      direct/src/directscripts/Doxyfile.cxx
  45. 3 1
      direct/src/directutil/Verify.py
  46. 1 0
      direct/src/distributed/DistributedSmoothNodeBase.py
  47. 1 1
      direct/src/gui/DirectDialog.py
  48. 8 2
      direct/src/gui/DirectEntry.py
  49. 0 8
      direct/src/gui/DirectGuiBase.py
  50. 3 0
      direct/src/gui/DirectGuiGlobals.py
  51. 1 1
      direct/src/gui/DirectWaitBar.py
  52. 61 19
      direct/src/gui/OnscreenText.py
  53. 9 3
      direct/src/interval/Interval.py
  54. 0 7
      direct/src/interval/ProjectileInterval.py
  55. 14 0
      direct/src/interval/cInterval.h
  56. 52 52
      direct/src/motiontrail/cMotionTrail.cxx
  57. 1 1
      direct/src/motiontrail/config_motiontrail.h
  58. 10 10
      direct/src/plugin/find_root_dir_assist.mm
  59. 12 12
      direct/src/plugin/p3dAuthSession.cxx
  60. 1 1
      direct/src/plugin/p3dAuthSession.h
  61. 1 1
      direct/src/plugin/p3dCert_strings.cxx
  62. 1 1
      direct/src/plugin/p3dCert_wx.cxx
  63. 1 1
      direct/src/plugin/p3dCert_wx.h
  64. 45 45
      direct/src/plugin_activex/P3DActiveX.cpp
  65. 4 4
      direct/src/plugin_activex/P3DActiveX.h
  66. 21 21
      direct/src/plugin_activex/P3DActiveXCtrl.cpp
  67. 2 2
      direct/src/plugin_activex/P3DActiveXPropPage.cpp
  68. 17 15
      direct/src/showbase/BufferViewer.py
  69. 4 10
      direct/src/showbase/EventManager.py
  70. 3 3
      direct/src/showbase/ExceptionVarDump.py
  71. 3 3
      direct/src/showbase/GarbageReport.py
  72. 26 8
      direct/src/showbase/Loader.py
  73. 2 7
      direct/src/showbase/ObjectPool.py
  74. 9 7
      direct/src/showbase/OnScreenDebug.py
  75. 431 494
      direct/src/showbase/PythonUtil.py
  76. 147 61
      direct/src/showbase/ShowBase.py
  77. 9 8
      direct/src/showbase/Transitions.py
  78. 2 2
      direct/src/showutil/FreezeTool.py
  79. 7 0
      direct/src/stdpy/thread.py
  80. 106 105
      direct/src/stdpy/threading.py
  81. 86 93
      direct/src/stdpy/threading2.py
  82. 20 13
      direct/src/task/Task.py
  83. 3 3
      dtool/metalibs/dtool/dtool.cxx
  84. 20 0
      dtool/src/cppparser/cppArrayType.cxx
  85. 3 1
      dtool/src/cppparser/cppArrayType.h
  86. 666 667
      dtool/src/cppparser/cppBison.cxx.prebuilt
  87. 9 1
      dtool/src/cppparser/cppBison.yxx
  88. 1 1
      dtool/src/cppparser/cppClassTemplateParameter.h
  89. 1 1
      dtool/src/cppparser/cppCommentBlock.h
  90. 20 0
      dtool/src/cppparser/cppConstType.cxx
  91. 3 1
      dtool/src/cppparser/cppConstType.h
  92. 1 1
      dtool/src/cppparser/cppDeclaration.h
  93. 1 1
      dtool/src/cppparser/cppEnumType.h
  94. 67 1
      dtool/src/cppparser/cppExpression.cxx
  95. 10 1
      dtool/src/cppparser/cppExpression.h
  96. 1 1
      dtool/src/cppparser/cppExpressionParser.h
  97. 20 0
      dtool/src/cppparser/cppExtensionType.cxx
  98. 3 1
      dtool/src/cppparser/cppExtensionType.h
  99. 1 1
      dtool/src/cppparser/cppFile.h
  100. 1 1
      dtool/src/cppparser/cppFunctionGroup.h

+ 162 - 258
contrib/src/ai/aiBehaviors.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : aiBehaviors.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  8 Sep 09
+// Filename: aiBehaviors.cxx
+// Created by: Deepak, John, Navin (08Sep09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -48,15 +47,12 @@ AIBehaviors::~AIBehaviors() {
 
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : is_conflict
-// Description : Checks for conflict between steering forces.
-//                If there is a conflict it returns 'true' and sets _conflict to 'true'.
-//                If there is no conflict it returns 'false' and sets _conflict to 'false'.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: is_conflict
+//  Description: Checks for conflict between steering forces.
+//               If there is a conflict it returns 'true' and sets _conflict to 'true'.
+//               If there is no conflict it returns 'false' and sets _conflict to 'false'.
+////////////////////////////////////////////////////////////////////
 bool AIBehaviors::is_conflict() {
   int value = int(is_on(_seek)) + int(is_on(_flee)) + int(is_on(_pursue)) + int(is_on(_evade)) + int(is_on(_wander)) + int(is_on(_flock))+ int(is_on(_obstacle_avoidance));
 
@@ -102,14 +98,12 @@ bool AIBehaviors::is_conflict() {
   return false;
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : accumulate_force
-// Description : This function updates the individual steering forces for each of the ai characters.
-//                These accumulated forces are eventually what comprise the resultant
-//                steering force of the character.
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+//     Function: accumulate_force
+//  Description: This function updates the individual steering forces for each of the ai characters.
+//               These accumulated forces are eventually what comprise the resultant
+//               steering force of the character.
+////////////////////////////////////////////////////////////////////
 
 void AIBehaviors::accumulate_force(string force_type, LVecBase3 force) {
 
@@ -159,15 +153,13 @@ void AIBehaviors::accumulate_force(string force_type, LVecBase3 force) {
 
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : calculate_prioritized
-// Description : This function updates the main steering force for the ai character using
-//                the accumulate function and checks for max force and arrival force.
-//                It finally returns this steering force which is accessed by the update
-//                function in the AICharacter class.
-
-//////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+//     Function: calculate_prioritized
+//  Description: This function updates the main steering force for the ai character using
+//               the accumulate function and checks for max force and arrival force.
+//               It finally returns this steering force which is accessed by the update
+//               function in the AICharacter class.
+////////////////////////////////////////////////////////////////////
 
 LVecBase3 AIBehaviors::calculate_prioritized() {
   LVecBase3 force;
@@ -313,14 +305,10 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
   return _steering_force;
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : remove_ai
-// Description : This function removes individual or all the AIs.
-
-/////////////////////////////////////////////////////////////////////////////////
-
-//add for path follow
+////////////////////////////////////////////////////////////////////
+//     Function: remove_ai
+//  Description: This function removes individual or all the AIs.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::remove_ai(string ai_type) {
   switch(char_to_int(ai_type)) {
     case 0: {
@@ -434,14 +422,10 @@ void AIBehaviors::remove_ai(string ai_type) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : pause_ai
-// Description : This function pauses individual or all the AIs.
-
-/////////////////////////////////////////////////////////////////////////////////
-
-//add for path follow
+////////////////////////////////////////////////////////////////////
+//     Function: pause_ai
+//  Description: This function pauses individual or all the AIs.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::pause_ai(string ai_type) {
   switch(char_to_int(ai_type)) {
     case 0: {
@@ -537,13 +521,10 @@ void AIBehaviors::pause_ai(string ai_type) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : resume_ai
-// Description : This function resumes individual or all the AIs
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: resume_ai
+//  Description: This function resumes individual or all the AIs
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::resume_ai(string ai_type) {
   switch(char_to_int(ai_type)) {
     case 0: {
@@ -634,15 +615,12 @@ void AIBehaviors::resume_ai(string ai_type) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : seek
-// Description : This function activates seek and makes an object of the Seek class.
-//                This is the function we want the user to call for seek to be done.
-//                This function is overloaded to accept a NodePath or an LVecBase3.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: seek
+//  Description: This function activates seek and makes an object of the Seek class.
+//               This is the function we want the user to call for seek to be done.
+//               This function is overloaded to accept a NodePath or an LVecBase3.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::seek(NodePath target_object, float seek_wt) {
   _seek_obj = new Seek(_ai_char, target_object, seek_wt);
   turn_on("seek");
@@ -653,14 +631,11 @@ void AIBehaviors::seek(LVecBase3 pos, float seek_wt) {
   turn_on("seek");
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : flee
-// Description : This function activates flee_activate and creates an object of the Flee class.
-//                This function is overloaded to accept a NodePath or an LVecBase3.
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: flee
+//  Description: This function activates flee_activate and creates an object of the Flee class.
+//               This function is overloaded to accept a NodePath or an LVecBase3.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::flee(NodePath target_object, double panic_distance, double relax_distance, float flee_wt) {
   _flee_obj = new Flee(_ai_char, target_object, panic_distance, relax_distance, flee_wt);
   _flee_list.insert(_flee_list.end(), *_flee_obj);
@@ -675,27 +650,21 @@ void AIBehaviors::flee(LVecBase3 pos, double panic_distance, double relax_distan
   turn_on("flee_activate");
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : pursue
-// Description : This function activates pursue.
-//                This is the function we want the user to call for pursue to be done.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: pursue
+//  Description: This function activates pursue.
+//               This is the function we want the user to call for pursue to be done.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::pursue(NodePath target_object, float pursue_wt) {
   _pursue_obj = new Pursue(_ai_char, target_object, pursue_wt);
 
   turn_on("pursue");
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : evade
-// Description : This function activates evade_activate.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: evade
+//  Description: This function activates evade_activate.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::evade(NodePath target_object, double panic_distance, double relax_distance, float evade_wt) {
   _evade_obj = new Evade(_ai_char, target_object, panic_distance, relax_distance, evade_wt);
   _evade_list.insert(_evade_list.end(), *_evade_obj);
@@ -703,14 +672,11 @@ void AIBehaviors::evade(NodePath target_object, double panic_distance, double re
   turn_on("evade_activate");
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : arrival
-// Description : This function activates arrival.
-//                This is the function we want the user to call for arrival to be done.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: arrival
+//  Description: This function activates arrival.
+//               This is the function we want the user to call for arrival to be done.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::arrival(double distance) {
   if(_pursue_obj) {
     _arrival_obj = new Arrival(_ai_char, distance);
@@ -727,14 +693,11 @@ void AIBehaviors::arrival(double distance) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : flock
-// Description : This function activates flock.
-//                This is the function we want the user to call for flock to be done.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: flock
+//  Description: This function activates flock.
+//               This is the function we want the user to call for flock to be done.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::flock(float flock_wt) {
   _flock_weight = flock_wt;
 
@@ -742,14 +705,11 @@ void AIBehaviors::flock(float flock_wt) {
   turn_on("flock_activate");
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : flock_activate
-// Description : This function checks whether any other behavior exists to work with flock.
-//                When this is true, it calls the do_flock function.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: flock_activate
+//  Description: This function checks whether any other behavior exists to work with flock.
+//               When this is true, it calls the do_flock function.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::flock_activate() {
   if(is_on(_seek) || is_on(_flee) || is_on(_pursue) || is_on(_evade) || is_on(_wander)) {
       turn_off("flock_activate");
@@ -757,18 +717,15 @@ void AIBehaviors::flock_activate() {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_flock
-// Description : This function contains the logic for flocking behavior. This is
-//                an emergent behavior and is obtained by combining three other
-//                behaviors which are separation, cohesion and alignment based on
-//                Craig Reynold's algorithm. Also, this behavior does not work by
-//                itself. It works only when combined with other steering behaviors
-//                such as wander, pursue, evade, seek and flee.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: do_flock
+//  Description: This function contains the logic for flocking behavior. This is
+//               an emergent behavior and is obtained by combining three other
+//               behaviors which are separation, cohesion and alignment based on
+//               Craig Reynold's algorithm. Also, this behavior does not work by
+//               itself. It works only when combined with other steering behaviors
+//               such as wander, pursue, evade, seek and flee.
+////////////////////////////////////////////////////////////////////
 LVecBase3 AIBehaviors::do_flock() {
 
   //! Initialize variables required to compute the flocking force on the ai char.
@@ -839,141 +796,109 @@ LVecBase3 AIBehaviors::do_flock() {
     + cohesion_force * _flock_group->_cohesion_wt);
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : wander
-// Description : This function activates wander.
+////////////////////////////////////////////////////////////////////
+//     Function: wander
+//  Description: This function activates wander.
 //               This is the function we want the user to call for flock to be done.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::wander(double wander_radius, int flag, double aoe, float wander_weight) {
   _wander_obj = new Wander(_ai_char, wander_radius, flag, aoe, wander_weight);
   turn_on("wander");
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : obstacle avoidance
-// Description : This function activates obstacle avoidance for a given character.
+////////////////////////////////////////////////////////////////////
+//     Function: obstacle avoidance
+//  Description: This function activates obstacle avoidance for a given character.
 //               This is the function we want the user to call for
 //               obstacle avoidance to be performed.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::obstacle_avoidance(float obstacle_avoidance_weight) {
   _obstacle_avoidance_obj = new ObstacleAvoidance(_ai_char, obstacle_avoidance_weight);
   turn_on("obstacle_avoidance_activate");
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : path_follow
-// Description : This function activates path following.
-//                This is the function we want the user to call for path following.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: path_follow
+//  Description: This function activates path following.
+//               This is the function we want the user to call for path following.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::path_follow(float follow_wt) {
   _path_follow_obj = new PathFollow(_ai_char, follow_wt);
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_to_path
-// Description : This function adds positions to the path to follow.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_to_path
+//  Description: This function adds positions to the path to follow.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::add_to_path(LVecBase3 pos) {
   _path_follow_obj->add_to_path(pos);
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : start_follow
-// Description : This function starts the path follower.
-
-/////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+//     Function: start_follow
+//  Description: This function starts the path follower.
+////////////////////////////////////////////////////////////////////
 
 void AIBehaviors::start_follow(string type) {
   _path_follow_obj->start(type);
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : init_path_find
-// Description : This function activates path finding in the character.
-//                This function accepts the meshdata in .csv format.
+////////////////////////////////////////////////////////////////////
+//     Function: init_path_find
+//  Description: This function activates path finding in the character.
+//               This function accepts the meshdata in .csv format.
 //
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::init_path_find(const char* navmesh_filename) {
   _path_find_obj = new PathFind(_ai_char);
   _path_find_obj->set_path_find(navmesh_filename);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : path_find_to (for pathfinding towards a  static position)
-// Description : This function checks for the source and target in the navigation mesh
-//                for its availability and then finds the best path via the A* algorithm
-//                Then it calls the path follower to make the object follow the path.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: path_find_to (for pathfinding towards a  static position)
+//  Description: This function checks for the source and target in the navigation mesh
+//               for its availability and then finds the best path via the A* algorithm
+//               Then it calls the path follower to make the object follow the path.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::path_find_to(LVecBase3 pos, string type) {
   _path_find_obj->path_find(pos, type);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : path_find_to (for pathfinding towards a moving target (a NodePath))
-// Description : This function checks for the source and target in the navigation mesh
-//                for its availability and then finds the best path via the A* algorithm
-//                Then it calls the path follower to make the object follow the path.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: path_find_to (for pathfinding towards a moving target (a NodePath))
+//  Description: This function checks for the source and target in the navigation mesh
+//               for its availability and then finds the best path via the A* algorithm
+//               Then it calls the path follower to make the object follow the path.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::path_find_to(NodePath target, string type) {
   _path_find_obj->path_find(target, type);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_static_obstacle
-// Description : This function allows the user to dynamically add obstacles to the
-//                game environment. The function will update the nodes within the
-//                bounding volume of the obstacle as non-traversable. Hence will not be
-//                considered by the pathfinding algorithm.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_static_obstacle
+//  Description: This function allows the user to dynamically add obstacles to the
+//               game environment. The function will update the nodes within the
+//               bounding volume of the obstacle as non-traversable. Hence will not be
+//               considered by the pathfinding algorithm.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::add_static_obstacle(NodePath obstacle) {
   _path_find_obj->add_obstacle_to_mesh(obstacle);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_dynamic_obstacle
-// Description : This function starts the pathfinding obstacle navigation for the
-//                passed in obstacle.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_dynamic_obstacle
+//  Description: This function starts the pathfinding obstacle navigation for the
+//               passed in obstacle.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::add_dynamic_obstacle(NodePath obstacle) {
   _path_find_obj->dynamic_avoid(obstacle);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : behavior_status
-// Description : This function returns the status of an AI Type whether it is active,
-//                paused or disabled. It returns -1 if an invalid string is passed.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: behavior_status
+//  Description: This function returns the status of an AI Type whether it is active,
+//               paused or disabled. It returns -1 if an invalid string is passed.
+////////////////////////////////////////////////////////////////////
 string AIBehaviors::behavior_status(string ai_type) {
   switch(char_to_int(ai_type)) {
     case 1:
@@ -1188,14 +1113,11 @@ string AIBehaviors::behavior_status(string ai_type) {
     }
   }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : char_to_int
-// Description : This function is used to derive int values from the ai types strings.
-//                Returns -1 if an invalid string is passed.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: char_to_int
+//  Description: This function is used to derive int values from the ai types strings.
+//               Returns -1 if an invalid string is passed.
+////////////////////////////////////////////////////////////////////
 int AIBehaviors::char_to_int(string ai_type) {
   if(ai_type == "all") {
     return 0;
@@ -1252,13 +1174,10 @@ int AIBehaviors::char_to_int(string ai_type) {
   return -1;
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : turn_on
-// Description : This function turns on any aiBehavior which is passed as a string.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: turn_on
+//  Description: This function turns on any aiBehavior which is passed as a string.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::turn_on(string ai_type) {
   switch(char_to_int(ai_type)) {
     case 1:  {
@@ -1318,13 +1237,10 @@ void AIBehaviors::turn_on(string ai_type) {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : turn_off
-// Description : This function turns off any aiBehavior which is passed as a string.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: turn_off
+//  Description: This function turns off any aiBehavior which is passed as a string.
+////////////////////////////////////////////////////////////////////
 void AIBehaviors::turn_off(string ai_type) {
 switch(char_to_int(ai_type)) {
     case 1:  {
@@ -1426,24 +1342,18 @@ switch(char_to_int(ai_type)) {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : is_on
-// Description : This function returns true if an aiBehavior is on
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: is_on
+//  Description: This function returns true if an aiBehavior is on
+////////////////////////////////////////////////////////////////////
 bool AIBehaviors::is_on(_behavior_type bt)  {
   return (_behaviors_flags & bt) == bt;
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : is_on
-// Description : This function returns true if pathfollow or pathfinding is on
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: is_on
+//  Description: This function returns true if pathfollow or pathfinding is on
+////////////////////////////////////////////////////////////////////
 bool AIBehaviors::is_on(string ai_type) {
   if(ai_type == "pathfollow") {
     if(_path_follow_obj) {
@@ -1466,24 +1376,18 @@ bool AIBehaviors::is_on(string ai_type) {
   return false;
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : is_off
-// Description : This function returns true if an aiBehavior is off
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: is_off
+//  Description: This function returns true if an aiBehavior is off
+////////////////////////////////////////////////////////////////////
 bool AIBehaviors::is_off(_behavior_type bt)  {
   return ((_behaviors_flags | bt) == bt);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : is_off
-// Description : This function returns true if pathfollow or pathfinding is off
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: is_off
+//  Description: This function returns true if pathfollow or pathfinding is off
+////////////////////////////////////////////////////////////////////
 bool AIBehaviors::is_off(string ai_type) {
   if(ai_type == "pathfollow") {
     if(_path_follow_obj && _path_follow_obj->_start) {

+ 12 - 28
contrib/src/ai/aiBehaviors.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : aiBehaviors.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  8 Sep 09
+// Filename: aiBehaviors.h
+// Created by: Deepak, John, Navin (08Sep09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -22,18 +21,6 @@
 
 #include "aiGlobals.h"
 
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Class : AIBehaviors
-// Description : This class implements all the steering behaviors of the AI framework, such as
-//                seek, flee, pursue, evade, wander and flock. Each steering behavior has a weight which is used when more than
-//                one type of steering behavior is acting on the same ai character. The weight decides the contribution of each
-//                type of steering behavior. The AICharacter class has a handle to an object of this class and this allows to
-//                invoke the steering behaviors via the AICharacter. This class also provides functionality such as pausing, resuming
-//                and removing the AI behaviors of an AI character at anytime.
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 class AICharacter;
 class Seek;
 class Flee;
@@ -49,8 +36,16 @@ class ObstacleAvoidance;
 typedef list<Flee, allocator<Flee> > ListFlee;
 typedef list<Evade, allocator<Evade> > ListEvade;
 
+////////////////////////////////////////////////////////////////////
+//       Class : AIBehaviors
+// Description : This class implements all the steering behaviors of the AI framework, such as
+//               seek, flee, pursue, evade, wander and flock. Each steering behavior has a weight which is used when more than
+//               one type of steering behavior is acting on the same ai character. The weight decides the contribution of each
+//               type of steering behavior. The AICharacter class has a handle to an object of this class and this allows to
+//               invoke the steering behaviors via the AICharacter. This class also provides functionality such as pausing, resuming
+//               and removing the AI behaviors of an AI character at anytime.
+////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAAI AIBehaviors {
-
 public:
   enum _behavior_type {
       _none = 0x00000,
@@ -174,14 +169,3 @@ PUBLISHED:
 };
 
 #endif
-
-
-
-
-
-
-
-
-
-
-

+ 10 - 12
contrib/src/ai/aiCharacter.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    :  aiCharacter.cxx
-// Created by  :  Deepak, John, Navin
-// Date        :  8 Sep 09
+// Filename: aiCharacter.cxx
+// Created by: Deepak, John, Navin (08Sep09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -35,14 +34,13 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
 AICharacter::~AICharacter() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : update
-// Description : Each character's update will update its ai and physics
-//                based on his resultant steering force.
-//                This also makes the character  look at the direction of the force.
-
-/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+//     Function: update
+//  Description: Each character's update will update its AI and
+//               physics based on his resultant steering force.
+//               This also makes the character look in the direction
+//               of the force.
+////////////////////////////////////////////////////////////////////
 void AICharacter::
 update() {
   if (!_steering->is_off(_steering->_none)) {

+ 11 - 13
contrib/src/ai/aiCharacter.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : aiCharacter.h
-// Created by  : Deepak, John, Navin
-// Date        :  8 Sep 09
+// Filename: aiCharacter.h
+// Created by: Deepak, John, Navin (08Sep09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -23,15 +22,14 @@
 
 #include "aiBehaviors.h"
 
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Class : AICharacter
-//  Description : This class is used for creating the ai characters. It assigns both physics and ai
-//                attributes to the character. It also has an update function which updates the physics and ai
-//                of the character. This update function is called by the AIWorld update.
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//       Class : AICharacter
+// Description : This class is used for creating the AI characters.
+//               It assigns both physics and AI attributes to the
+//               character.  It also has an update function which
+//               updates the physics and AI of the character.
+//               This update function is called by the AIWorld update.
+////////////////////////////////////////////////////////////////////
 class AIBehaviors;
 class AIWorld;
 

+ 2 - 4
contrib/src/ai/aiGlobals.h

@@ -1,7 +1,5 @@
-////////////////////////////////////////////////////////////////////////
-// Filename :    aiGlobals.h
-// Created by :  Deepak, John, Navin
-// Date:          8 Sep 09
+// Filename: aiGlobals.h
+// Created by: Deepak, John, Navin (08Sep09)
 //
 ////////////////////////////////////////////////////////////////////
 //

+ 59 - 94
contrib/src/ai/aiPathFinder.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    :  aiPathFinder.cxx
-// Created by  :  Deepak, John, Navin
-// Date        :  10 Nov 09
+// Filename: aiPathFinder.cxx
+// Created by: Deepak, John, Navin (10Nov09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -22,14 +21,11 @@ PathFinder::PathFinder(NavMesh nav_mesh) {
 PathFinder::~PathFinder() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : find_path
-// Description : This function initializes the pathfinding process by accepting the
+////////////////////////////////////////////////////////////////////
+//     Function: find_path
+//  Description: This function initializes the pathfinding process by accepting the
 //               source and destination nodes. It then calls the generate_path().
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void PathFinder::find_path(Node *src_node, Node *dest_node) {
   _src_node = src_node;
   _dest_node = dest_node;
@@ -48,14 +44,11 @@ void PathFinder::find_path(Node *src_node, Node *dest_node) {
   generate_path();
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : generate_path
-// Description : This function performs the pathfinding process using the A* algorithm.
+////////////////////////////////////////////////////////////////////
+//     Function: generate_path
+//  Description: This function performs the pathfinding process using the A* algorithm.
 //               It updates the openlist and closelist.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void PathFinder::generate_path() {
   // All the A* algorithm is implemented here.
   // The check is > 1 due to the existence of the dummy node.
@@ -87,14 +80,11 @@ void PathFinder::generate_path() {
   _closed_list.clear();
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : identify_neighbors
-// Description : This function traverses through the 8 neigbors of the parent node and
+////////////////////////////////////////////////////////////////////
+//     Function: identify_neighbors
+//  Description: This function traverses through the 8 neigbors of the parent node and
 //               then adds the neighbors to the _open_list based on A* criteria.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void PathFinder::identify_neighbors(Node *parent_node) {
   // Remove the parent node from the open_list so that it is not considered
   // while adding new nodes to the open list heap.
@@ -114,30 +104,25 @@ void PathFinder::identify_neighbors(Node *parent_node) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : calc_node_score
-// Description : This function calculates the score of each node.
+////////////////////////////////////////////////////////////////////
+//     Function: calc_node_score
+//  Description: This function calculates the score of each node.
 //               Score = Cost + Heuristics.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void PathFinder::calc_node_score(Node *nd) {
   nd->_cost = calc_cost_frm_src(nd);
   nd->_heuristic = calc_heuristic(nd);
   nd->_score = nd->_cost + nd->_heuristic;
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : calc_cost_frm_src
-// Description : This function calculates the cost of each node by finding out
-// the number of node traversals required to reach the source node.
-// Diagonal traversals have cost = 14.
-// Horizontal / Vertical traversals have cost = 10.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: calc_cost_frm_src
+//  Description: This function calculates the cost of each node by
+//               finding out the number of node traversals required
+//               to reach the source node.  Diagonal traversals have
+//               cost = 14.  Horizontal and vertical traversals have
+//               cost = 10.
+////////////////////////////////////////////////////////////////////
 int PathFinder::calc_cost_frm_src(Node *nd) {
   int cost = 0;
   Node *start_node = nd;
@@ -160,15 +145,14 @@ int PathFinder::calc_cost_frm_src(Node *nd) {
   return cost;
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : calc_heuristic
-// Description : This function calculates the heuristic of the nodes using Manhattan method.
-// All it does is predict the number of node traversals required to reach the target node.
-// No diagonal traversals are allowed in this technique.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: calc_heuristic
+//  Description: This function calculates the heuristic of the nodes
+//               using Manhattan method.  All it does is predict the
+//               number of node traversals required to reach the
+//               target node.  No diagonal traversals are allowed in
+//               this technique.
+////////////////////////////////////////////////////////////////////
 int PathFinder::calc_heuristic(Node *nd) {
   int row_diff = abs(_dest_node->_grid_x - nd->_grid_x);
   int col_diff = abs(_dest_node->_grid_y - nd->_grid_y);
@@ -177,13 +161,10 @@ int PathFinder::calc_heuristic(Node *nd) {
   return heuristic;
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : is_diagonal_node
-// Description : This function checks if the traversal from a node is diagonal.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: is_diagonal_node
+//  Description: This function checks if the traversal from a node is diagonal.
+////////////////////////////////////////////////////////////////////
 bool PathFinder::is_diagonal_node(Node *nd) {
   // Calculate the row and column differences between child and parent nodes.
   float row_diff = nd->_grid_x - nd->_prv_node->_grid_x;
@@ -198,15 +179,11 @@ bool PathFinder::is_diagonal_node(Node *nd) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_to_olist
-// Description : This function adds a node to the open list heap.
+////////////////////////////////////////////////////////////////////
+//     Function: add_to_olist
+//  Description: This function adds a node to the open list heap.
 //               A binay heap is maintained to improve the search.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-
+////////////////////////////////////////////////////////////////////
 void PathFinder::add_to_olist(Node *nd) {
   // Variables required to search the binary heap.
   Node *child_node, *parent_node;
@@ -245,14 +222,11 @@ void PathFinder::add_to_olist(Node *nd) {
   // At this point the Node with the smallest score will be at the top of the heap.
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : remove_from_olist
-// Description : This function removes a node from the open list.
+////////////////////////////////////////////////////////////////////
+//     Function: remove_from_olist
+//  Description: This function removes a node from the open list.
 //               During the removal the binary heap is maintained.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void PathFinder::remove_from_olist() {
   // Variables for maintaining the binary heap.
   Node *child_node, *child_node_1, *child_node_2;
@@ -340,13 +314,10 @@ void PathFinder::remove_from_olist() {
   // At this point the Node was succesfully removed and the binary heap re-arranged.
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_to_clist
-// Description : This function adds a node to the closed list.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_to_clist
+//  Description: This function adds a node to the closed list.
+////////////////////////////////////////////////////////////////////
 void PathFinder::add_to_clist(Node *nd) {
   // Set the status as closed.
   nd->_status = nd->close;
@@ -354,13 +325,10 @@ void PathFinder::add_to_clist(Node *nd) {
   _closed_list.push_back(nd);
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : remove_from_clist
-// Description : This function removes a node from the closed list.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: remove_from_clist
+//  Description: This function removes a node from the closed list.
+////////////////////////////////////////////////////////////////////
 void PathFinder::remove_from_clist(int r, int c) {
   for(unsigned int i = 0; i < _closed_list.size(); ++i) {
     if(_closed_list[i]->_grid_x == r && _closed_list[i]->_grid_y == c) {
@@ -370,15 +338,12 @@ void PathFinder::remove_from_clist(int r, int c) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : find_in_mesh
-// Description : This function allows the user to pass a position and it returns the
+////////////////////////////////////////////////////////////////////
+//     Function: find_in_mesh
+//  Description: This function allows the user to pass a position and it returns the
 //               corresponding node on the navigation mesh. A very useful function as
 //               it allows for dynamic updation of the mesh based on position.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size) {
   int size = grid_size;
   float x = pos[0];

+ 10 - 13
contrib/src/ai/aiPathFinder.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : aiPathFinder.h
-// Created by  : Deepak, John, Navin
-// Date        :  10 Nov 09
+// Filename: aiPathFinder.h
+// Created by: Deepak, John, Navin (10Nov09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -25,14 +24,13 @@ typedef vector<NodeArray> NavMesh;
 
 Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size);
 
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Class : PathFinder
-//  Description : This class implements pathfinding using A* algorithm. It also uses a Binary Heap search to
-//               search the open list. The heuristics are calculated using the manhattan method.
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//       Class : PathFinder
+// Description : This class implements pathfinding using A* algorithm.
+//               It also uses a Binary Heap search to search the
+//               open list.  The heuristics are calculated using
+//               the manhattan method.
+////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAAI PathFinder {
 public:
   Node *_src_node;
@@ -61,4 +59,3 @@ public:
 };
 
 #endif
-

+ 46 - 73
contrib/src/ai/aiWorld.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : aiWorld.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  8 Sep 09
+// Filename: aiWorld.cxx
+// Created by: Deepak, John, Navin (08Sep09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -56,13 +55,11 @@ void AIWorld::print_list() {
   _ai_char_pool->print_list();
 }
 
-////////////////////////////////////////////////////////////////////////
-// Function : update
-// Description : The AIWorld update function calls the update function of all the
-//                AI characters which have been added to the AIWorld.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: update
+//  Description: The AIWorld update function calls the update function of all the
+//               AI characters which have been added to the AIWorld.
+////////////////////////////////////////////////////////////////////
 void AIWorld::update() {
   AICharPool::node *ai_pool;
   ai_pool = _ai_char_pool->_head;
@@ -73,15 +70,12 @@ void AIWorld::update() {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_flock
-// Description : This function adds all the AI characters in the Flock object to
-//                the AICharPool. This function allows adding the AI characetrs as
-//                part of a flock.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_flock
+//  Description: This function adds all the AI characters in the Flock object to
+//               the AICharPool. This function allows adding the AI characetrs as
+//               part of a flock.
+////////////////////////////////////////////////////////////////////
 void AIWorld::add_flock(Flock *flock) {
   // Add all the ai_characters in the flock to the AIWorld.
   for(unsigned int i = 0; i < flock->_ai_char_list.size(); ++i) {
@@ -91,13 +85,10 @@ void AIWorld::add_flock(Flock *flock) {
   _flock_pool.push_back(flock);
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : get_flock
-// Description : This function returns a handle to the Flock whose id is passed.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: get_flock
+//  Description: This function returns a handle to the Flock whose id is passed.
+////////////////////////////////////////////////////////////////////
 Flock AIWorld::get_flock(unsigned int flock_id) {
   for(unsigned int i=0; i < _flock_pool.size(); ++i) {
     if(_flock_pool[i]->get_id() == flock_id) {
@@ -108,13 +99,10 @@ Flock AIWorld::get_flock(unsigned int flock_id) {
   return *null_flock;
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : remove_flock
-// Description : This function removes the flock behavior completely.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: remove_flock
+//  Description: This function removes the flock behavior completely.
+////////////////////////////////////////////////////////////////////
 void AIWorld::remove_flock(unsigned int flock_id) {
   for(unsigned int i = 0; i < _flock_pool.size(); ++i) {
     if(_flock_pool[i]->get_id() == flock_id) {
@@ -129,14 +117,11 @@ void AIWorld::remove_flock(unsigned int flock_id) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : flock_off
-// Description : This function turns off the flock behavior temporarily. Similar to
-//                pausing the behavior.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: flock_off
+//  Description: This function turns off the flock behavior temporarily. Similar to
+//               pausing the behavior.
+////////////////////////////////////////////////////////////////////
 void AIWorld::flock_off(unsigned int flock_id) {
   for(unsigned int i = 0; i < _flock_pool.size(); ++i) {
     if(_flock_pool[i]->get_id() == flock_id) {
@@ -149,13 +134,10 @@ void AIWorld::flock_off(unsigned int flock_id) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : flock_on
-// Description : This function turns on the flock behavior.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: flock_on
+//  Description: This function turns on the flock behavior.
+////////////////////////////////////////////////////////////////////
 void AIWorld::flock_on(unsigned int flock_id) {
   for(unsigned int i = 0; i < _flock_pool.size(); ++i) {
     if(_flock_pool[i]->get_id() == flock_id) {
@@ -234,14 +216,11 @@ void AICharPool::del(string name) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : print_list
-// Description : This function prints the ai characters in the AICharPool. Used for
-//                debugging purposes.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: print_list
+//  Description: This function prints the ai characters in the AICharPool. Used for
+//               debugging purposes.
+////////////////////////////////////////////////////////////////////
 void AICharPool::print_list() {
   node* q;
   q = _head;
@@ -251,26 +230,20 @@ void AICharPool::print_list() {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_obstacle
-// Description : This function adds the nodepath as an obstacle that is needed
-//                by the obstacle avoidance behavior.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_obstacle
+//  Description: This function adds the nodepath as an obstacle that is needed
+//               by the obstacle avoidance behavior.
+////////////////////////////////////////////////////////////////////
 void AIWorld::add_obstacle(NodePath obstacle) {
   _obstacles.push_back(obstacle);
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : remove_obstacle
-// Description : This function removes the nodepath from the obstacles list that is needed
-//                by the obstacle avoidance behavior.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: remove_obstacle
+//  Description: This function removes the nodepath from the obstacles list that is needed
+//               by the obstacle avoidance behavior.
+////////////////////////////////////////////////////////////////////
 void AIWorld::remove_obstacle(NodePath obstacle) {
   for(unsigned int i = 0; i <= _obstacles.size(); ++i) {
     if(_obstacles[i] == obstacle) {

+ 17 - 35
contrib/src/ai/aiWorld.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : aiWorld.h
-// Created by  : Deepak, John, Navin
-// Date        :  8 Sep 09
+// Filename: aiWorld.h
+// Created by: Deepak, John, Navin (08Sep09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -28,16 +27,12 @@
 class AICharacter;
 class Flock;
 
-///////////////////////////////////////////////////////////////////////
-//
-// Class : AICharPool
-//  Description : 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 : AICharPool
+// Description : 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 {
@@ -54,18 +49,14 @@ class EXPCL_PANDAAI AICharPool {
 };
 
 
-///////////////////////////////////////////////////////////////////////
-//
-// Class : AIWorld
-//  Description : 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, obstactle data and unique name for each
-//              character. It also updates each characters state. The AI characters
-//              can also be added to the world as flocks.
-
-////////////////////////////////////////////////////////////////////////
-
-
+////////////////////////////////////////////////////////////////////
+//       Class : AIWorld
+// Description : 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, obstactle data and unique name for each
+//               character. It also updates each characters state. The AI characters
+//               can also be added to the world as flocks.
+////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAAI AIWorld {
   private:
     AICharPool * _ai_char_pool;
@@ -97,12 +88,3 @@ PUBLISHED:
 };
 
 #endif
-
-
-
-
-
-
-
-
-

+ 17 - 24
contrib/src/ai/arrival.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : arrival.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: arrival.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -25,17 +24,14 @@ Arrival::Arrival(AICharacter *ai_ch, double distance) {
 Arrival::~Arrival() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_arrival
-// Description : This function performs the arrival and returns an arrival force which is used
-//                in the calculate_prioritized function.
-//                In case the steering force = 0, it resets to arrival_activate.
-//                The arrival behavior works only when seek or pursue is active.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: do_arrival
+//  Description: This function performs the arrival and returns an arrival force which is used
+//               in the calculate_prioritized function.
+//               In case the steering force = 0, it resets to arrival_activate.
+//               The arrival behavior works only when seek or pursue is active.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 LVecBase3 Arrival::do_arrival() {
   LVecBase3 direction_to_target;
   double distance;
@@ -88,15 +84,12 @@ LVecBase3 Arrival::do_arrival() {
   return(LVecBase3(0.0, 0.0, 0.0));
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : arrival_activate
-// Description : This function checks for whether the target is within the arrival distance.
-//                When this is true, it calls the do_arrival function and sets the arrival direction.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: arrival_activate
+//  Description: This function checks for whether the target is within the arrival distance.
+//               When this is true, it calls the do_arrival function and sets the arrival direction.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 void Arrival::arrival_activate() {
   LVecBase3 dirn;
   if(_arrival_type) {

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

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : arrival.h
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: arrival.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE

+ 17 - 24
contrib/src/ai/evade.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : evade.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: evade.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -31,17 +30,14 @@ Evade::Evade(AICharacter *ai_ch, NodePath target_object, double panic_distance,
 Evade::~Evade() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_evade
-// Description : This function performs the evade and returns an evade force which is used
-//                in the calculate_prioritized function.
-//                In case the AICharacter is past the (panic + relax) distance,
-//                it resets to evade_activate.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: do_evade
+//  Description: This function performs the evade and returns an evade force which is used
+//               in the calculate_prioritized function.
+//               In case the AICharacter is past the (panic + relax) distance,
+//               it resets to evade_activate.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 LVecBase3 Evade::do_evade() {
   assert(_evade_target && "evade target not assigned");
 
@@ -66,15 +62,12 @@ LVecBase3 Evade::do_evade() {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : evade_activate
-// Description : This function checks for whether the target is within the panic distance.
-//                When this is true, it calls the do_evade function and sets the evade direction.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: evade_activate
+//  Description: This function checks for whether the target is within the panic distance.
+//               When this is true, it calls the do_evade function and sets the evade direction.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 void Evade::evade_activate() {
     _evade_direction = (_ai_char->_ai_char_np.get_pos(_ai_char->_window_render) - _evade_target.get_pos(_ai_char->_window_render));
   double distance = _evade_direction.length();

+ 3 - 5
contrib/src/ai/evade.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : evade.h
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: evade.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -22,7 +21,6 @@
 class AICharacter;
 
 class EXPCL_PANDAAI Evade {
-
 public:
   AICharacter *_ai_char;
 

+ 17 - 24
contrib/src/ai/flee.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : flee.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: flee.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -46,17 +45,14 @@ Flee::Flee(AICharacter *ai_ch, LVecBase3 pos, double panic_distance,
 Flee::~Flee() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_flee
-// Description : This function performs the flee and returns a flee force which is used
-//                in the calculate_prioritized function.
-//                In case the AICharacter is past the (panic + relax) distance,
-//                it resets to flee_activate.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: do_flee
+//  Description: This function performs the flee and returns a flee force which is used
+//               in the calculate_prioritized function.
+//               In case the AICharacter is past the (panic + relax) distance,
+//               it resets to flee_activate.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 LVecBase3 Flee::do_flee() {
   LVecBase3 dirn;
   double distance;
@@ -80,15 +76,12 @@ LVecBase3 Flee::do_flee() {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : flee_activate
-// Description : This function checks for whether the target is within the panic distance.
-//                When this is true, it calls the do_flee function and sets the flee direction.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: flee_activate
+//  Description: This function checks for whether the target is within the panic distance.
+//               When this is true, it calls the do_flee function and sets the flee direction.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 void Flee::flee_activate() {
   LVecBase3 dirn;
   double distance;

+ 3 - 5
contrib/src/ai/flee.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : flee.h
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: flee.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -22,7 +21,6 @@
 class AICharacter;
 
 class EXPCL_PANDAAI Flee {
-
 public:
   AICharacter *_ai_char;
 

+ 7 - 11
contrib/src/ai/flock.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : flock.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  12 Oct 09
+// Filename: flock.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -28,13 +27,10 @@ Flock::Flock(unsigned int flock_id, double vcone_angle, double vcone_radius, uns
 Flock::~Flock() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_ai_char
-// Description : This function adds AI characters to the flock.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_ai_char
+//  Description: This function adds AI characters to the flock.
+////////////////////////////////////////////////////////////////////
 void Flock::add_ai_char(AICharacter *ai_char) {
   ai_char->_ai_char_flock_id = _flock_id;
   ai_char->_steering->_flock_group = this;

+ 7 - 11
contrib/src/ai/flock.h

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : flock.h
-// Created by  : Deepak, John, Navin
-// Date        :  12 Oct 09
+// Filename: flock.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -21,14 +20,11 @@
 
 class AICharacter;
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Class : Flock
+////////////////////////////////////////////////////////////////////
+//       Class : Flock
 // Description : This class is used to define the flock attributes and the AI characters
-//                which are part of the flock.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+//               which are part of the flock.
+////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAAI Flock {
 private:
   unsigned int _flock_id;

+ 5 - 8
contrib/src/ai/meshNode.cxx

@@ -24,14 +24,11 @@ Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 Node::~Node() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : contains
-// Description : This is a handy function which returns true if the passed position is
+////////////////////////////////////////////////////////////////////
+//     Function: contains
+//  Description: This is a handy function which returns true if the passed position is
 //               within the node's dimensions.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 bool Node::contains(float x, float y) {
   if(_position.get_x() - _width / 2 <= x && _position.get_x() + _width / 2 >= x &&
     _position.get_y() - _length / 2 <= y && _position.get_y() + _length / 2 >= y) {
@@ -40,4 +37,4 @@ bool Node::contains(float x, float y) {
   else {
     return false;
   }
-}
+}

+ 11 - 10
contrib/src/ai/meshNode.h

@@ -4,17 +4,18 @@
 
 #include "aiGlobals.h"
 
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+//       Class : Node
+// Description : This class is used to assign the nodes on the mesh.
+//               It holds all the data necessary to compute A*
+//               algorithm.  It also maintains a lot of vital
+//               information such as the neighbor nodes of each node
+//               and also its position on the mesh.
 //
-// Class : Node
-//  Description : This class is used to assign the nodes on the mesh. It holds all the data necessary to
-//               compute A* algorithm. It also maintains a lot of vital information such as the neighbor
-//               nodes of each node and also its position on the mesh.
-// Note: The Mesh Generator which is a stand alone tool makes use of this class to generate the nodes on the
-//       mesh.
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
+//               Note: The Mesh Generator which is a stand alone tool
+//               makes use of this class to generate the nodes on the
+//               mesh.
+////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAAI Node {
 public:
     // This variable specifies whether the node is an obtacle or not.

+ 40 - 43
contrib/src/ai/obstacleAvoidance.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : obstacleAvoidance.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  10 Nov 09
+// Filename: obstacleAvoidance.cxx
+// Created by: Deepak, John, Navin (10Nov09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -15,23 +14,23 @@
 
 #include "obstacleAvoidance.h"
 
-ObstacleAvoidance::ObstacleAvoidance(AICharacter *ai_char, float feeler_length) {
+ObstacleAvoidance::
+ObstacleAvoidance(AICharacter *ai_char, float feeler_length) {
   _ai_char = ai_char;
   _feeler = feeler_length;
 }
 
-ObstacleAvoidance::~ObstacleAvoidance() {
+ObstacleAvoidance::
+~ObstacleAvoidance() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : obstacle_detection
-// Description : This function checks if an obstacle is near to the AICharacter and
+////////////////////////////////////////////////////////////////////
+//     Function: obstacle_detection
+//  Description: This function checks if an obstacle is near to the AICharacter and
 //               if an obstacle is detected returns true
-
-/////////////////////////////////////////////////////////////////////////////////
-
-bool ObstacleAvoidance::obstacle_detection() {
+////////////////////////////////////////////////////////////////////
+bool ObstacleAvoidance::
+obstacle_detection() {
   // Calculate the volume of the AICharacter with respect to render
   PT(BoundingVolume) np_bounds = _ai_char->get_node_path().get_bounds();
   CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere();
@@ -51,46 +50,44 @@ bool ObstacleAvoidance::obstacle_detection() {
       expanded_radius = bsphere->get_radius() + np_sphere->get_radius();
     }
   }
-     LVecBase3 feeler = _feeler * _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward());
-     feeler.normalize();
-     feeler *= (expanded_radius + np_sphere->get_radius()) ;
-     to_obstacle = _nearest_obstacle.get_pos() - _ai_char->get_node_path().get_pos();
-     LVector3 line_vector = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward());
-     LVecBase3 project = (to_obstacle.dot(line_vector) * line_vector) / line_vector.length_squared();
-     LVecBase3 perp = project - to_obstacle;
-     // If the nearest obstacle will collide with our AICharacter then send obstacle detection as true
-     if((_nearest_obstacle) && (perp.length() < expanded_radius - np_sphere->get_radius()) && (project.length() < feeler.length())) {
-       return true;
-     }
-     return false;
-}
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : obstacle_avoidance_activate
-// Description : This function activates obstacle_avoidance if a obstacle
-//               is detected
+  LVecBase3 feeler = _feeler * _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward());
+  feeler.normalize();
+  feeler *= (expanded_radius + np_sphere->get_radius()) ;
+  to_obstacle = _nearest_obstacle.get_pos() - _ai_char->get_node_path().get_pos();
+  LVector3 line_vector = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward());
+  LVecBase3 project = (to_obstacle.dot(line_vector) * line_vector) / line_vector.length_squared();
+  LVecBase3 perp = project - to_obstacle;
 
-/////////////////////////////////////////////////////////////////////////////////
+  // If the nearest obstacle will collide with our AICharacter then send obstacle detection as true
+  if (_nearest_obstacle && (perp.length() < expanded_radius - np_sphere->get_radius()) && (project.length() < feeler.length())) {
+    return true;
+  }
+  return false;
+}
 
-void ObstacleAvoidance::obstacle_avoidance_activate() {
-  if(obstacle_detection()) {
+////////////////////////////////////////////////////////////////////
+//     Function: obstacle_avoidance_activate
+//  Description: This function activates obstacle_avoidance if a obstacle
+//               is detected
+////////////////////////////////////////////////////////////////////
+void ObstacleAvoidance::
+obstacle_avoidance_activate() {
+  if (obstacle_detection()) {
     _ai_char->_steering->turn_off("obstacle_avoidance_activate");
     _ai_char->_steering->turn_on("obstacle_avoidance");
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_obstacle_avoidance
-// Description : This function returns the force necessary by the AICharacter to
+////////////////////////////////////////////////////////////////////
+//     Function: do_obstacle_avoidance
+//  Description: This function returns the force necessary by the AICharacter to
 //               avoid the nearest obstacle detected by obstacle_detection
 //               function
 // NOTE : This assumes the obstacles are spherical
-
-/////////////////////////////////////////////////////////////////////////////////
-
-LVecBase3 ObstacleAvoidance::do_obstacle_avoidance() {
+////////////////////////////////////////////////////////////////////
+LVecBase3 ObstacleAvoidance::
+do_obstacle_avoidance() {
   LVecBase3 offset = _ai_char->get_node_path().get_pos() - _nearest_obstacle.get_pos();
   PT(BoundingVolume) bounds =_nearest_obstacle.get_bounds();
   CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere();

+ 6 - 7
contrib/src/ai/obstacleAvoidance.h

@@ -1,10 +1,6 @@
-#ifndef OBSTACLE_AVOIDANCE_H
-#define OBSTACLE_AVOIDANCE_H
-
-////////////////////////////////////////////////////////////////////////
-// Filename    : obstacleAvoidance.h
-// Created by  : Deepak, John, Navin
-// Date        :  10 Nov 2009
+// Filename: obstacleAvoidance.h
+// Created by: Deepak, John, Navin (10Nov09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -16,6 +12,9 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+#ifndef OBSTACLE_AVOIDANCE_H
+#define OBSTACLE_AVOIDANCE_H
+
 #include "aiCharacter.h"
 #include "boundingSphere.h"
 

+ 58 - 93
contrib/src/ai/pathFind.cxx

@@ -18,13 +18,10 @@ PathFind::PathFind(AICharacter *ai_ch) {
 PathFind::~PathFind() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : create_nav_mesh
-// Description : This function recreates the navigation mesh from the .csv file
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: create_nav_mesh
+//  Description: This function recreates the navigation mesh from the .csv file
+////////////////////////////////////////////////////////////////////
 void PathFind::create_nav_mesh(const char* navmesh_filename) {
   // Stage variables.
   int grid_x, grid_y;
@@ -96,14 +93,11 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : assign_neighbor_nodes
-// Description : This function assigns the neighbor nodes for each main node present in
-//                _nav_mesh.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: assign_neighbor_nodes
+//  Description: This function assigns the neighbor nodes for each
+//               main node present in _nav_mesh.
+////////////////////////////////////////////////////////////////////
 void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
   ifstream nav_mesh_file (navmesh_filename);
 
@@ -161,15 +155,11 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : set_path_find
-// Description : This function starts the path finding process after reading the given
-//                navigation mesh.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
-
+////////////////////////////////////////////////////////////////////
+//     Function: set_path_find
+//  Description: This function starts the path finding process after reading the given
+//               navigation mesh.
+////////////////////////////////////////////////////////////////////
 void PathFind::set_path_find(const char* navmesh_filename) {
   create_nav_mesh(navmesh_filename);
 
@@ -187,16 +177,12 @@ void PathFind::set_path_find(const char* navmesh_filename) {
   _path_finder_obj = new PathFinder(_nav_mesh);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : path_find (for pathfinding towards a  static position)
-// Description : This function checks for the source and target in the navigation mesh
-//                for its availability and then finds the best path via the A* algorithm
-//                Then it calls the path follower to make the object follow the path.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
-
+////////////////////////////////////////////////////////////////////
+//     Function: path_find (for pathfinding towards a  static position)
+//  Description: This function checks for the source and target in the navigation mesh
+//               for its availability and then finds the best path via the A* algorithm
+//               Then it calls the path follower to make the object follow the path.
+////////////////////////////////////////////////////////////////////
 void PathFind::path_find(LVecBase3 pos, string type) {
   if(type == "addPath") {
     if(_ai_char->_steering->_path_follow_obj) {
@@ -230,15 +216,12 @@ void PathFind::path_find(LVecBase3 pos, string type) {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : path_find (for pathfinding towards a moving target (a NodePath))
-// Description : This function checks for the source and target in the navigation mesh
-//                for its availability and then finds the best path via the A* algorithm
-//                Then it calls the path follower to make the object follow the path.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: path_find (for pathfinding towards a moving target (a NodePath))
+//  Description: This function checks for the source and target in the navigation mesh
+//               for its availability and then finds the best path via the A* algorithm
+//               Then it calls the path follower to make the object follow the path.
+////////////////////////////////////////////////////////////////////
 void PathFind::path_find(NodePath target, string type) {
   if(type == "addPath") {
     if(_ai_char->_steering->_path_follow_obj) {
@@ -277,13 +260,10 @@ void PathFind::path_find(NodePath target, string type) {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : clear_path
-// Description : Helper function to restore the path and mesh to its initial state
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: clear_path
+//  Description: Helper function to restore the path and mesh to its initial state
+////////////////////////////////////////////////////////////////////
 void PathFind::clear_path() {
   // Initialize to zero
   for(int i = 0; i < _grid_size; ++i) {
@@ -304,15 +284,12 @@ void PathFind::clear_path() {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : trace_path
-// Description : This function is the function which sends the path information one by
-//                one to the path follower so that it can store the path needed to be
-//                traversed by the pathfinding object
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: trace_path
+//  Description: This function is the function which sends the path information one by
+//               one to the path follower so that it can store the path needed to be
+//               traversed by the pathfinding object
+////////////////////////////////////////////////////////////////////
 void PathFind::trace_path(Node* src) {
     if(_ai_char->_pf_guide) {
       _parent->remove_all_children();
@@ -336,16 +313,13 @@ void PathFind::trace_path(Node* src) {
     }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_obstacle_to_mesh
-// Description : This function allows the user to dynamically add obstacles to the
-//                game environment. The function will update the nodes within the
-//                bounding volume of the obstacle as non-traversable. Hence will not be
-//                considered by the pathfinding algorithm.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: add_obstacle_to_mesh
+//  Description: This function allows the user to dynamically add obstacles to the
+//               game environment. The function will update the nodes within the
+//               bounding volume of the obstacle as non-traversable. Hence will not be
+//               considered by the pathfinding algorithm.
+////////////////////////////////////////////////////////////////////
 void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
   PT(BoundingVolume) np_bounds = obstacle.get_bounds();
   CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere();
@@ -373,14 +347,11 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_dynamic_avoid()
-// Description : This function does the updation of the collisions to the mesh based
-//                on the new positions of the obstacles.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: do_dynamic_avoid()
+//  Description: This function does the updation of the collisions to the mesh based
+//               on the new positions of the obstacles.
+////////////////////////////////////////////////////////////////////
 void PathFind::do_dynamic_avoid() {
   clear_previous_obstacles();
   _previous_obstacles.clear();
@@ -389,28 +360,22 @@ void PathFind::do_dynamic_avoid() {
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : clear_previous_obstacles()
-// Description : Helper function to reset the collisions if the obstacle is not on the
-//                node anymore
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: clear_previous_obstacles()
+//  Description: Helper function to reset the collisions if the obstacle is not on the
+//               node anymore
+////////////////////////////////////////////////////////////////////
 void PathFind::clear_previous_obstacles(){
   for(unsigned int i = 0; i < _previous_obstacles.size(); i = i + 2) {
       _nav_mesh[_previous_obstacles[i]][_previous_obstacles[i + 1]]->_type = true;
   }
 }
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : dynamic_avoid
-// Description : This function starts the pathfinding obstacle navigation for the
-//                passed in obstacle.
-
-///////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: dynamic_avoid
+//  Description: This function starts the pathfinding obstacle navigation for the
+//               passed in obstacle.
+////////////////////////////////////////////////////////////////////
 void PathFind::dynamic_avoid(NodePath obstacle) {
   _dynamic_avoid = true;
   _dynamic_obstacle.insert(_dynamic_obstacle.end(), obstacle);

+ 12 - 14
contrib/src/ai/pathFind.h

@@ -1,8 +1,6 @@
-
-////////////////////////////////////////////////////////////////////////
-// Filename    : pathFind.h
-// Created by  : Deepak, John, Navin
-// Date        :  12 Oct 09
+// Filename: pathFind.h
+// Created by: Deepak, John, Navin (12Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -24,15 +22,15 @@
 
 class AICharacter;
 
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Class : PathFind
-//  Description : This class contains all the members and functions that are required to form an interface between
-//                the AIBehaviors class and the PathFinder class. An object (pointer) of this class is provided in the
-//                AIBehaviors class. It is only via this object that the user can activate pathfinding.
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//       Class : PathFind
+// Description : This class contains all the members and functions
+//               that are required to form an interface between
+//               the AIBehaviors class and the PathFinder class.
+//               An object (pointer) of this class is provided in
+//               the AIBehaviors class.  It is only via this object
+//               that the user can activate pathfinding.
+////////////////////////////////////////////////////////////////////
 class EXPCL_PANDAAI PathFind {
 public:
   AICharacter *_ai_char;

+ 19 - 31
contrib/src/ai/pathFollow.cxx

@@ -12,25 +12,19 @@ PathFollow::PathFollow(AICharacter *ai_ch, float follow_wt) {
 PathFollow::~PathFollow() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : add_to_path
-// Description : This function adds the positions generated from a pathfind or a simple
+////////////////////////////////////////////////////////////////////
+//     Function: add_to_path
+//  Description: This function adds the positions generated from a pathfind or a simple
 //               path follow behavior to the _path list.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 void PathFollow::add_to_path(LVecBase3 pos) {
     _path.push_back(pos);
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : start
-// Description : This function initiates the path follow behavior.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: start
+//  Description: This function initiates the path follow behavior.
+////////////////////////////////////////////////////////////////////
 void PathFollow::start(string type) {
     _type = type;
   _start = true;
@@ -43,19 +37,16 @@ void PathFollow::start(string type) {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_follow
-// Description : This function allows continuous path finding by ai chars. There are 2
+////////////////////////////////////////////////////////////////////
+//     Function: do_follow
+//  Description: This function allows continuous path finding by ai chars. There are 2
 //               ways in which this is implemented.
 //               1. The character re-calculates the optimal path everytime the target
-//                  changes its position. Less computationally expensive.
+//               changes its position. Less computationally expensive.
 //               2. The character continuosly re-calculates its optimal path to the
-//                  target. This is used in a scenario where the ai chars have to avoid
-//                  other ai chars. More computationally expensive.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+//               target. This is used in a scenario where the ai chars have to avoid
+//               other ai chars. More computationally expensive.
+////////////////////////////////////////////////////////////////////
 void PathFollow::do_follow() {
   if((_myClock->get_real_time() - _time) > 0.5) {
       if(_type=="pathfind") {
@@ -109,14 +100,11 @@ void PathFollow::do_follow() {
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-//
-// Function : check_if_possible
-// Description : This function checks if the current positions of the ai char and the
+////////////////////////////////////////////////////////////////////
+//     Function: check_if_possible
+//  Description: This function checks if the current positions of the ai char and the
 //               target char can be used to generate an optimal path.
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 bool PathFollow::check_if_possible() {
   Node* src = find_in_mesh(_ai_char->_steering->_path_find_obj->_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _ai_char->_steering->_path_find_obj->_grid_size);
   LVecBase3 _prev_position = _ai_char->_steering->_path_find_obj->_path_find_target.get_pos(_ai_char->_window_render);

+ 18 - 19
contrib/src/ai/pursue.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : pursue.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: pursue.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -15,7 +14,8 @@
 
 #include "pursue.h"
 
-Pursue::Pursue(AICharacter *ai_ch, NodePath target_object, float pursue_wt) {
+Pursue::
+Pursue(AICharacter *ai_ch, NodePath target_object, float pursue_wt) {
   _ai_char = ai_ch;
 
   _pursue_target = target_object;
@@ -24,20 +24,19 @@ Pursue::Pursue(AICharacter *ai_ch, NodePath target_object, float pursue_wt) {
   _pursue_done = false;
 }
 
-Pursue::~Pursue() {
+Pursue::
+~Pursue() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_pursue
-// Description : This function performs the pursue and returns a pursue force which is used
-//                in the calculate_prioritized function.
-//                In case the target has been reached it resets the forces to 0 so that the character stops.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
-LVecBase3 Pursue::do_pursue() {
+////////////////////////////////////////////////////////////////////
+//     Function: do_pursue
+//  Description: This function performs the pursue and returns a pursue force which is used
+//               in the calculate_prioritized function.
+//               In case the target has been reached it resets the forces to 0 so that the character stops.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
+LVecBase3 Pursue::
+do_pursue() {
   assert(_pursue_target && "pursue target not assigned");
 
   LVecBase3 present_pos = _ai_char->_ai_char_np.get_pos(_ai_char->_window_render);
@@ -47,7 +46,7 @@ LVecBase3 Pursue::do_pursue() {
     _pursue_done = true;
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_pursue_force = LVecBase3(0.0, 0.0, 0.0);
-    return(LVecBase3(0.0, 0.0, 0.0));
+    return LVecBase3(0.0, 0.0, 0.0);
   }
   else {
     _pursue_done = false;
@@ -57,5 +56,5 @@ LVecBase3 Pursue::do_pursue() {
   _pursue_direction.normalize();
 
   LVecBase3 desired_force = _pursue_direction * _ai_char->_movt_force;
-  return(desired_force);
+  return desired_force;
 }

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

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : pursue.h
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: pursue.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE

+ 9 - 13
contrib/src/ai/seek.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : seek.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: seek.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -42,15 +41,12 @@ Seek::Seek(AICharacter *ai_ch, LVecBase3 pos, float seek_wt) {
 Seek::~Seek() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_seek
-// Description : This function performs the seek and returns a seek force which is used
-//                in the calculate_prioritized function.
-//                This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: do_seek
+//  Description: This function performs the seek and returns a seek force which is used
+//               in the calculate_prioritized function.
+//               This function is not to be used by the user.
+////////////////////////////////////////////////////////////////////
 LVecBase3 Seek::do_seek() {
   double target_distance = (_seek_position - _ai_char->_ai_char_np.get_pos(_ai_char->_window_render)).length();
 

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

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : seek.h
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: seek.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE

+ 16 - 25
contrib/src/ai/wander.cxx

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : wander.cxx
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: wander.cxx
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE
@@ -15,26 +14,20 @@
 
 #include "wander.h"
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : rand_float
-// Description : This function creates a random float point number
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
+//     Function: rand_float
+//  Description: This function creates a random float point number
+////////////////////////////////////////////////////////////////////
 double rand_float() {
   const static double rand_max = 0x7fff;
   return ((rand()) / (rand_max + 1.0));
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : random_clamped
-// Description : This function returns a random floating point number in the range
+////////////////////////////////////////////////////////////////////
+//     Function: random_clamped
+//  Description: This function returns a random floating point number in the range
 //               -1 to 1.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 double random_clamped() {
   return  (rand_float() - rand_float());
 }
@@ -82,15 +75,12 @@ Wander::Wander(AICharacter *ai_ch, double wander_radius,int flag, double aoe, fl
 Wander::~Wander() {
 }
 
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Function : do_wander
-// Description : This function performs the wander and returns the wander force which is used
+////////////////////////////////////////////////////////////////////
+//     Function: do_wander
+//  Description: This function performs the wander and returns the wander force which is used
 //               in the calculate_prioritized function.
 //               This function is not to be used by the user.
-
-/////////////////////////////////////////////////////////////////////////////////
-
+////////////////////////////////////////////////////////////////////
 LVecBase3 Wander::do_wander() {
   LVecBase3 present_pos = _ai_char->get_node_path().get_pos(_ai_char->get_char_render());
   // Create the random slices to enable random movement of wander for x,y,z respectively
@@ -123,6 +113,7 @@ LVecBase3 Wander::do_wander() {
   _wander_target *= _wander_radius;
   LVecBase3 target = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward());
   target.normalize();
+
   // Project wander target onto global space
   target = _wander_target + target;
   LVecBase3 desired_target = present_pos + target;

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

@@ -1,7 +1,6 @@
-////////////////////////////////////////////////////////////////////////
-// Filename    : wander.h
-// Created by  : Deepak, John, Navin
-// Date        :  24 Oct 09
+// Filename: wander.h
+// Created by: Deepak, John, Navin (24Oct09)
+//
 ////////////////////////////////////////////////////////////////////
 //
 // PANDA 3D SOFTWARE

+ 14 - 3
direct/src/actor/Actor.py

@@ -3,6 +3,7 @@
 __all__ = ['Actor']
 
 from panda3d.core import *
+from panda3d.core import Loader as PandaLoader
 from direct.showbase.DirectObject import DirectObject
 from direct.directnotify import DirectNotifyGlobal
 import types
@@ -160,6 +161,8 @@ class Actor(DirectObject, NodePath):
         # initialize our NodePath essence
         NodePath.__init__(self)
 
+        self.loader = PandaLoader.getGlobalPtr()
+
         # Set the mergeLODBundles flag.  If this is true, all
         # different LOD's will be merged into a single common bundle
         # (joint hierarchy).  All LOD's will thereafter share the same
@@ -1901,14 +1904,22 @@ class Actor(DirectObject, NodePath):
                 loaderOptions = LoaderOptions(loaderOptions)
                 loaderOptions.setFlags(loaderOptions.getFlags() & ~LoaderOptions.LFNoRamCache)
 
+            if okMissing is not None:
+                if okMissing:
+                    loaderOptions.setFlags(loaderOptions.getFlags() & ~LoaderOptions.LFReportErrors)
+                else:
+                    loaderOptions.setFlags(loaderOptions.getFlags() | LoaderOptions.LFReportErrors)
+
             # Pass loaderOptions to specify that we want to
             # get the skeleton model.  This only matters to model
             # files (like .mb) for which we can choose to extract
             # either the skeleton or animation, or neither.
-            model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing = okMissing)
+            model = self.loader.loadSync(Filename(modelPath), loaderOptions)
+            if model is not None:
+                model = NodePath(model)
 
         if (model == None):
-            raise StandardError, "Could not load Actor model %s" % (modelPath)
+            raise IOError("Could not load Actor model %s" % (modelPath))
 
         if (model.node().isOfType(Character.getClassType())):
             bundleNP = model
@@ -2370,7 +2381,7 @@ class Actor(DirectObject, NodePath):
             # operation that will complete in the background, but if so it
             # will still return a usable AnimControl.
             animControl = bundle.loadBindAnim(
-                loader.loader, Filename(anim.filename), -1,
+                self.loader, Filename(anim.filename), -1,
                 subpartDef.subset, allowAsyncBind and self.allowAsyncBind)
 
         if not animControl:

+ 53 - 53
direct/src/dcparser/dcClass.cxx

@@ -72,7 +72,7 @@ public:
 //  Description:
 ////////////////////////////////////////////////////////////////////
 DCClass::
-DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) : 
+DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
 #ifdef WITHIN_PANDA
   _class_update_pcollector(_update_pcollector, name),
   _class_generate_pcollector(_generate_pcollector, name),
@@ -116,7 +116,7 @@ DCClass::
 ////////////////////////////////////////////////////////////////////
 //     Function: DCClass::as_class
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCClass *DCClass::
 as_class() {
@@ -126,7 +126,7 @@ as_class() {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCClass::as_class
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 const DCClass *DCClass::
 as_class() const {
@@ -155,7 +155,7 @@ get_parent(int n) const {
   nassertr(n >= 0 && n < (int)_parents.size(), NULL);
   return _parents[n];
 }
-  
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DCClass::has_constructor
 //       Access: Published
@@ -166,7 +166,7 @@ bool DCClass::
 has_constructor() const {
   return (_constructor != (DCField *)NULL);
 }
-  
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DCClass::get_constructor
 //       Access: Published
@@ -284,7 +284,7 @@ get_field_by_index(int index_number) const {
 ////////////////////////////////////////////////////////////////////
 int DCClass::
 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->check_inherited_fields();
     if (_inherited_fields.empty()) {
@@ -303,7 +303,7 @@ get_num_inherited_fields() const {
     for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
       num_fields += (*pi)->get_num_inherited_fields();
     }
-    
+
     return num_fields;
   }
 }
@@ -312,7 +312,7 @@ get_num_inherited_fields() const {
 //     Function: DCClass::get_inherited_field
 //       Access: Published
 //  Description: Returns the nth field field in the class and all of
-//               its ancestors.  
+//               its ancestors.
 //
 //               This *used* to be the same thing as
 //               get_field_by_index(), back when the fields were
@@ -322,7 +322,7 @@ get_num_inherited_fields() const {
 ////////////////////////////////////////////////////////////////////
 DCField *DCClass::
 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->check_inherited_fields();
     if (_inherited_fields.empty()) {
@@ -338,18 +338,18 @@ get_inherited_field(int n) const {
       if (n < psize) {
         return (*pi)->get_inherited_field(n);
       }
-      
+
       n -= psize;
     }
-    
+
     return get_field(n);
   }
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCClass::inherits_from_bogus_class
-//       Access : Published
-//  Description : Returns true if this class, or any class in the
+//     Function: DCClass::inherits_from_bogus_class
+//       Access: Published
+//  Description: Returns true if this class, or any class in the
 //                inheritance heirarchy for this class, is a "bogus"
 //                class--a forward reference to an as-yet-undefined
 //                class.
@@ -371,10 +371,10 @@ inherits_from_bogus_class() const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCClass::output
-//       Access : Published, Virtual
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCClass::output
+//       Access: Published, Virtual
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCClass::
 output(ostream &out) const {
@@ -667,7 +667,7 @@ receive_update_other(PyObject *distobj, DatagramIterator &di) const {
 //               value blob.
 ////////////////////////////////////////////////////////////////////
 void DCClass::
-direct_update(PyObject *distobj, const string &field_name, 
+direct_update(PyObject *distobj, const string &field_name,
               const string &value_blob) {
   DCField *field = get_field_by_name(field_name);
   nassertv_always(field != NULL);
@@ -688,7 +688,7 @@ direct_update(PyObject *distobj, const string &field_name,
 //               datagram.
 ////////////////////////////////////////////////////////////////////
 void DCClass::
-direct_update(PyObject *distobj, const string &field_name, 
+direct_update(PyObject *distobj, const string &field_name,
               const Datagram &datagram) {
   direct_update(distobj, field_name, datagram.get_message());
 }
@@ -708,7 +708,7 @@ direct_update(PyObject *distobj, const string &field_name,
 //               Returns true on success, false on failure.
 ////////////////////////////////////////////////////////////////////
 bool DCClass::
-pack_required_field(Datagram &datagram, PyObject *distobj, 
+pack_required_field(Datagram &datagram, PyObject *distobj,
                     const DCField *field) const {
   DCPacker packer;
   packer.begin_pack(field);
@@ -738,7 +738,7 @@ pack_required_field(Datagram &datagram, PyObject *distobj,
 //               Returns true on success, false on failure.
 ////////////////////////////////////////////////////////////////////
 bool DCClass::
-pack_required_field(DCPacker &packer, PyObject *distobj, 
+pack_required_field(DCPacker &packer, PyObject *distobj,
                     const DCField *field) const {
   const DCParameter *parameter = field->as_parameter();
   if (parameter != (DCParameter *)NULL) {
@@ -762,14 +762,14 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
       nassert_raise(strm.str());
       return false;
     }
-    PyObject *result = 
+    PyObject *result =
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
     nassertr(result != (PyObject *)NULL, false);
 
     // Now pack the value into the datagram.
     bool pack_ok = parameter->pack_args(packer, result);
     Py_DECREF(result);
-    
+
     return pack_ok;
   }
 
@@ -805,7 +805,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     nassert_raise(strm.str());
     return false;
   }
-  
+
   string getter_name = setter_name;
   if (setter_name.substr(0, 3) == "set") {
     // If the original method started with "set", we mangle this
@@ -818,7 +818,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     getter_name = "get" + setter_name;
     getter_name[3] = toupper(getter_name[3]);
   }
-  
+
   // Now we have to look up the getter on the distributed object
   // and call it.
   if (!PyObject_HasAttrString(distobj, (char *)getter_name.c_str())) {
@@ -837,10 +837,10 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     nassert_raise(strm.str());
     return false;
   }
-  PyObject *func = 
+  PyObject *func =
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
   nassertr(func != (PyObject *)NULL, false);
-  
+
   PyObject *empty_args = PyTuple_New(0);
   PyObject *result = PyObject_CallObject(func, empty_args);
   Py_DECREF(empty_args);
@@ -851,7 +851,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     cerr << "Error when calling " << getter_name << "\n";
     return false;
   }
-  
+
   if (atom->get_num_elements() == 1) {
     // In this case, we expect the getter to return one object,
     // which we wrap up in a tuple.
@@ -865,13 +865,13 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     if (!PySequence_Check(result)) {
       ostringstream strm;
       strm << "Since dclass " << get_name() << " method " << setter_name
-           << " is declared to have multiple parameters, Python function " 
+           << " is declared to have multiple parameters, Python function "
            << getter_name << " must return a list or tuple.\n";
       nassert_raise(strm.str());
       return false;
     }
   }
-  
+
   // Now pack the arguments into the datagram.
   bool pack_ok = atom->pack_args(packer, result);
   Py_DECREF(result);
@@ -889,7 +889,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
 //               object from the client.
 ////////////////////////////////////////////////////////////////////
 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 {
   DCField *field = get_field_by_name(field_name);
   if (field == (DCField *)NULL) {
@@ -913,7 +913,7 @@ client_format_update(const string &field_name, DOID_TYPE do_id,
 //               object from the AI.
 ////////////////////////////////////////////////////////////////////
 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 {
   DCField *field = get_field_by_name(field_name);
   if (field == (DCField *)NULL) {
@@ -938,7 +938,7 @@ ai_format_update(const string &field_name, DOID_TYPE do_id,
 //               object from the AI.
 ////////////////////////////////////////////////////////////////////
 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 {
   DCField *field = get_field_by_name(field_name);
   if (field == (DCField *)NULL) {
@@ -968,7 +968,7 @@ ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
 //               This method is only called by the CMU implementation.
 ////////////////////////////////////////////////////////////////////
 Datagram DCClass::
-client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id, 
+client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
                            ZONEID_TYPE zone_id,
                            PyObject *optional_fields) const {
   DCPacker packer;
@@ -1041,7 +1041,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
 //               in addition to the normal required fields.
 ////////////////////////////////////////////////////////////////////
 Datagram DCClass::
-ai_format_generate(PyObject *distobj, DOID_TYPE do_id, 
+ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
                    DOID_TYPE parent_id, ZONEID_TYPE zone_id,
                    CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
                    PyObject *optional_fields) const {
@@ -1059,7 +1059,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
   } else {
     packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED);
   }
-  
+
   // Parent is a bit overloaded; this parent is not about inheritance,
   // this one is about the visibility container parent, i.e. the zone
   // parent:
@@ -1126,14 +1126,14 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
 //  Description: Generates a datagram containing the message necessary
 //               to create a new database distributed object from the AI.
 //
-//               First Pass is to only incldue required values
-//               (with Defaults).                   
+//               First Pass is to only include required values
+//               (with Defaults).
 ////////////////////////////////////////////////////////////////////
 Datagram DCClass::
 ai_database_generate_context(
     unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id,
     CHANNEL_TYPE owner_channel,
-    CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const 
+    CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const
 {
   DCPacker packer;
   packer.raw_pack_uint8(1);
@@ -1141,7 +1141,7 @@ ai_database_generate_context(
   packer.RAW_PACK_CHANNEL(from_channel_id);
   //packer.raw_pack_uint8('A');
   packer.raw_pack_uint16(STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT);
-  packer.raw_pack_uint32(parent_id);  
+  packer.raw_pack_uint32(parent_id);
   packer.raw_pack_uint32(zone_id);
   packer.RAW_PACK_CHANNEL(owner_channel);
   packer.raw_pack_uint16(_number); // DCD class ID
@@ -1170,13 +1170,13 @@ ai_database_generate_context(
 //  Description: Generates a datagram containing the message necessary
 //               to create a new database distributed object from the AI.
 //
-//               First Pass is to only incldue required values
-//               (with Defaults).                   
+//               First Pass is to only include required values
+//               (with Defaults).
 ////////////////////////////////////////////////////////////////////
 Datagram DCClass::
 ai_database_generate_context_old(
     unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id,
-    CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const 
+    CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const
 {
   DCPacker packer;
   packer.raw_pack_uint8(1);
@@ -1184,7 +1184,7 @@ ai_database_generate_context_old(
   packer.RAW_PACK_CHANNEL(from_channel_id);
   //packer.raw_pack_uint8('A');
   packer.raw_pack_uint16(STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT);
-  packer.raw_pack_uint32(parent_id);  
+  packer.raw_pack_uint32(parent_id);
   packer.raw_pack_uint32(zone_id);
   packer.raw_pack_uint16(_number); // DCD class ID
   packer.raw_pack_uint32(context_id);
@@ -1205,10 +1205,10 @@ ai_database_generate_context_old(
 #endif  // HAVE_PYTHON
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCClass::output
-//       Access : Public, Virtual
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCClass::output
+//       Access: Public, Virtual
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCClass::
 output(ostream &out, bool brief) const {
@@ -1284,7 +1284,7 @@ write(ostream &out, bool brief, int indent_level) const {
 //               the indicated output stream.
 ////////////////////////////////////////////////////////////////////
 void DCClass::
-output_instance(ostream &out, bool brief, const string &prename, 
+output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
   if (_is_struct) {
     out << "struct";
@@ -1380,7 +1380,7 @@ rebuild_inherited_fields() {
   Names names;
 
   _inherited_fields.clear();
-  
+
   // First, all of the inherited fields from our parent are at the top
   // of the list.
   Parents::const_iterator pi;
@@ -1413,7 +1413,7 @@ rebuild_inherited_fields() {
   for (fi = _fields.begin(); fi != _fields.end(); ++fi) {
     DCField *field = (*fi);
     if (field->get_name().empty()) {
-      // Unnamed fields are always added. 
+      // Unnamed fields are always added.
      _inherited_fields.push_back(field);
 
     } else {
@@ -1500,7 +1500,7 @@ add_field(DCField *field) {
     }
   }
 
-  if (_dc_file != (DCFile *)NULL && 
+  if (_dc_file != (DCFile *)NULL &&
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
     if (dc_multiple_inheritance) {
       _dc_file->set_new_index_number(field);

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

@@ -27,7 +27,7 @@ DCDeclaration::
 ////////////////////////////////////////////////////////////////////
 //     Function: DCDeclaration::as_class
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCClass *DCDeclaration::
 as_class() {
@@ -37,7 +37,7 @@ as_class() {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCDeclaration::as_class
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 const DCClass *DCDeclaration::
 as_class() const {
@@ -47,7 +47,7 @@ as_class() const {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCDeclaration::as_switch
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCSwitch *DCDeclaration::
 as_switch() {
@@ -57,7 +57,7 @@ as_switch() {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCDeclaration::as_switch
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 const DCSwitch *DCDeclaration::
 as_switch() const {
@@ -65,10 +65,10 @@ as_switch() const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCDeclaration::output
-//       Access : Published, Virtual
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCDeclaration::output
+//       Access: Published, Virtual
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCDeclaration::
 output(ostream &out) const {
@@ -76,10 +76,10 @@ output(ostream &out) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCDeclaration::
-//       Access : Published
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCDeclaration::
+//       Access: Published
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCDeclaration::
 write(ostream &out, int indent_level) const {

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

@@ -178,10 +178,10 @@ is_airecv() const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCField::output
-//       Access : Published
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCField::output
+//       Access: Published
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 INLINE void DCField::
 output(ostream &out) const {
@@ -189,10 +189,10 @@ output(ostream &out) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCField::
-//       Access : Published
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCField::
+//       Access: Published
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 INLINE void DCField::
 write(ostream &out, int indent_level) const {

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

@@ -19,7 +19,7 @@
 ////////////////////////////////////////////////////////////////////
 //     Function: DCKeyword::Constructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCKeyword::
 DCKeyword(const string &name, int historical_flag) :
@@ -74,10 +74,10 @@ clear_historical_flag() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCKeyword::output
-//       Access : Public, Virtual
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCKeyword::output
+//       Access: Public, Virtual
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCKeyword::
 output(ostream &out, bool brief) const {
@@ -87,7 +87,7 @@ output(ostream &out, bool brief) const {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCKeyword::write
 //       Access: Public, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 void DCKeyword::
 write(ostream &out, bool, int indent_level) const {

+ 18 - 18
direct/src/dcparser/dcSwitch.cxx

@@ -67,7 +67,7 @@ DCSwitch::
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::as_switch
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCSwitch *DCSwitch::
 as_switch() {
@@ -77,7 +77,7 @@ as_switch() {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::as_switch
 //       Access: Published, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 const DCSwitch *DCSwitch::
 as_switch() const {
@@ -351,10 +351,10 @@ apply_switch(const char *value_data, size_t length) const {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCSwitch::output
-//       Access : Public, Virtual
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCSwitch::output
+//       Access: Public, Virtual
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCSwitch::
 output(ostream &out, bool brief) const {
@@ -379,7 +379,7 @@ write(ostream &out, bool brief, int indent_level) const {
 //               the indicated output stream.
 ////////////////////////////////////////////////////////////////////
 void DCSwitch::
-output_instance(ostream &out, bool brief, const string &prename, 
+output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
   out << "switch";
   if (!_name.empty()) {
@@ -426,7 +426,7 @@ output_instance(ostream &out, bool brief, const string &prename,
 ////////////////////////////////////////////////////////////////////
 void DCSwitch::
 write_instance(ostream &out, bool brief, int indent_level,
-               const string &prename, const string &name, 
+               const string &prename, const string &name,
                const string &postname) const {
   indent(out, indent_level)
     << "switch";
@@ -532,7 +532,7 @@ pack_default_value(DCPackData &pack_data, bool &pack_error) const {
     // default.
     packer.pack_default_value();
     fields = _default_case;
-  }    
+  }
 
   if (!packer.end_pack()) {
     pack_error = true;
@@ -634,7 +634,7 @@ start_new_case() {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::SwitchFields::Constructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCSwitch::SwitchFields::
 SwitchFields(const string &name) :
@@ -654,7 +654,7 @@ SwitchFields(const string &name) :
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::SwitchFields::Destructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCSwitch::SwitchFields::
 ~SwitchFields() {
@@ -690,7 +690,7 @@ add_field(DCField *field) {
   if (!field->get_name().empty()) {
     bool inserted = _fields_by_name.insert
       (FieldsByName::value_type(field->get_name(), field)).second;
-    
+
     if (!inserted) {
       return false;
     }
@@ -738,11 +738,11 @@ do_check_match_switch_case(const DCSwitch::SwitchFields *other) const {
 
   return true;
 }
-    
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::SwitchFields::output
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 void DCSwitch::SwitchFields::
 output(ostream &out, bool brief) const {
@@ -758,11 +758,11 @@ output(ostream &out, bool brief) const {
   }
   out << "break; ";
 }
-    
+
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::SwitchFields::write
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 void DCSwitch::SwitchFields::
 write(ostream &out, bool brief, int indent_level) const {
@@ -797,7 +797,7 @@ do_check_match(const DCPackerInterface *) const {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::SwitchCase::Constructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCSwitch::SwitchCase::
 SwitchCase(const string &value, DCSwitch::SwitchFields *fields) :
@@ -809,7 +809,7 @@ SwitchCase(const string &value, DCSwitch::SwitchFields *fields) :
 ////////////////////////////////////////////////////////////////////
 //     Function: DCSwitch::SwitchCase::Destructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 DCSwitch::SwitchCase::
 ~SwitchCase() {

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

@@ -1,4 +1,4 @@
-// Filename: dcClassParameter.h
+// Filename: dcSwitchParameter.h
 // Created by:  drose (29Jun04)
 //
 ////////////////////////////////////////////////////////////////////
@@ -44,7 +44,7 @@ public:
 
   const DCPackerInterface *apply_switch(const char *value_data, size_t length) const;
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename, 
+  virtual void output_instance(ostream &out, bool brief, const string &prename,
                                const string &name, const string &postname) const;
   virtual void write_instance(ostream &out, bool brief, int indent_level,
                               const string &prename, const string &name,

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

@@ -146,10 +146,10 @@ set_number(int number) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function : DCTypedef::output
-//       Access : Public, Virtual
-//  Description : Write a string representation of this instance to
-//                <out>.
+//     Function: DCTypedef::output
+//       Access: Public, Virtual
+//  Description: Write a string representation of this instance to
+//               <out>.
 ////////////////////////////////////////////////////////////////////
 void DCTypedef::
 output(ostream &out, bool brief) const {
@@ -160,7 +160,7 @@ output(ostream &out, bool brief) const {
 ////////////////////////////////////////////////////////////////////
 //     Function: DCTypedef::write
 //       Access: Public, Virtual
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 void DCTypedef::
 write(ostream &out, bool brief, int indent_level) const {

+ 2 - 0
direct/src/directbase/DirectStart.py

@@ -1,3 +1,5 @@
+""" This is a deprecated module that creates a global instance of ShowBase. """
+
 __all__ = []
 print('Using deprecated DirectStart interface.')
 

+ 2 - 2
direct/src/directbase/ppython.cxx

@@ -1,11 +1,11 @@
-///////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //
 // This is a little wrapper to make it easy to run a python
 // program from the command line. Basically, it just interfaces
 // to the Python API and imports the module that was specified
 // by the IMPORT_MODULE preprocessor definition when it was compiled.
 //
-///////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 
 #include "dtoolbase.h"
 

+ 45 - 42
direct/src/directd/directd.h

@@ -29,45 +29,48 @@ typedef int HANDLE;
 #endif //]
 
 
-// Description: DirectD is a client/server app for starting panda/direct.
-//              
-//              Usage:
-//              Start a directd server on each of the machines you
-//              which to start panda on.
-//              
-//              Start a directd client on the controlling machine or 
-//              import ShowBaseGlobal with the xxxxx flag in your
-//              Configrc.  The client will connect each of the servers 
-//              in the xxxxx list in your Configrc.
-//              
-//              There are two API groups in this class, they are:
-//              
-//                listen_to()
-//                client_ready() or tell_server()
-//                wait_for_servers()
-//                server_ready()
-//              
-//              and:
-//              
-//                connect_to()
-//                send_command()
-//                disconnect_from()
-//              
-//              The second group was from a more general implementation
-//              of DirectD.  The first group summarizes the main intents
-//              of DirectD.
-//              Both groups are presented in order chronologically by their
-//              intended usage.
-//              The first group will probably provide everthing needed for
-//              DirectD.
+////////////////////////////////////////////////////////////////////
+//       Class : DirectD
+// Description : DirectD is a client/server app for starting panda/direct.
+//
+//               Usage:
+//               Start a directd server on each of the machines you
+//               which to start panda on.
+//
+//               Start a directd client on the controlling machine or
+//               import ShowBaseGlobal with the xxxxx flag in your
+//               Configrc.  The client will connect each of the servers
+//               in the xxxxx list in your Configrc.
+//
+//               There are two API groups in this class, they are:
+//
+//                 listen_to()
+//                 client_ready() or tell_server()
+//                 wait_for_servers()
+//                 server_ready()
+//
+//               and:
+//
+//                 connect_to()
+//                 send_command()
+//                 disconnect_from()
+//
+//               The second group was from a more general implementation
+//               of DirectD.  The first group summarizes the main intents
+//               of DirectD.
+//               Both groups are presented in order chronologically by their
+//               intended usage.
+//               The first group will probably provide everthing needed for
+//               DirectD.
+////////////////////////////////////////////////////////////////////
 class EXPCL_DIRECT DirectD {
 PUBLISHED:
   DirectD();
   ~DirectD();
-  
+
   // Description: Call listen_to in the server.
   //              port is a rendezvous port.
-  //              
+  //
   //              backlog refers to how many connections can queue up
   //              before you handle them.  Consider setting backlog to
   //              the count you send to wait_for_servers(); or higher.
@@ -84,7 +87,7 @@ PUBLISHED:
 
   // Description: Tell the server to do the command cmd.
   //              cmd is one of the following:
-  //                "k[<n>]"    Kill the most recent application 
+  //                "k[<n>]"    Kill the most recent application
   //                            started with client_ready() or "!".
   //                            Or kill the nth most recent or 'a' for All.
   //                            E.g. "k", "k0", "k2", "ka".
@@ -99,31 +102,31 @@ PUBLISHED:
 
   // Description: Call this function from the client after
   //              calling <count> client_ready() calls.
-  //              
+  //
   //              Call listen_to(port) prior to calling
   //              wait_for_servers() (or better yet, prior
   //              to calling client_ready()).
-  //              
+  //
   //              timeout_ms defaults to two minutes.
   bool wait_for_servers(int count, int timeout_ms=2*60*1000);
 
   // Description: Call this function from the server when
   //              import ShowbaseGlobal is nearly finished.
   int server_ready(const string& client_host, int port);
-  
+
   // Description: Call connect_to from client for each server.
   //              returns the port number of the connection (which
   //              is different from the rendezvous port used in the
   //              second argument).  The return value can be used
   //              for the port arguemnt in disconnect_from().
   int connect_to(const string& server_host, int port);
-  
+
   // Description: This is the counterpart to connect_to().  Pass
   //              the same server_host as for connect_to(), but pass
   //              the return value from connect_to() for the port,
   //              not the port passed to connect_to().
   void disconnect_from(const string& server_host, int port);
-  
+
   // Description: Send the same command string to all current
   //              connections.
   void send_command(const string& cmd);
@@ -134,7 +137,7 @@ protected:
   void kill_all();
   virtual void handle_command(const string& cmd);
   void handle_datagram(NetDatagram& datagram);
-  void send_one_message(const string& host_name, 
+  void send_one_message(const string& host_name,
       int port, const string& message);
 
   QueuedConnectionManager _cm;
@@ -143,7 +146,7 @@ protected:
   QueuedConnectionListener _listener;
 
   // Start of old stuff:
-  // This is used to switch to the original method of 
+  // This is used to switch to the original method of
   // starting applications.  It can be used on old systems
   // that don't support job objects.  Eventually this stuff
   // should be removed.
@@ -156,7 +159,7 @@ protected:
   ConnectionSet _connections;
   HANDLE _jobObject;
   bool _shutdown;
-  
+
   void check_for_new_clients();
   void check_for_datagrams();
   void check_for_lost_connection();

+ 4 - 2
direct/src/directdServer/directdClient.h

@@ -14,7 +14,10 @@
 
 #include "directd.h"
 
-// Description: DirectDClient is a test app for DriectDServer.
+////////////////////////////////////////////////////////////////////
+//       Class : DirectDClient
+// Description : DirectDClient is a test app for DirectDServer.
+////////////////////////////////////////////////////////////////////
 class DirectDClient: public DirectD {
 public:
   DirectDClient();
@@ -25,4 +28,3 @@ public:
 protected:
   void cli_command(const string& cmd);
 };
-

+ 11 - 8
direct/src/directdServer/directdServer.h

@@ -15,18 +15,21 @@
 #include "queuedConnectionReader.h"
 #include "directd.h"
 
-// Description: Start a directdServer on each of the machines you
-//              which to start panda on.
-//              
-//              Start a directdClient on the controlling machine
-//              or import ShowBaseGlobal with the xxxxx flag in
-//              your Configrc.  The client will connact each of
-//              the servers in the xxxxx list in your Configrc.
+////////////////////////////////////////////////////////////////////
+//       Class : DirectDServer
+// Description : Start a directdServer on each of the machines you
+//               which to start panda on.
+//
+//               Start a directdClient on the controlling machine
+//               or import ShowBaseGlobal with the xxxxx flag in
+//               your Configrc.  The client will connact each of
+//               the servers in the xxxxx list in your Configrc.
+////////////////////////////////////////////////////////////////////
 class DirectDServer: public DirectD {
 public:
   DirectDServer();
   ~DirectDServer();
-  
+
   void run_server(int port);
 
 protected:

Diferenças do arquivo suprimidas por serem muito extensas
+ 486 - 355
direct/src/directscripts/Doxyfile.cxx


+ 3 - 1
direct/src/directutil/Verify.py

@@ -41,7 +41,9 @@ only when debugging (i.e. when it won't be checked-in) or where it helps
 you resist using assert for error handling.
 """
 
-wantVerifyPdb = 0 # Set to true to load pdb on failure.
+from panda3d.core import ConfigVariableBool
+
+wantVerifyPdb = ConfigVariableBool('want-verify-pdb', False) # Set to true to load pdb on failure.
 
 
 def verify(assertion):

+ 1 - 0
direct/src/distributed/DistributedSmoothNodeBase.py

@@ -3,6 +3,7 @@
 from ClockDelta import *
 from direct.task import Task
 from direct.showbase.PythonUtil import randFloat, Enum
+from panda3d.direct import CDistributedSmoothNodeBase
 
 class DummyTaskClass:
     def setDelay(self, blah):

+ 1 - 1
direct/src/gui/DirectDialog.py

@@ -115,7 +115,7 @@ class DirectDialog(DirectFrame):
             ('fadeScreen',        0,             None),
             ('command',           None,          None),
             ('extraArgs',         [],            None),
-            ('sortOrder',    NO_FADE_SORT_INDEX, None),
+            ('sortOrder',    DGG.NO_FADE_SORT_INDEX, None),
             )
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs, dynamicGroups = ("button",))

+ 8 - 2
direct/src/gui/DirectEntry.py

@@ -46,8 +46,8 @@ class DirectEntry(DirectFrame):
             ('numStates',       3,                None),
             ('state',           DGG.NORMAL,       None),
             ('entryFont',       None,             DGG.INITOPT),
-            ('width',           10,               self.setup),
-            ('numLines',        1,                self.setup),
+            ('width',           10,               self.updateWidth),
+            ('numLines',        1,                self.updateNumLines),
             ('focus',           0,                self.setFocus),
             ('cursorKeys',      1,                self.setCursorKeysActive),
             ('obscured',        0,                self.setObscureMode),
@@ -146,6 +146,12 @@ class DirectEntry(DirectFrame):
     def setup(self):
         self.guiItem.setupMinimal(self['width'], self['numLines'])
 
+    def updateWidth(self):
+        self.guiItem.setMaxWidth(self['width'])
+
+    def updateNumLines(self):
+        self.guiItem.setNumLines(self['numLines'])
+
     def setFocus(self):
         PGEntry.setFocus(self.guiItem, self['focus'])
 

+ 0 - 8
direct/src/gui/DirectGuiBase.py

@@ -12,7 +12,6 @@ from OnscreenImage import *
 from direct.directtools.DirectUtil import ROUND_TO
 from direct.showbase import DirectObject
 from direct.task import Task
-from direct.showbase.PythonUtil import recordCreationStackStr
 import types
 
 guiObjectCollector = PStatCollector("Client::GuiObjects")
@@ -651,13 +650,6 @@ def toggleGuiGridSnap():
 def setGuiGridSpacing(spacing):
     DirectGuiWidget.gridSpacing = spacing
 
-# this should trigger off of __dev__, but it's not available at this point.
-# __debug__ works because the production client is not __debug__ and the
-# production AI doesn't create any GUI.
-if get_config_showbase().GetBool('record-gui-creation-stack', __debug__):
-    # this will help track down the code that created DirectGui objects
-    # call obj.printCreationStackTrace() to figure out what code created it
-    DirectGuiBase = recordCreationStackStr(DirectGuiBase)
 
 class DirectGuiWidget(DirectGuiBase, NodePath):
     # Toggle if you wish widget's to snap to grid when draggin

+ 3 - 0
direct/src/gui/DirectGuiGlobals.py

@@ -87,6 +87,9 @@ IMAGE_SORT_INDEX = 10
 GEOM_SORT_INDEX = 20
 TEXT_SORT_INDEX = 30
 
+FADE_SORT_INDEX = 1000
+NO_FADE_SORT_INDEX = 2000
+
 # Handy conventions for organizing top-level gui objects in loose buckets.
 BACKGROUND_SORT_INDEX = -100
 MIDGROUND_SORT_INDEX = 0

+ 1 - 1
direct/src/gui/DirectWaitBar.py

@@ -33,7 +33,7 @@ class DirectWaitBar(DirectFrame):
             ('barColor',       (1, 0, 0, 1),       self.setBarColor),
             ('barTexture',     None,               self.setBarTexture),
             ('barRelief',      DGG.FLAT,           self.setBarRelief),
-            ('sortOrder',      NO_FADE_SORT_INDEX, None),
+            ('sortOrder',      DGG.NO_FADE_SORT_INDEX, None),
             )
         if 'text' in kw:
             textoptiondefs = (

+ 61 - 19
direct/src/gui/OnscreenText.py

@@ -158,10 +158,10 @@ class OnscreenText(DirectObject, NodePath):
             scale = (scale, scale)
 
         # Save some of the parameters for posterity.
-        self.scale = scale
-        self.pos = pos
-        self.roll = roll
-        self.wordwrap = wordwrap
+        self.__scale = scale
+        self.__pos = pos
+        self.__roll = roll
+        self.__wordwrap = wordwrap
 
         if decal:
             textNode.setCardDecal(1)
@@ -249,12 +249,16 @@ class OnscreenText(DirectObject, NodePath):
     def getDecal(self):
         return self.textNode.getCardDecal()
 
+    decal = property(getDecal, setDecal)
+
     def setFont(self, font):
         self.textNode.setFont(font)
 
     def getFont(self):
         return self.textNode.getFont()
 
+    font = property(getFont, setFont)
+
     def clearText(self):
         self.textNode.clearText()
 
@@ -279,31 +283,37 @@ class OnscreenText(DirectObject, NodePath):
         else:
             return self.textNode.getText()
 
+    text = property(getText, setText)
+
     def setX(self, x):
-        self.setPos(x, self.pos[1])
+        self.setPos(x, self.__pos[1])
 
     def setY(self, y):
-        self.setPos(self.pos[0], y)
+        self.setPos(self.__pos[0], y)
 
     def setPos(self, x, y):
         """setPos(self, float, float)
         Position the onscreen text in 2d screen space
         """
-        self.pos = (x, y)
+        self.__pos = (x, y)
         self.updateTransformMat()
 
     def getPos(self):
-        return self.pos
+        return self.__pos
+
+    pos = property(getPos, setPos)
 
     def setRoll(self, roll):
         """setRoll(self, float)
         Rotate the onscreen text around the screen's normal
         """
-        self.roll = roll
+        self.__roll = roll
         self.updateTransformMat()
 
     def getRoll(self):
-        return self.roll
+        return self.__roll
+
+    roll = property(getRoll, setRoll)
 
     def setScale(self, sx, sy = None):
         """setScale(self, float, float)
@@ -313,27 +323,29 @@ class OnscreenText(DirectObject, NodePath):
 
         if sy == None:
             if isinstance(sx, types.TupleType):
-                self.scale = sx
+                self.__scale = sx
             else:
-                self.scale = (sx, sx)
+                self.__scale = (sx, sx)
         else:
-            self.scale = (sx, sy)
+            self.__scale = (sx, sy)
         self.updateTransformMat()
 
     def updateTransformMat(self):
         assert(isinstance(self.textNode, TextNode))
         mat = (
-            Mat4.scaleMat(Vec3.rfu(self.scale[0], 1, self.scale[1])) *
-            Mat4.rotateMat(self.roll, Vec3.back()) *
-            Mat4.translateMat(Point3.rfu(self.pos[0], 0, self.pos[1]))
+            Mat4.scaleMat(Vec3.rfu(self.__scale[0], 1, self.__scale[1])) *
+            Mat4.rotateMat(self.__roll, Vec3.back()) *
+            Mat4.translateMat(Point3.rfu(self.__pos[0], 0, self.__pos[1]))
             )
         self.textNode.setTransform(mat)
 
     def getScale(self):
-        return self.scale
+        return self.__scale
+
+    scale = property(getScale, setScale)
 
     def setWordwrap(self, wordwrap):
-        self.wordwrap = wordwrap
+        self.__wordwrap = wordwrap
 
         if wordwrap:
             self.textNode.setWordwrap(wordwrap)
@@ -341,11 +353,24 @@ class OnscreenText(DirectObject, NodePath):
             self.textNode.clearWordwrap()
 
     def getWordwrap(self):
-        return self.wordwrap
+        return self.__wordwrap
+
+    wordwrap = property(getWordwrap, setWordwrap)
+
+    def __getFg(self):
+        return self.textNode.getTextColor()
 
     def setFg(self, fg):
         self.textNode.setTextColor(fg[0], fg[1], fg[2], fg[3])
 
+    fg = property(__getFg, setFg)
+
+    def __getBg(self):
+        if self.textNode.hasCard():
+            return self.textNode.getCardColor()
+        else:
+            return LColor(0)
+
     def setBg(self, bg):
         if bg[3] != 0:
             # If we have a background color, create a card.
@@ -355,6 +380,11 @@ class OnscreenText(DirectObject, NodePath):
             # Otherwise, remove the card.
             self.textNode.clearCard()
 
+    bg = property(__getBg, setBg)
+
+    def __getShadow(self):
+        return self.textNode.getShadowColor()
+
     def setShadow(self, shadow):
         if shadow[3] != 0:
             # If we have a shadow color, create a shadow.
@@ -364,6 +394,11 @@ class OnscreenText(DirectObject, NodePath):
             # Otherwise, remove the shadow.
             self.textNode.clearShadow()
 
+    shadow = property(__getShadow, setShadow)
+
+    def __getFrame(self):
+        return self.textNode.getFrameColor()
+
     def setFrame(self, frame):
         if frame[3] != 0:
             # If we have a frame color, create a frame.
@@ -373,6 +408,8 @@ class OnscreenText(DirectObject, NodePath):
             # Otherwise, remove the frame.
             self.textNode.clearFrame()
 
+    frame = property(__getFrame, setFrame)
+
     def configure(self, option=None, **kw):
         # These is for compatibility with DirectGui functions
         if not self.mayChange:
@@ -399,9 +436,14 @@ class OnscreenText(DirectObject, NodePath):
         getter = getattr(self, 'get' + option[0].upper() + option[1:])
         return getter()
 
+    def __getAlign(self):
+        return self.textNode.getAlign()
+
     def setAlign(self, align):
         self.textNode.setAlign(align)
 
+    align = property(__getAlign, setAlign)
+
     # Allow index style refererences
     __getitem__ = cget
 

+ 9 - 3
direct/src/interval/Interval.py

@@ -5,6 +5,7 @@ __all__ = ['Interval']
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.showbase.DirectObject import DirectObject
 from direct.task.Task import Task, TaskManager
+from direct.task.TaskManagerGlobal import taskMgr
 from panda3d.core import *
 from panda3d.direct import *
 from direct.extensions_native import CInterval_extensions
@@ -289,13 +290,13 @@ class Interval(DirectObject):
             self.__endT = endT
             self.__endTAtEnd = 0
 
-        self.__clockStart = globalClock.getFrameTime()
+        self.__clockStart = ClockObject.getGlobalClock().getFrameTime()
         self.__playRate = playRate
         self.__doLoop = doLoop
         self.__loopCount = 0
 
     def setupResume(self):
-        now = globalClock.getFrameTime()
+        now = ClockObject.getGlobalClock().getFrameTime()
         if self.__playRate > 0:
             self.__clockStart = now - ((self.getT() - self.__startT) / self.__playRate)
         elif self.__playRate < 0:
@@ -303,7 +304,7 @@ class Interval(DirectObject):
         self.__loopCount = 0
 
     def stepPlay(self):
-        now = globalClock.getFrameTime()
+        now = ClockObject.getGlobalClock().getFrameTime()
         if self.__playRate >= 0:
             t = (now - self.__clockStart) * self.__playRate + self.__startT
 
@@ -398,6 +399,11 @@ class Interval(DirectObject):
             space = space + ' '
         return (space + self.name + ' dur: %.2f' % self.duration)
 
+    open_ended = property(getOpenEnded)
+    stopped = property(isStopped)
+    t = property(getT, setT)
+    play_rate = property(getPlayRate, setPlayRate)
+    done_event = property(getDoneEvent, setDoneEvent)
 
     # The rest of these methods are duplicates of functions defined
     # for the CInterval class via the file CInterval-extensions.py.

+ 0 - 7
direct/src/interval/ProjectileInterval.py

@@ -72,13 +72,6 @@ class ProjectileInterval(Interval):
                               self.projectileIntervalNum)
             ProjectileInterval.projectileIntervalNum += 1
 
-            """
-            # attempt to add info about the caller
-            file, line, func = PythonUtil.callerInfo()
-            if file is not None:
-                name += '-%s:%s:%s' % (file, line, func)
-            """
-
         args = (startPos, endPos, duration, startVel, endZ,
                 wayPoint, timeToWayPoint, gravityMult)
         self.implicitStartPos = 0

+ 14 - 0
direct/src/interval/cInterval.h

@@ -124,6 +124,20 @@ PUBLISHED:
   void setup_resume_until(double end_t);
   bool step_play();
 
+PUBLISHED:
+  MAKE_PROPERTY(name, get_name);
+  MAKE_PROPERTY(duration, get_duration);
+  MAKE_PROPERTY(open_ended, get_open_ended);
+  MAKE_PROPERTY(state, get_state);
+  MAKE_PROPERTY(stopped, is_stopped);
+  MAKE_PROPERTY(done_event, get_done_event, set_done_event);
+  MAKE_PROPERTY(t, get_t, set_t);
+  MAKE_PROPERTY(auto_pause, get_auto_pause, set_auto_pause);
+  MAKE_PROPERTY(auto_finish, get_auto_finish, set_auto_finish);
+  MAKE_PROPERTY(manager, get_manager, set_manager);
+  MAKE_PROPERTY(play_rate, get_play_rate, set_play_rate);
+  MAKE_PROPERTY(playing, is_playing);
+
 public:
   void mark_dirty();
   INLINE bool check_t_callback();

+ 52 - 52
direct/src/motiontrail/cMotionTrail.cxx

@@ -1,4 +1,4 @@
-// Filename: cMotionTrail.h
+// Filename: cMotionTrail.cxx
 // Created by:  aignacio (29Jan07)
 //
 ////////////////////////////////////////////////////////////////////
@@ -30,7 +30,7 @@ CMotionTrail ( ) {
 
   _active = true;
   _enable = true;
-  
+
   _pause = false;
   _pause_time = 0.0f;
 
@@ -63,7 +63,7 @@ CMotionTrail ( ) {
   // real-time data
   _vertex_index = 0;
   _vertex_data = 0;
-  _triangles = 0;  
+  _triangles = 0;
 
   _vertex_array = 0;
 }
@@ -132,7 +132,7 @@ add_vertex (LVector4 *vertex, LVector4 *start_color, LVector4 *end_color, PN_std
   motion_trail_vertex._start_color = *start_color;
   motion_trail_vertex._end_color = *end_color;
   motion_trail_vertex._v = v;
-  
+
   motion_trail_vertex._nurbs_curve_evaluator = new NurbsCurveEvaluator ( );
 
   _vertex_list.push_back (motion_trail_vertex);
@@ -143,23 +143,23 @@ add_vertex (LVector4 *vertex, LVector4 *start_color, LVector4 *end_color, PN_std
 //       Access: Published
 //  Description: Set motion trail parameters.
 //
-//               sampling_time = Can be used to specify a lower 
-//               sampling rate than the frame rate. Use 0.0 with 
-//               nurbs. 
+//               sampling_time = Can be used to specify a lower
+//               sampling rate than the frame rate. Use 0.0 with
+//               nurbs.
 //
-//               time_window = a component for the "length" of the 
-//               motion trail.  The motion trail length = 
+//               time_window = a component for the "length" of the
+//               motion trail.  The motion trail length =
 //               time_window * velocity of the object.
 //
 //               use_texture = texture option on/off.
 //
-//               calculate_relative_matrix = calculate relative 
+//               calculate_relative_matrix = calculate relative
 //               matrix on/off.
 //
 //               use_nurbs = nurbs option on/off
 //
-//               resolution_distance = the distance used to 
-//               determine the number of geometry samples. 
+//               resolution_distance = the distance used to
+//               determine the number of geometry samples.
 //               samples = motion trail length / resolution_distance.
 //               Applicable only if nurbs is on.
 ////////////////////////////////////////////////////////////////////
@@ -183,7 +183,7 @@ int CMotionTrail::
 check_for_update (PN_stdfloat current_time) {
 
   int state;
-  
+
   state = false;
   if ((current_time - _last_update_time) >= _sampling_time) {
       state = true;
@@ -208,14 +208,14 @@ PN_stdfloat one_minus_x (PN_stdfloat x) {
 ////////////////////////////////////////////////////////////////////
 //     Function: CMotionTrail::begin_geometry
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 void CMotionTrail::
 begin_geometry ( ) {
 
   const GeomVertexFormat *format;
 
-  _vertex_index = 0;  
+  _vertex_index = 0;
   if (_use_texture) {
     format = GeomVertexFormat::get_v3c4t2 ( );
   }
@@ -236,7 +236,7 @@ begin_geometry ( ) {
   if (_use_texture) {
     _texture_writer = GeomVertexWriter (_vertex_data, "texcoord");
   }
-  
+
   _triangles = new GeomTriangles (Geom::UH_static);
 }
 
@@ -325,16 +325,16 @@ add_geometry_quad (LVector4 &v0, LVector4 &v1, LVector4 &v2, LVector4 &v3, LVect
 ////////////////////////////////////////////////////////////////////
 //     Function: CMotionTrail::end_geometry
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
-void CMotionTrail::end_geometry ( ) {    
+void CMotionTrail::end_geometry ( ) {
   static CPT(RenderState) state;
   if (state == (RenderState *)NULL) {
     state = RenderState::make(ColorAttrib::make_vertex());
   }
 
   PT(Geom) geometry;
-  
+
   geometry = new Geom (_vertex_data);
   geometry -> add_primitive (_triangles);
 
@@ -354,14 +354,14 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
 
   int debug;
   int total_frames;
-  
+
   debug = false;
 
   total_frames = _frame_list.size ( );
   if (total_frames >= 1) {
     FrameList::iterator frame_iterator;
     CMotionTrailFrame motion_trail_frame;
- 
+
     frame_iterator = _frame_list.begin ( );
     motion_trail_frame = *frame_iterator;
     if (*transform == motion_trail_frame._transform) {
@@ -380,7 +380,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
   color_scale = _color_scale;
   if (_fade) {
     PN_stdfloat elapsed_time;
-    
+
     elapsed_time = current_time - _fade_start_time;
     if (elapsed_time < 0.0) {
       elapsed_time = 0.0;
@@ -398,20 +398,20 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
 
   // remove expired frames
   PN_stdfloat minimum_time;
-  
+
   minimum_time = current_time - _time_window;
-  
+
   CMotionTrailFrame motion_trail_frame;
-  
+
   while (!_frame_list.empty()) {
     motion_trail_frame = _frame_list.back();
     if (motion_trail_frame._time >= minimum_time) {
       break;
     }
-    
+
     _frame_list.pop_back ( );
   }
-  
+
   // add new frame to beginning of list
   {
     CMotionTrailFrame motion_trail_frame;
@@ -435,21 +435,21 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
     PN_stdfloat delta_time;
     CMotionTrailFrame last_motion_trail_frame;
 
-    VertexList::iterator vertex_iterator;    
+    VertexList::iterator vertex_iterator;
 
     // convert vertex list to vertex array
     int index = 0;
     _vertex_array = new CMotionTrailVertex [total_vertices];
-    for (vertex_iterator = _vertex_list.begin ( ); vertex_iterator != _vertex_list.end ( ); vertex_iterator++) {   
-      _vertex_array [index] = *vertex_iterator;        
+    for (vertex_iterator = _vertex_list.begin ( ); vertex_iterator != _vertex_list.end ( ); vertex_iterator++) {
+      _vertex_array [index] = *vertex_iterator;
       index++;
     }
-    
+
     // begin geometry
     this -> begin_geometry ( );
 
     total_segments = total_frames - 1;
-      
+
     last_motion_trail_frame = _frame_list.back();
     minimum_time = last_motion_trail_frame._time;
     delta_time = current_time - minimum_time;
@@ -460,10 +460,10 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
     }
 
     if (_use_nurbs && (total_frames >= 5)) {
-    
+
       // nurbs version
       int total_vertex_segments;
-      PN_stdfloat total_distance;  
+      PN_stdfloat total_distance;
       LVector3 vector;
       LVector4 v;
       LVector4 v0;
@@ -479,19 +479,19 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
         CMotionTrailVertex *motion_trail_vertex;
         PT(NurbsCurveEvaluator) nurbs_curve_evaluator;
 
-        for (index = 0; index < total_vertices; index++) {   
+        for (index = 0; index < total_vertices; index++) {
           motion_trail_vertex = &_vertex_array [index];
           nurbs_curve_evaluator = motion_trail_vertex -> _nurbs_curve_evaluator;
           nurbs_curve_evaluator -> set_order (4);
           nurbs_curve_evaluator -> reset (total_segments);
         }
       }
-      
+
       // add vertices to each NurbsCurveEvaluator
       int segment_index;
       CMotionTrailFrame motion_trail_frame_start;
       CMotionTrailFrame motion_trail_frame_end;
-      
+
       segment_index = 0;
 
       FrameList::iterator frame_iterator;
@@ -549,13 +549,13 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
 
         segment_index += 1;
       }
-      
+
       // evaluate NurbsCurveEvaluator for each vertex
       PT(NurbsCurveResult) *nurbs_curve_result_array;
-      
+
       nurbs_curve_result_array = new PT(NurbsCurveResult) [total_vertices];
       for (index = 0; index < total_vertices; index++) {
-      
+
         CMotionTrailVertex *motion_trail_vertex;
         PT(NurbsCurveEvaluator) nurbs_curve_evaluator;
         PT(NurbsCurveResult) nurbs_curve_result;
@@ -576,10 +576,10 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
           printf ("nurbs_start_t %f, nurbs_end_t %f \n", nurbs_start_t, nurbs_end_t);
         }
       }
-      
-      // create quads from NurbsCurveResult                    
+
+      // create quads from NurbsCurveResult
       PN_stdfloat total_curve_segments;
-      
+
       total_curve_segments = (total_distance / _resolution_distance);
       if (total_curve_segments < total_segments) {
         total_curve_segments = total_segments;
@@ -607,8 +607,8 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
         PN_stdfloat curve_segment_index;
 
         curve_segment_index = 0.0;
-        while (curve_segment_index < total_curve_segments) {   
-        
+        while (curve_segment_index < total_curve_segments) {
+
           PN_stdfloat st;
           PN_stdfloat et;
           PN_stdfloat start_t;
@@ -708,7 +708,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
       for (index = 0; index < total_vertices; index++) {
         nurbs_curve_result_array [index] = 0;
       }
-      
+
       delete[] nurbs_curve_result_array;
     }
     else {
@@ -717,7 +717,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
       int segment_index;
       int vertex_segment_index;
       int total_vertex_segments;
-      
+
       PN_stdfloat st;
       PN_stdfloat et;
       PN_stdfloat start_t;
@@ -745,12 +745,12 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
 
       CMotionTrailFrame motion_trail_frame_start;
       CMotionTrailFrame motion_trail_frame_end;
-                    
+
       segment_index = 0;
       FrameList::iterator frame_iterator;
       frame_iterator = _frame_list.begin ( );
       while (segment_index < total_segments) {
-      
+
         CMotionTrailVertex *motion_trail_vertex_start;
         CMotionTrailVertex *motion_trail_vertex_end;
 
@@ -796,7 +796,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
         t2.set (et, motion_trail_vertex_start -> _v);
 
         while (vertex_segment_index < total_vertex_segments) {
-        
+
           motion_trail_vertex_start = &_vertex_array [vertex_segment_index];
           motion_trail_vertex_end = &_vertex_array [vertex_segment_index + 1];
 
@@ -829,11 +829,11 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
         }
 
         segment_index += 1;
-      }  
+      }
     }
 
     // end geometry
-    this -> end_geometry ( );   
+    this -> end_geometry ( );
 
     delete[] _vertex_array;
     _vertex_array = 0;

+ 1 - 1
direct/src/motiontrail/config_motiontrail.h

@@ -1,4 +1,4 @@
-// Filename: config_interval.h
+// Filename: config_motiontrail.h
 // Created by:  drose (27Aug02)
 //
 ////////////////////////////////////////////////////////////////////

+ 10 - 10
direct/src/plugin/find_root_dir_assist.mm

@@ -1,4 +1,4 @@
-// Filename: filename_assist.mm
+// Filename: find_root_dir_assist.mm
 // Created by:  drose (13Apr09)
 //
 ////////////////////////////////////////////////////////////////////
@@ -23,7 +23,7 @@
 //     Function: NSString_to_cpp_string
 //  Description: Copy the Objective-C string to a C++ string.
 ////////////////////////////////////////////////////////////////////
-static string 
+static string
 NSString_to_cpp_string(NSString *str) {
   size_t length = [str length];
   string result;
@@ -36,44 +36,44 @@ NSString_to_cpp_string(NSString *str) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: call_NSSearchPathForDirectories
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
-static string 
+static string
 call_NSSearchPathForDirectories(NSSearchPathDirectory dirkey, NSSearchPathDomainMask domain) {
   // Ensure that Carbon has been initialized, and that we have an
   // auto-release pool.
   NSApplicationLoad();
-  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
   NSArray *paths = NSSearchPathForDirectoriesInDomains(dirkey, domain, YES);
   string result;
   if ([paths count] != 0) {
     result = NSString_to_cpp_string([paths objectAtIndex:0]);
   }
-  [pool release]; 
+  [pool release];
 
   return result;
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: get_osx_home_directory
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 static string
 get_osx_home_directory() {
   NSApplicationLoad();
-  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
   NSString *dir = NSHomeDirectory();
   string result = NSString_to_cpp_string(dir);
-  [pool release]; 
+  [pool release];
 
   return result;
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: find_osx_root_dir
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 string
 find_osx_root_dir() {

+ 12 - 12
direct/src/plugin/p3dAuthSession.cxx

@@ -1,4 +1,4 @@
-// Filename: P3DAuthSession.cxx
+// Filename: p3dAuthSession.cxx
 // Created by:  drose (17Sep09)
 //
 ////////////////////////////////////////////////////////////////////
@@ -34,7 +34,7 @@
 ////////////////////////////////////////////////////////////////////
 //     Function: P3DAuthSession::Constructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 P3DAuthSession::
 P3DAuthSession(P3DInstance *inst) :
@@ -62,7 +62,7 @@ P3DAuthSession(P3DInstance *inst) :
   }
 
   if (inst->_mf_reader.get_num_signatures() > 0) {
-    const P3DMultifileReader::CertChain &cert_chain = 
+    const P3DMultifileReader::CertChain &cert_chain =
       inst->_mf_reader.get_signature(0);
 
     if (cert_chain.size() > 0) {
@@ -87,7 +87,7 @@ P3DAuthSession(P3DInstance *inst) :
 ////////////////////////////////////////////////////////////////////
 //     Function: P3DAuthSession::Destructor
 //       Access: Public
-//  Description: 
+//  Description:
 ////////////////////////////////////////////////////////////////////
 P3DAuthSession::
 ~P3DAuthSession() {
@@ -130,7 +130,7 @@ shutdown(bool send_message) {
     int status;
     waitpid(_p3dcert_pid, &status, WNOHANG);
 #endif  // _WIN32
-    
+
     _p3dcert_running = false;
   }
   _p3dcert_started = false;
@@ -264,7 +264,7 @@ start_p3dcert() {
 
   _p3dcert_started = true;
   _p3dcert_running = true;
-  
+
   spawn_wait_thread();
 }
 
@@ -343,13 +343,13 @@ wt_thread_run() {
   }
   _p3dcert_pid = -1;
   _p3dcert_running = false;
-      
+
   nout << "p3dcert process has successfully stopped.\n";
   if (WIFEXITED(status)) {
     nout << "  exited normally, status = "
          << WEXITSTATUS(status) << "\n";
   } else if (WIFSIGNALED(status)) {
-    nout << "  signalled by " << WTERMSIG(status) << ", core = " 
+    nout << "  signalled by " << WTERMSIG(status) << ", core = "
          << WCOREDUMP(status) << "\n";
   } else if (WIFSTOPPED(status)) {
     nout << "  stopped by " << WSTOPSIG(status) << "\n";
@@ -383,7 +383,7 @@ win_create_process() {
 
   STARTUPINFO startup_info;
   ZeroMemory(&startup_info, sizeof(startup_info));
-  startup_info.cb = sizeof(startup_info); 
+  startup_info.cb = sizeof(startup_info);
 
   // Make sure the initial window is *shown* for this graphical app.
   startup_info.wShowWindow = SW_SHOW;
@@ -394,7 +394,7 @@ win_create_process() {
   // Construct the command-line string, containing the quoted
   // command-line arguments.
   ostringstream stream;
-  stream << "\"" << _p3dcert_exe << "\" \"" 
+  stream << "\"" << _p3dcert_exe << "\" \""
          << _cert_filename->get_filename() << "\" \"" << _cert_dir << "\"";
 
   // I'm not sure why CreateProcess wants a non-const char pointer for
@@ -410,10 +410,10 @@ win_create_process() {
   // from CreateProcessW().  Something about the way wx parses the
   // command-line parameters?  Well, whatever, we don't really need
   // the Unicode form anyway.
-  PROCESS_INFORMATION process_info; 
+  PROCESS_INFORMATION process_info;
   BOOL result = CreateProcess
     (_p3dcert_exe.c_str(), command_line, NULL, NULL, TRUE,
-     0, (void *)_env.c_str(), 
+     0, (void *)_env.c_str(),
      start_dir_cstr, &startup_info, &process_info);
   bool started_program = (result != 0);
 

+ 1 - 1
direct/src/plugin/p3dAuthSession.h

@@ -1,4 +1,4 @@
-// Filename: P3DAuthSession.h
+// Filename: p3dAuthSession.h
 // Created by:  drose (17Sep09)
 //
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
direct/src/plugin/p3dCert_strings.cxx

@@ -1,4 +1,4 @@
-// Filename: p3dCert_strings.h
+// Filename: p3dCert_strings.cxx
 // Created by:  rdb (25Mar15)
 //
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
direct/src/plugin/p3dCert_wx.cxx

@@ -1,4 +1,4 @@
-// Filename: p3dCert.cxx
+// Filename: p3dCert_wx.cxx
 // Created by:  drose (11Sep09)
 //
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
direct/src/plugin/p3dCert_wx.h

@@ -1,4 +1,4 @@
-// Filename: p3dCert.h
+// Filename: p3dCert_wx.h
 // Created by:  drose (11Sep09)
 //
 ////////////////////////////////////////////////////////////////////

+ 45 - 45
direct/src/plugin_activex/P3DActiveX.cpp

@@ -1,5 +1,3 @@
-// P3DActiveX.cpp : Implementation of CP3DActiveXApp and DLL registration.
-
 // Filename: P3DActiveX.cpp
 // Created by:  atrestman (14Sept09)
 //
@@ -14,6 +12,8 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+// P3DActiveX.cpp : Implementation of CP3DActiveXApp and DLL registration.
+
 #include "stdafx.h"
 #include "P3DActiveX.h"
 
@@ -38,23 +38,23 @@ const WORD _wVerMinor = 0;
 
 // Id taken from IMPLEMENT_OLECREATE_EX function in xxxCtrl.cpp
 
- 
+
 const CATID CLSID_SafeItem =
 { 0x924b4927, 0xd3ba, 0x41ea, 0x9f, 0x7e, 0x8a, 0x89, 0x19, 0x4a, 0xb3, 0xac };
- 
+
 // HRESULT CreateComponentCategory - Used to register ActiveX control as safe
 
- 
+
 HRESULT CreateComponentCategory(CATID catid, WCHAR *catDescription)
 {
     ICatRegister *pcr = NULL ;
     HRESULT hr = S_OK ;
- 
-    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
+
+    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr,
             NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
     if (FAILED(hr))
         return hr;
- 
+
     // Make sure the HKCR\Component Categories\{..catid...}
 
     // key is registered.
@@ -83,13 +83,13 @@ HRESULT CreateComponentCategory(CATID catid, WCHAR *catDescription)
           {
             len = 127;
           }
-        }   
+        }
     else
         {
           // TODO: Write an error handler;
 
         }
-    // The second parameter of StringCchCopy is 128 because you need 
+    // The second parameter of StringCchCopy is 128 because you need
 
     // room for a NULL-terminator.
 
@@ -97,25 +97,25 @@ HRESULT CreateComponentCategory(CATID catid, WCHAR *catDescription)
     // Make sure the description is null terminated.
 
     catinfo.szDescription[len + 1] = '\0';
- 
+
     hr = pcr->RegisterCategories(1, &catinfo);
     pcr->Release();
- 
+
     return hr;
 }
- 
+
 // HRESULT RegisterCLSIDInCategory -
 
 //      Register your component categories information
 
- 
+
 HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
 {
 // Register your component categories information.
 
     ICatRegister *pcr = NULL ;
     HRESULT hr = S_OK ;
-    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
+    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr,
                 NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
     if (SUCCEEDED(hr))
     {
@@ -125,22 +125,22 @@ HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
        rgcatid[0] = catid;
        hr = pcr->RegisterClassImplCategories(clsid, 1, rgcatid);
     }
- 
+
     if (pcr != NULL)
         pcr->Release();
-            
+
     return hr;
 }
- 
+
 // HRESULT UnRegisterCLSIDInCategory - Remove entries from the registry
 
- 
+
 HRESULT UnRegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
 {
     ICatRegister *pcr = NULL ;
     HRESULT hr = S_OK ;
- 
-    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, 
+
+    hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr,
             NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
     if (SUCCEEDED(hr))
     {
@@ -150,10 +150,10 @@ HRESULT UnRegisterCLSIDInCategory(REFCLSID clsid, CATID catid)
        rgcatid[0] = catid;
        hr = pcr->UnRegisterClassImplCategories(clsid, 1, rgcatid);
     }
- 
+
     if (pcr != NULL)
         pcr->Release();
- 
+
     return hr;
 }
 
@@ -195,41 +195,41 @@ STDAPI DllRegisterServer(void)
 {
     HRESULT hr;    // HResult used by Safety Functions
 
- 
+
     AFX_MANAGE_STATE(_afxModuleAddrThis);
- 
+
     if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
       return ResultFromScode(SELFREG_E_TYPELIB);
- 
+
     if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
       return ResultFromScode(SELFREG_E_CLASS);
- 
+
     // Mark the control as safe for initializing.
 
-                                             
-    hr = CreateComponentCategory(CATID_SafeForInitializing, 
+
+    hr = CreateComponentCategory(CATID_SafeForInitializing,
          L"Controls safely initializable from persistent data!");
     if (FAILED(hr))
       return hr;
- 
-    hr = RegisterCLSIDInCategory(CLSID_SafeItem, 
+
+    hr = RegisterCLSIDInCategory(CLSID_SafeItem,
          CATID_SafeForInitializing);
     if (FAILED(hr))
         return hr;
- 
+
     // Mark the control as safe for scripting.
 
- 
-    hr = CreateComponentCategory(CATID_SafeForScripting, 
+
+    hr = CreateComponentCategory(CATID_SafeForScripting,
                                  L"Controls safely  scriptable!");
     if (FAILED(hr))
         return hr;
- 
-    hr = RegisterCLSIDInCategory(CLSID_SafeItem, 
+
+    hr = RegisterCLSIDInCategory(CLSID_SafeItem,
                         CATID_SafeForScripting);
     if (FAILED(hr))
         return hr;
- 
+
     return NOERROR;
 }
 
@@ -241,26 +241,26 @@ STDAPI DllUnregisterServer(void)
 {
     HRESULT hr;    // HResult used by Safety Functions
 
- 
+
     AFX_MANAGE_STATE(_afxModuleAddrThis);
- 
+
     // Remove entries from the registry.
 
-    hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, 
+    hr = UnRegisterCLSIDInCategory(CLSID_SafeItem,
                      CATID_SafeForInitializing);
     if (FAILED(hr))
       return hr;
- 
-    hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, 
+
+    hr = UnRegisterCLSIDInCategory(CLSID_SafeItem,
                         CATID_SafeForScripting);
     if (FAILED(hr))
       return hr;
- 
+
     if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
       return ResultFromScode(SELFREG_E_TYPELIB);
- 
+
     if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
       return ResultFromScode(SELFREG_E_CLASS);
- 
+
     return NOERROR;
 }

+ 4 - 4
direct/src/plugin_activex/P3DActiveX.h

@@ -1,7 +1,3 @@
-#pragma once
-
-// P3DActiveX.h : main header file for P3DActiveX.DLL
-
 // Filename: P3DActiveX.h
 // Created by:  atrestman (14Sept09)
 //
@@ -16,6 +12,10 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+#pragma once
+
+// P3DActiveX.h : main header file for P3DActiveX.DLL
+
 #if !defined( __AFXCTL_H__ )
 #error include 'afxctl.h' before including this file
 #endif

+ 21 - 21
direct/src/plugin_activex/P3DActiveXCtrl.cpp

@@ -1,5 +1,3 @@
-// P3DActiveXCtrl.cpp : Implementation of the CP3DActiveXCtrl ActiveX Control class.
-
 // Filename: P3DActiveXCtrl.cpp
 // Created by:  atrestman (14Sept09)
 //
@@ -14,6 +12,8 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+// P3DActiveXCtrl.cpp : Implementation of the CP3DActiveXCtrl ActiveX Control class.
+
 #include "stdafx.h"
 #include "P3DActiveX.h"
 #include "P3DActiveXCtrl.h"
@@ -159,7 +159,7 @@ BOOL CP3DActiveXCtrl::CP3DActiveXCtrlFactory::UpdateRegistry(BOOL bRegister)
 
 // CP3DActiveXCtrl::CP3DActiveXCtrl - Constructor
 
-CP3DActiveXCtrl::CP3DActiveXCtrl() : m_instance( *this ), m_pPandaObject( NULL ) 
+CP3DActiveXCtrl::CP3DActiveXCtrl() : m_instance( *this ), m_pPandaObject( NULL )
 {
     InitializeIIDs(&IID_DP3DActiveX, &IID_DP3DActiveXEvents);
     // TODO: Initialize your control's instance data here.
@@ -194,7 +194,7 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv
       {
         _state = S_loading;
         // The first time we get the Draw message, we know we're
-        // sufficiently set up to start downloading the instance.  
+        // sufficiently set up to start downloading the instance.
         m_instance.read_tokens();
         get_twirl_bitmaps();
 
@@ -261,20 +261,20 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv
       // using to paint
       CDC dcMemory;
       dcMemory.CreateCompatibleDC(pdc);
-      
+
       // Select the bitmap into the in-memory DC
       dcMemory.SelectObject(&_twirl_bitmaps[step]);
-      
+
       // Find a centerpoint for the bitmap in the client area
       CRect rect;
       GetClientRect(&rect);
       int nX = rect.left + (rect.Width() - twirl_width) / 2;
       int nY = rect.top + (rect.Height() - twirl_height) / 2;
-      
+
       // Copy the bits from the in-memory DC into the on-screen DC to
       // actually do the painting. Use the centerpoint we computed for
       // the target offset.
-      pdc->BitBlt(nX, nY, twirl_width, twirl_height, &dcMemory, 
+      pdc->BitBlt(nX, nY, twirl_width, twirl_height, &dcMemory,
                   0, 0, SRCCOPY);
     }
 }
@@ -286,10 +286,10 @@ void CP3DActiveXCtrl::OnClose( DWORD dwSaveOption )
     // Make sure the init thread has finished.
     if (_state == S_loading) {
       nout << "Waiting for thread stop\n" << flush;
-      ::WaitForSingleObject( _init_not_running.m_hObject, INFINITE ); 
+      ::WaitForSingleObject( _init_not_running.m_hObject, INFINITE );
       nout << "Done waiting for thread stop\n" << flush;
     }
-    
+
 	COleControl::OnClose( dwSaveOption );
 }
 
@@ -302,7 +302,7 @@ void CP3DActiveXCtrl::DoPropExchange(CPropExchange* pPX)
     COleControl::DoPropExchange(pPX);
 
     // TODO: Call PX_ functions for each persistent custom property.
-    
+
     ExchangeProperties( pPX );
 }
 
@@ -384,21 +384,21 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
     {
         return ( error = -1 );
     }
-    CComPtr<IOleContainer> pOleContainer; 
-    HRESULT hr = m_spClientSite->GetContainer( &pOleContainer ); 
+    CComPtr<IOleContainer> pOleContainer;
+    HRESULT hr = m_spClientSite->GetContainer( &pOleContainer );
     if ( FAILED( hr ) || !pOleContainer )
     {
         return ( error = -1 );
     }
-    CComPtr<IHTMLDocument2> pHtml2Doc; 
-    hr = pOleContainer->QueryInterface( IID_IHTMLDocument, ( void** )&pHtml2Doc ); 
-    if ( FAILED( hr ) || !pHtml2Doc ) 
+    CComPtr<IHTMLDocument2> pHtml2Doc;
+    hr = pOleContainer->QueryInterface( IID_IHTMLDocument, ( void** )&pHtml2Doc );
+    if ( FAILED( hr ) || !pHtml2Doc )
     {
         return ( error = -1 );
     }
     BSTR url;
     hr = pHtml2Doc->get_URL( &url );
-    if ( FAILED( hr ) ||  !url ) 
+    if ( FAILED( hr ) ||  !url )
     {
         return ( error = -1 );
     }
@@ -422,10 +422,10 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
     if ( collectionLength < 1 )
     {
         // javascript engine was not specified on the page.
-        // hence we need to initialize it by infusing javascript 
+        // hence we need to initialize it by infusing javascript
         // element tags
 
-        CComPtr<IHTMLElement> spHtmlElement; 
+        CComPtr<IHTMLElement> spHtmlElement;
         hr = pHtml2Doc->createElement( CComBSTR( "script" ), &spHtmlElement );
         if ( SUCCEEDED( hr ) && spHtmlElement )
         {
@@ -443,7 +443,7 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
                         CComPtr<IHTMLDOMNode> newNode;
                         hr = spHtmlDomNode->appendChild( spElementDomNode, &newNode );
                     }
-                }                    
+                }
             }
         }
     }
@@ -594,7 +594,7 @@ get_twirl_bitmaps() {
 
   for (int step = 0; step < twirl_num_steps + 1; ++step) {
     get_twirl_data(twirl_data, twirl_size, step,
-                   m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b, 
+                   m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b,
                    m_instance._bgcolor_r, m_instance._bgcolor_g, m_instance._bgcolor_b);
 
     // Expand out the RGB channels into RGBA.

+ 2 - 2
direct/src/plugin_activex/P3DActiveXPropPage.cpp

@@ -1,5 +1,3 @@
-// P3DActiveXPropPage.cpp : Implementation of the CP3DActiveXPropPage property page class.
-
 // Filename: P3DActiveXPropPage.cpp
 // Created by:  atrestman (14Sept09)
 //
@@ -14,6 +12,8 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+// P3DActiveXPropPage.cpp : Implementation of the CP3DActiveXPropPage property page class.
+
 #include "stdafx.h"
 #include "P3DActiveX.h"
 #include "P3DActiveXPropPage.h"

+ 17 - 15
direct/src/showbase/BufferViewer.py

@@ -4,6 +4,7 @@ __all__ = ['BufferViewer']
 
 from panda3d.core import *
 from direct.task import Task
+from direct.task.TaskManagerGlobal import taskMgr
 from direct.directnotify.DirectNotifyGlobal import *
 from direct.showbase.DirectObject import DirectObject
 import math
@@ -11,7 +12,7 @@ import math
 class BufferViewer(DirectObject):
     notify = directNotify.newCategory('BufferViewer')
 
-    def __init__(self):
+    def __init__(self, win, parent):
         """Access: private.  Constructor."""
         self.enabled = 0
         size = ConfigVariableDouble('buffer-viewer-size', '0 0')
@@ -23,13 +24,14 @@ class BufferViewer(DirectObject):
         self.exclude = "none"
         self.cullbin = "fixed"
         self.cullsort = 10000
-        self.renderParent = render2d
+        self.win = win
+        self.engine = GraphicsEngine.getGlobalPtr()
+        self.renderParent = parent
         self.cards = []
         self.cardindex = 0
         self.cardmaker = CardMaker("cubemaker")
         self.cardmaker.setFrame(-1,1,-1,1)
         self.task = 0
-        self.window = 0
         self.dirty = 1
         self.accept("render-texture-targets-changed", self.refreshReadout)
         if (ConfigVariableBool("show-buffers", 0).getValue()):
@@ -198,7 +200,7 @@ class BufferViewer(DirectObject):
                 win = x.getWindow(iwin)
                 self.analyzeTextureSet(win, set)
         elif (x=="all"):
-            self.analyzeTextureSet(base.graphicsEngine, set)
+            self.analyzeTextureSet(self.engine, set)
         else: return
 
 
@@ -279,8 +281,8 @@ class BufferViewer(DirectObject):
         # Generate a list of cards and the corresponding windows.
         cards = []
         wins = []
-        for iwin in range(base.graphicsEngine.getNumWindows()):
-            win = base.graphicsEngine.getWindow(iwin)
+        for iwin in range(self.engine.getNumWindows()):
+            win = self.engine.getWindow(iwin)
             for itex in range(win.countTextures()):
                 tex = win.getTexture(itex)
                 if (tex in include) and (tex not in exclude):
@@ -358,16 +360,16 @@ class BufferViewer(DirectObject):
         bordersize = 4.0
 
         if (float(self.sizex)==0.0) and (float(self.sizey)==0.0):
-            sizey = int(0.4266666667 * base.win.getYSize())
+            sizey = int(0.4266666667 * self.win.getYSize())
             sizex = (sizey * aspectx) // aspecty
-            v_sizey = (base.win.getYSize() - (rows-1) - (rows*2)) // rows
+            v_sizey = (self.win.getYSize() - (rows-1) - (rows*2)) // rows
             v_sizex = (v_sizey * aspectx) // aspecty
             if (v_sizey < sizey) or (v_sizex < sizex):
                 sizey = v_sizey
                 sizex = v_sizex
 
             adjustment = 2
-            h_sizex = float (base.win.getXSize() - adjustment) / float (cols)
+            h_sizex = float (self.win.getXSize() - adjustment) / float (cols)
 
             h_sizex -= bordersize
             if (h_sizex < 1.0):
@@ -378,16 +380,16 @@ class BufferViewer(DirectObject):
                 sizey = h_sizey
                 sizex = h_sizex
         else:
-            sizex = int(self.sizex * 0.5 * base.win.getXSize())
-            sizey = int(self.sizey * 0.5 * base.win.getYSize())
+            sizex = int(self.sizex * 0.5 * self.win.getXSize())
+            sizey = int(self.sizey * 0.5 * self.win.getYSize())
             if (sizex == 0): sizex = (sizey*aspectx) // aspecty
             if (sizey == 0): sizey = (sizex*aspecty) // aspectx
 
         # Convert from pixels to render2d-units.
-        fsizex = (2.0 * sizex) / float(base.win.getXSize())
-        fsizey = (2.0 * sizey) / float(base.win.getYSize())
-        fpixelx = 2.0 / float(base.win.getXSize())
-        fpixely = 2.0 / float(base.win.getYSize())
+        fsizex = (2.0 * sizex) / float(self.win.getXSize())
+        fsizey = (2.0 * sizey) / float(self.win.getYSize())
+        fpixelx = 2.0 / float(self.win.getXSize())
+        fpixely = 2.0 / float(self.win.getYSize())
 
         # Choose directional offsets
         if (self.position == "llcorner"):

+ 4 - 10
direct/src/showbase/EventManager.py

@@ -7,15 +7,12 @@ from MessengerGlobal import *
 from direct.directnotify.DirectNotifyGlobal import *
 from direct.task.TaskManagerGlobal import taskMgr
 from panda3d.core import PStatCollector, EventQueue, EventHandler
+from panda3d.core import ConfigVariableBool
 
 class EventManager:
 
     notify = None
 
-    # delayed import, since this is imported by the Toontown Launcher
-    # before the complete PandaModules have been downloaded.
-    PStatCollector = None
-
     def __init__(self, eventQueue = None):
         """
         Create a C++ event queue and handler
@@ -27,15 +24,12 @@ class EventManager:
         self.eventQueue = eventQueue
         self.eventHandler = None
 
-        self._wantPstats = None # no config at this point
+        self._wantPstats = ConfigVariableBool('pstats-eventmanager', False)
 
     def doEvents(self):
         """
         Process all the events on the C++ event queue
         """
-        if self._wantPstats is None:
-            self._wantPstats = config.GetBool('pstats-eventmanager', 0)
-            EventManager.PStatCollector = PStatCollector
         # use different methods for handling events with and without pstats tracking
         # for efficiency
         if self._wantPstats:
@@ -141,10 +135,10 @@ class EventManager:
                 hyphen = name.find('-')
                 if hyphen >= 0:
                     name = name[0:hyphen]
-                pstatCollector = EventManager.PStatCollector('App:Show code:eventManager:' + name)
+                pstatCollector = PStatCollector('App:Show code:eventManager:' + name)
                 pstatCollector.start()
                 if self.eventHandler:
-                    cppPstatCollector = EventManager.PStatCollector(
+                    cppPstatCollector = PStatCollector(
                         'App:Show code:eventManager:' + name + ':C++')
 
             if paramList:

+ 3 - 3
direct/src/showbase/ExceptionVarDump.py

@@ -1,4 +1,5 @@
-from panda3d.direct import get_config_showbase
+__all__ = ["install"]
+
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.showbase.PythonUtil import fastRepr
 import sys
@@ -6,7 +7,6 @@ import types
 import traceback
 
 notify = directNotify.newCategory("ExceptionVarDump")
-config = get_config_showbase()
 
 reentry = 0
 
@@ -187,7 +187,7 @@ def install(log, upload):
     wantStackDumpLog = log
     wantStackDumpUpload = upload
 
-    dumpOnExceptionInit = config.GetBool('variable-dump-on-exception-init', 0)
+    dumpOnExceptionInit = ConfigVariableBool('variable-dump-on-exception-init', False)
     if dumpOnExceptionInit:
         # this mode doesn't completely work because exception objects
         # thrown by the interpreter don't get created until the

+ 3 - 3
direct/src/showbase/GarbageReport.py

@@ -281,7 +281,7 @@ class GarbageReport(Job):
         if self._args.findCycles:
             s = ['===== GarbageReport: \'%s\' (%s %s) =====' % (
                 self._args.name, self.numCycles,
-                choice(self.numCycles == 1, 'cycle', 'cycles'))]
+                ('cycle' if self.numCycles == 1 else 'cycles'))]
         else:
             s = ['===== GarbageReport: \'%s\' =====' % (
                 self._args.name)]
@@ -499,7 +499,7 @@ class GarbageReport(Job):
         rootId = index
         # check if the root object is one of the garbage instances (has __del__)
         objId = id(self.garbage[rootId])
-        numDelInstances = choice(objId in self.garbageInstanceIds, 1, 0)
+        numDelInstances = int(objId in self.garbageInstanceIds)
         stateStack.push(([rootId], rootId, numDelInstances, 0))
         while True:
             yield None
@@ -535,7 +535,7 @@ class GarbageReport(Job):
                 elif refId is not None:
                     # check if this object is one of the garbage instances (has __del__)
                     objId = id(self.garbage[refId])
-                    numDelInstances += choice(objId in self.garbageInstanceIds, 1, 0)
+                    numDelInstances += int(objId in self.garbageInstanceIds)
                     # this refId does not complete a cycle. Mark down
                     # where we are in this list of referents, then
                     # start looking through the referents of the new refId

+ 26 - 8
direct/src/showbase/Loader.py

@@ -167,7 +167,7 @@ class Loader(DirectObject):
 
             if not okMissing and None in result:
                 message = 'Could not load model file(s): %s' % (modelList,)
-                raise IOError, message
+                raise IOError(message)
 
             if gotList:
                 return result
@@ -503,7 +503,7 @@ class Loader(DirectObject):
         if font == None:
             if not okMissing:
                 message = 'Could not load font file: %s' % (modelPath)
-                raise IOError, message
+                raise IOError(message)
             # If we couldn't load the model, at least return an
             # empty font.
             font = StaticTextFont(PandaNode("empty"))
@@ -620,7 +620,7 @@ class Loader(DirectObject):
             texture = TexturePool.loadTexture(texturePath, alphaPath, 0, 0, readMipmaps, loaderOptions)
         if not texture and not okMissing:
             message = 'Could not load texture: %s' % (texturePath)
-            raise IOError, message
+            raise IOError(message)
 
         if minfilter is not None:
             texture.setMinfilter(minfilter)
@@ -677,7 +677,7 @@ class Loader(DirectObject):
         texture = TexturePool.load3dTexture(texturePattern, readMipmaps, loaderOptions)
         if not texture and not okMissing:
             message = 'Could not load 3-D texture: %s' % (texturePattern)
-            raise IOError, message
+            raise IOError(message)
 
         if minfilter is not None:
             texture.setMinfilter(minfilter)
@@ -730,7 +730,7 @@ class Loader(DirectObject):
         texture = TexturePool.loadCubeMap(texturePattern, readMipmaps, loaderOptions)
         if not texture and not okMissing:
             message = 'Could not load cube map: %s' % (texturePattern)
-            raise IOError, message
+            raise IOError(message)
 
         if minfilter is not None:
             texture.setMinfilter(minfilter)
@@ -838,7 +838,7 @@ class Loader(DirectObject):
                 cb.requests[request] = True
             return cb
 
-    def unloadSfx (self, sfx):
+    def unloadSfx(self, sfx):
         if (sfx):
             if(self.base.sfxManagerList):
                 self.base.sfxManagerList[0].uncacheSound (sfx.getName())
@@ -852,11 +852,11 @@ class Loader(DirectObject):
 ##             nodeCount += 1
 ##             self.makeNodeNamesUnique(nodePath.getChild(i), nodeCount)
 
-    def loadShader (self, shaderPath, okMissing = False):
+    def loadShader(self, shaderPath, okMissing = False):
         shader = ShaderPool.loadShader (shaderPath)
         if not shader and not okMissing:
             message = 'Could not load shader file: %s' % (shaderPath)
-            raise IOError, message
+            raise IOError(message)
         return shader
 
     def unloadShader(self, shaderPath):
@@ -948,3 +948,21 @@ class Loader(DirectObject):
             object = request.getSuccess()
 
         cb.gotObject(i, object)
+
+    load_model = loadModel
+    cancel_request = cancelRequest
+    is_request_pending = isRequestPending
+    unload_model = unloadModel
+    save_model = saveModel
+    load_font = loadFont
+    load_texture = loadTexture
+    load_3d_texture = load3DTexture
+    load_cube_map = loadCubeMap
+    unload_texture = unloadTexture
+    load_sfx = loadSfx
+    load_music = loadMusic
+    load_sound = loadSound
+    unload_sfx = unloadSfx
+    load_shader = loadShader
+    unload_shader = unloadShader
+    async_flatten_strong = asyncFlattenStrong

+ 2 - 7
direct/src/showbase/ObjectPool.py

@@ -5,7 +5,6 @@ __all__ = ['Diff', 'ObjectPool']
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.showbase.PythonUtil import invertDictLossless, makeList, safeRepr
 from direct.showbase.PythonUtil import getNumberedTypedString, getNumberedTypedSortedString
-from direct.showbase.PythonUtil import getNumberedTypedSortedStringWithReferrersGen
 import gc
 
 class Diff:
@@ -97,7 +96,7 @@ class ObjectPool:
                 s += '\n%s\t%s' % (count, typ)
         return s
 
-    def printObjsByType(self, printReferrers=False):
+    def printObjsByType(self):
         print   'Object Pool: Objects By Type'
         print '\n============================'
         counts = list(set(self._count2types.keys()))
@@ -109,11 +108,7 @@ class ObjectPool:
             types = makeList(self._count2types[count])
             for typ in types:
                 print 'TYPE: %s, %s objects' % (repr(typ), len(self._type2objs[typ]))
-                if printReferrers:
-                    for line in getNumberedTypedSortedStringWithReferrersGen(self._type2objs[typ]):
-                        print line
-                else:
-                    print getNumberedTypedSortedString(self._type2objs[typ])
+                print getNumberedTypedSortedString(self._type2objs[typ])
 
     def containerLenStr(self):
         s  =   'Object Pool: Container Lengths'

+ 9 - 7
direct/src/showbase/OnScreenDebug.py

@@ -9,8 +9,10 @@ from direct.gui import OnscreenText
 from direct.directtools import DirectUtil
 
 class OnScreenDebug:
+
+    enabled = ConfigVariableBool("on-screen-debug-enabled", False)
+
     def __init__(self):
-        self.enabled = config.GetBool("on-screen-debug-enabled", 0)
         self.onScreenText = None
         self.frame = 0
         self.text = ""
@@ -20,17 +22,17 @@ class OnScreenDebug:
         if self.onScreenText:
             return
 
-        fontPath = config.GetString("on-screen-debug-font", "cmtt12")
-        fontScale = config.GetFloat("on-screen-debug-font-scale", 0.05)
+        fontPath = ConfigVariableString("on-screen-debug-font", "cmtt12").value
+        fontScale = ConfigVariableDouble("on-screen-debug-font-scale", 0.05).value
 
         color = {
             "black": Vec4(0, 0, 0, 1),
             "white": Vec4(1, 1, 1, 1),
             }
-        fgColor = color[config.GetString("on-screen-debug-fg-color", "white")]
-        bgColor = color[config.GetString("on-screen-debug-bg-color", "black")]
-        fgColor.setW(config.GetFloat("on-screen-debug-fg-alpha", 0.85))
-        bgColor.setW(config.GetFloat("on-screen-debug-bg-alpha", 0.85))
+        fgColor = color[ConfigVariableString("on-screen-debug-fg-color", "white").value]
+        bgColor = color[ConfigVariableString("on-screen-debug-bg-color", "black").value]
+        fgColor.setW(ConfigVariableDouble("on-screen-debug-fg-alpha", 0.85).value)
+        bgColor.setW(ConfigVariableDouble("on-screen-debug-bg-alpha", 0.85).value)
 
         font = loader.loadFont(fontPath)
         if not font.isValid():

Diferenças do arquivo suprimidas por serem muito extensas
+ 431 - 494
direct/src/showbase/PythonUtil.py


+ 147 - 61
direct/src/showbase/ShowBase.py

@@ -1,4 +1,6 @@
-"""Undocumented Module"""
+""" This module contains ShowBase, an application framework responsible
+for opening a graphical display, setting up input devices and creating
+the scene graph. """
 
 __all__ = ['ShowBase', 'WindowControls']
 
@@ -24,29 +26,24 @@ from BulletinBoardGlobal import bulletinBoard
 from direct.task.TaskManagerGlobal import taskMgr
 from JobManagerGlobal import jobMgr
 from EventManagerGlobal import eventMgr
-from PythonUtil import *
-from direct.showbase import PythonUtil
-#from direct.interval.IntervalManager import ivalMgr
+#from PythonUtil import *
 from direct.interval import IntervalManager
 from direct.showbase.BufferViewer import BufferViewer
 from direct.task import Task
-from direct.directutil import Verify
-from direct.showbase import GarbageReport
 import sys
 import Loader
 import time
 import atexit
+import importlib
 from direct.showbase import ExceptionVarDump
 import DirectObject
 import SfxPlayer
 if __debug__:
+    from direct.showbase import GarbageReport
     from direct.directutil import DeltaProfiler
-import OnScreenDebug
+    import OnScreenDebug
 import AppRunnerGlobal
 
-builtins.FADE_SORT_INDEX = 1000
-builtins.NO_FADE_SORT_INDEX = 2000
-
 def legacyRun():
     builtins.base.notify.warning("run() is deprecated, use base.run() instead")
     builtins.base.run()
@@ -74,22 +71,22 @@ class ShowBase(DirectObject.DirectObject):
         if logStackDump or uploadStackDump:
             ExceptionVarDump.install(logStackDump, uploadStackDump)
 
-        self.__autoGarbageLogging = self.__dev__ and self.config.GetBool('auto-garbage-logging', False)
+        if __debug__:
+            self.__autoGarbageLogging = self.__dev__ and self.config.GetBool('auto-garbage-logging', False)
 
         ## The directory containing the main Python file of this application.
         self.mainDir = ExecutionEnvironment.getEnvironmentVariable("MAIN_DIR")
+        self.main_dir = self.mainDir
 
         ## This contains the global appRunner instance, as imported from
         ## AppRunnerGlobal.  This will be None if we are not running in the
         ## runtime environment (ie. from a .p3d file).
         self.appRunner = AppRunnerGlobal.appRunner
+        self.app_runner = self.appRunner
 
         #debug running multiplier
         self.debugRunningMultiplier = 4
 
-        # Setup wantVerifyPdb as soon as reasonable:
-        Verify.wantVerifyPdb = self.config.GetBool('want-verify-pdb', 0)
-
         # [gjeon] to disable sticky keys
         if self.config.GetBool('disable-sticky-keys', 0):
             storeAccessibilityShortcutKeys()
@@ -215,6 +212,7 @@ class ShowBase(DirectObject.DirectObject):
 
         ## The global graphics engine, ie. GraphicsEngine.getGlobalPtr()
         self.graphicsEngine = GraphicsEngine.getGlobalPtr()
+        self.graphics_engine = self.graphicsEngine
         self.setupRender()
         self.setupRender2d()
         self.setupDataGraph()
@@ -283,6 +281,7 @@ class ShowBase(DirectObject.DirectObject):
         self.bboard = bulletinBoard
         ## The global task manager, as imported from TaskManagerGlobal.
         self.taskMgr = taskMgr
+        self.task_mgr = taskMgr
         ## The global job manager, as imported from JobManagerGlobal.
         self.jobMgr = jobMgr
 
@@ -331,7 +330,7 @@ class ShowBase(DirectObject.DirectObject):
             # assigned to a single CPU
             autoAffinity = self.config.GetBool('auto-single-cpu-affinity', 0)
             affinity = None
-            if autoAffinity and ('clientIndex' in builtins.__dict__):
+            if autoAffinity and hasattr(builtins, 'clientIndex'):
                 affinity = abs(int(builtins.clientIndex))
             else:
                 affinity = self.config.GetInt('client-cpu-affinity', -1)
@@ -342,7 +341,7 @@ class ShowBase(DirectObject.DirectObject):
                 TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32))
 
         # Make sure we're not making more than one ShowBase.
-        if 'base' in builtins.__dict__:
+        if hasattr(builtins, 'base'):
             raise StandardError, "Attempt to spawn multiple ShowBase instances!"
 
         # DO NOT ADD TO THIS LIST.  We're trying to phase out the use of
@@ -374,24 +373,22 @@ class ShowBase(DirectObject.DirectObject):
         builtins.wantUberdog = self.config.GetBool('want-uberdog', 1)
         if __debug__:
             builtins.deltaProfiler = DeltaProfiler.DeltaProfiler("ShowBase")
-        builtins.onScreenDebug = OnScreenDebug.OnScreenDebug()
+            self.onScreenDebug = OnScreenDebug.OnScreenDebug()
+            builtins.onScreenDebug = self.onScreenDebug
 
         if self.wantRender2dp:
             builtins.render2dp = self.render2dp
             builtins.aspect2dp = self.aspect2dp
             builtins.pixel2dp = self.pixel2dp
 
-        if __dev__:
-            ShowBase.notify.debug('__dev__ == %s' % __dev__)
+        if self.__dev__:
+            ShowBase.notify.debug('__dev__ == %s' % self.__dev__)
         else:
-            ShowBase.notify.info('__dev__ == %s' % __dev__)
+            ShowBase.notify.info('__dev__ == %s' % self.__dev__)
 
         self.createBaseAudioManagers()
 
-        # set up recording of Functor creation stacks in __dev__
-        PythonUtil.recordFunctorCreationStacks()
-
-        if __dev__ or self.config.GetBool('want-e3-hacks', False):
+        if self.__dev__ or self.config.GetBool('want-e3-hacks', False):
             if self.config.GetBool('track-gui-items', True):
                 # dict of guiId to gui item, for tracking down leaks
                 self.guiItems = {}
@@ -432,9 +429,10 @@ class ShowBase(DirectObject.DirectObject):
 
         # Offscreen buffer viewing utility.
         # This needs to be allocated even if the viewer is off.
-        self.bufferViewer = BufferViewer()
         if self.wantRender2dp:
-            self.bufferViewer.setRenderParent(self.render2dp)
+            self.bufferViewer = BufferViewer(self.win, self.render2dp)
+        else:
+            self.bufferViewer = BufferViewer(self.win, self.render2d)
 
         if self.windowType != 'none':
             if fStartDirect: # [gjeon] if this is False let them start direct manually
@@ -463,7 +461,8 @@ class ShowBase(DirectObject.DirectObject):
         some Panda config settings. """
 
         try:
-            import profile, pstats
+            profile = importlib.import_module('profile')
+            pstats = importlib.import_module('pstats')
         except ImportError:
             return
 
@@ -996,9 +995,9 @@ class ShowBase(DirectObject.DirectObject):
         else:
             # Spawn it after igloop (at the end of each frame)
             self.taskMgr.remove('clientSleep')
-            self.taskMgr.add(self.sleepCycleTask, 'clientSleep', sort = 55)
+            self.taskMgr.add(self.__sleepCycleTask, 'clientSleep', sort = 55)
 
-    def sleepCycleTask(self, task):
+    def __sleepCycleTask(self, task):
         Thread.sleep(self.clientSleep)
         #time.sleep(self.clientSleep)
         return Task.cont
@@ -1645,23 +1644,26 @@ class ShowBase(DirectObject.DirectObject):
 
     def addAngularIntegrator(self):
         if not self.physicsMgrAngular:
-            from panda3d.physics import AngularEulerIntegrator
+            physics = importlib.import_module('panda3d.physics')
             self.physicsMgrAngular = 1
-            integrator = AngularEulerIntegrator()
+            integrator = physics.AngularEulerIntegrator()
             self.physicsMgr.attachAngularIntegrator(integrator)
 
     def enableParticles(self):
         if not self.particleMgrEnabled:
+            # Use importlib to prevent this import from being picked up
+            # by modulefinder when packaging an application.
+
             if not self.particleMgr:
-                from direct.particles.ParticleManagerGlobal import particleMgr
-                self.particleMgr = particleMgr
+                PMG = importlib.import_module('direct.particles.ParticleManagerGlobal')
+                self.particleMgr = PMG.particleMgr
                 self.particleMgr.setFrameStepping(1)
 
             if not self.physicsMgr:
-                from PhysicsManagerGlobal import physicsMgr
-                from panda3d.physics import LinearEulerIntegrator
-                self.physicsMgr = physicsMgr
-                integrator = LinearEulerIntegrator()
+                PMG = importlib.import_module('direct.showbase.PhysicsManagerGlobal')
+                physics = importlib.import_module('panda3d.physics')
+                self.physicsMgr = PMG.physicsMgr
+                integrator = physics.LinearEulerIntegrator()
                 self.physicsMgr.attachLinearIntegrator(integrator)
 
             self.particleMgrEnabled = 1
@@ -1789,12 +1791,14 @@ class ShowBase(DirectObject.DirectObject):
     # backwards compatibility. Please do not add code here, add
     # it to the loader.
     def loadSfx(self, name):
+        self.notify.warning("base.loadSfx is deprecated, use base.loader.loadSfx instead.")
         return self.loader.loadSfx(name)
 
     # This function should only be in the loader but is here for
     # backwards compatibility. Please do not add code here, add
     # it to the loader.
     def loadMusic(self, name):
+        self.notify.warning("base.loadMusic is deprecated, use base.loader.loadMusic instead.")
         return self.loader.loadMusic(name)
 
     def playSfx(
@@ -1885,9 +1889,10 @@ class ShowBase(DirectObject.DirectObject):
         return Task.cont
 
     def __igLoop(self, state):
-        # We render the watch variables for the onScreenDebug as soon
-        # as we reasonably can before the renderFrame().
-        onScreenDebug.render()
+        if __debug__:
+            # We render the watch variables for the onScreenDebug as soon
+            # as we reasonably can before the renderFrame().
+            self.onScreenDebug.render()
 
         if self.recorder:
             self.recorder.recordFrame()
@@ -1899,9 +1904,10 @@ class ShowBase(DirectObject.DirectObject):
         if self.multiClientSleep:
             time.sleep(0)
 
-        # We clear the text buffer for the onScreenDebug as soon
-        # as we reasonably can after the renderFrame().
-        onScreenDebug.clear()
+        if __debug__:
+            # We clear the text buffer for the onScreenDebug as soon
+            # as we reasonably can after the renderFrame().
+            self.onScreenDebug.clear()
 
         if self.recorder:
             self.recorder.playFrame()
@@ -1924,14 +1930,14 @@ class ShowBase(DirectObject.DirectObject):
 
 
     def __igLoopSync(self, state):
-        # We render the watch variables for the onScreenDebug as soon
-        # as we reasonably can before the renderFrame().
-        onScreenDebug.render()
+        if __debug__:
+            # We render the watch variables for the onScreenDebug as soon
+            # as we reasonably can before the renderFrame().
+            self.onScreenDebug.render()
 
         if self.recorder:
             self.recorder.recordFrame()
 
-
         self.cluster.collectData()
 
         # Finally, render the frame.
@@ -1941,9 +1947,10 @@ class ShowBase(DirectObject.DirectObject):
         if self.multiClientSleep:
             time.sleep(0)
 
-        # We clear the text buffer for the onScreenDebug as soon
-        # as we reasonably can after the renderFrame().
-        onScreenDebug.clear()
+        if __debug__:
+            # We clear the text buffer for the onScreenDebug as soon
+            # as we reasonably can after the renderFrame().
+            self.onScreenDebug.clear()
 
         if self.recorder:
             self.recorder.playFrame()
@@ -2178,8 +2185,10 @@ class ShowBase(DirectObject.DirectObject):
             self.texmem = None
             return
 
-        from direct.showutil.TexMemWatcher import TexMemWatcher
-        self.texmem = TexMemWatcher()
+        # Use importlib to prevent this import from being picked up
+        # by modulefinder when packaging an application.
+        TMW = importlib.import_module('direct.showutil.TexMemWatcher')
+        self.texmem = TMW.TexMemWatcher()
 
     def toggleShowVertices(self):
         """ Toggles a mode that visualizes vertex density per screen
@@ -2675,16 +2684,18 @@ class ShowBase(DirectObject.DirectObject):
             if not properties.getOpen():
                 # If the user closes the main window, we should exit.
                 self.notify.info("User closed main window.")
-                if self.__autoGarbageLogging:
-                    GarbageReport.b_checkForGarbageLeaks()
+                if __debug__:
+                    if self.__autoGarbageLogging:
+                        GarbageReport.b_checkForGarbageLeaks()
                 self.userExit()
 
             if properties.getForeground() and not self.mainWinForeground:
                 self.mainWinForeground = 1
             elif not properties.getForeground() and self.mainWinForeground:
                 self.mainWinForeground = 0
-                if self.__autoGarbageLogging:
-                    GarbageReport.b_checkForGarbageLeaks()
+                if __debug__:
+                    if self.__autoGarbageLogging:
+                        GarbageReport.b_checkForGarbageLeaks()
 
             if properties.getMinimized() and not self.mainWinMinimized:
                 # If the main window is minimized, throw an event to
@@ -2814,7 +2825,10 @@ class ShowBase(DirectObject.DirectObject):
 
         init_app_for_gui()
 
-        import wx
+        # Use importlib to prevent this import from being picked up
+        # by modulefinder when packaging an application.
+        wx = importlib.import_module('wx')
+
         # Create a new base.wxApp.
         self.wxApp = wx.PySimpleApp(redirect = False)
 
@@ -2889,8 +2903,10 @@ class ShowBase(DirectObject.DirectObject):
             # Don't do this twice.
             return
 
-        from Tkinter import tkinter
-        import Pmw
+        # Use importlib to prevent this import from being picked up
+        # by modulefinder when packaging an application.
+        tkinter = importlib.import_module('Tkinter').tkinter
+        Pmw = importlib.import_module('Pmw')
 
         # Create a new Tk root.
         self.tkRoot = Pmw.initialise()
@@ -2953,8 +2969,10 @@ class ShowBase(DirectObject.DirectObject):
         self.startWx(fWantWx)
         self.wantDirect = fWantDirect
         if self.wantDirect:
-            from direct.directtools.DirectSession import DirectSession
-            self.direct = DirectSession()
+            # Use importlib to prevent this import from being picked up
+            # by modulefinder when packaging an application.
+            DirectSession = importlib.import_module('direct.directtools.DirectSession')
+            self.direct = DirectSession.DirectSession()
             self.direct.enable()
             builtins.direct = self.direct
         else:
@@ -2992,6 +3010,74 @@ class ShowBase(DirectObject.DirectObject):
             self.taskMgr.run()
 
 
+    # Snake-case aliases, for people who prefer these.  We're in the process
+    # of migrating everyone to use the snake-case alternatives.
+    make_default_pipe = makeDefaultPipe
+    make_module_pipe = makeModulePipe
+    make_all_pipes = makeAllPipes
+    open_window = openWindow
+    close_window = closeWindow
+    open_default_window = openDefaultWindow
+    open_main_window = openMainWindow
+    set_sleep = setSleep
+    set_frame_rate_meter = setFrameRateMeter
+    set_scene_graph_analyzer_meter = setSceneGraphAnalyzerMeter
+    setup_window_controls = setupWindowControls
+    setup_render = setupRender
+    setup_render2d = setupRender2d
+    setup_render2dp = setupRender2dp
+    set_aspect_ratio = setAspectRatio
+    get_aspect_ratio = getAspectRatio
+    get_size = getSize
+    make_camera = makeCamera
+    make_camera2d = makeCamera2d
+    make_camera2dp = makeCamera2dp
+    setup_data_graph = setupDataGraph
+    setup_mouse = setupMouse
+    setup_mouse_cb = setupMouseCB
+    enable_software_mouse_pointer = enableSoftwareMousePointer
+    add_angular_integrator = addAngularIntegrator
+    enable_particles = enableParticles
+    disable_particles = disableParticles
+    toggle_particles = toggleParticles
+    create_stats = createStats
+    add_sfx_manager = addSfxManager
+    enable_music = enableMusic
+    enable_sound_effects = enableSoundEffects
+    disable_all_audio = disableAllAudio
+    enable_all_audio = enableAllAudio
+    init_shadow_trav = initShadowTrav
+    get_background_color = getBackgroundColor
+    set_background_color = setBackgroundColor
+    toggle_backface = toggleBackface
+    backface_culling_on = backfaceCullingOn
+    backface_culling_off = backfaceCullingOff
+    toggle_texture = toggleTexture
+    texture_on = textureOn
+    texture_off = textureOff
+    toggle_wireframe = toggleWireframe
+    wireframe_on = wireframeOn
+    wireframe_off = wireframeOff
+    disable_mouse = disableMouse
+    enable_mouse = enableMouse
+    silence_input = silenceInput
+    revive_input = reviveInput
+    set_mouse_on_node = setMouseOnNode
+    change_mouse_interface = changeMouseInterface
+    use_drive = useDrive
+    use_trackball = useTrackball
+    toggle_tex_mem = toggleTexMem
+    toggle_show_vertices = toggleShowVertices
+    oobe_cull = oobeCull
+    show_camera_frustum = showCameraFrustum
+    remove_camera_frustum = removeCameraFrustum
+    save_cube_map = saveCubeMap
+    save_sphere_map = saveSphereMap
+    start_wx = startWx
+    start_tk = startTk
+    start_direct = startDirect
+
+
 # A class to encapsulate information necessary for multiwindow support.
 class WindowControls:
     def __init__(

+ 9 - 8
direct/src/showbase/Transitions.py

@@ -3,7 +3,8 @@
 __all__ = ['Transitions']
 
 from panda3d.core import *
-from direct.gui.DirectGui import *
+from direct.gui.DirectGui import DirectFrame
+from direct.gui import DirectGuiGlobals as DGG
 from direct.interval.LerpInterval import LerpColorScaleInterval, LerpColorInterval, LerpScaleInterval, LerpPosInterval
 from direct.interval.MetaInterval import Sequence, Parallel
 from direct.interval.FunctionInterval import Func
@@ -91,7 +92,7 @@ class Transitions:
         """
         #self.noTransitions() masad: this creates a one frame pop, is it necessary?
         self.loadFade()
-        transitionIval = Sequence(Func(self.fade.reparentTo, aspect2d, FADE_SORT_INDEX),
+        transitionIval = Sequence(Func(self.fade.reparentTo, aspect2d, DGG.FADE_SORT_INDEX),
                                   Func(self.fade.showThrough),  # in case aspect2d is hidden for some reason
                                   self.lerpFunc(self.fade, t,
                                                 self.alphaOff,
@@ -112,7 +113,7 @@ class Transitions:
         self.noTransitions()
         self.loadFade()
 
-        transitionIval = Sequence(Func(self.fade.reparentTo,aspect2d,FADE_SORT_INDEX),
+        transitionIval = Sequence(Func(self.fade.reparentTo,aspect2d,DGG.FADE_SORT_INDEX),
                                   Func(self.fade.showThrough),  # in case aspect2d is hidden for some reason
                                   self.lerpFunc(self.fade, t,
                                                 self.alphaOn,
@@ -164,7 +165,7 @@ class Transitions:
             # Fade out immediately with no lerp
             self.noTransitions()
             self.loadFade()
-            self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
+            self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
             self.fade.setColor(self.alphaOn)
         elif ConfigVariableBool('no-loading-screen', False):
             if finishIval:
@@ -188,7 +189,7 @@ class Transitions:
         #print "transitiosn: fadeScreen"
         self.noTransitions()
         self.loadFade()
-        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
+        self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
         self.fade.setColor(self.alphaOn[0],
                            self.alphaOn[1],
                            self.alphaOn[2],
@@ -203,7 +204,7 @@ class Transitions:
         #print "transitiosn: fadeScreenColor"
         self.noTransitions()
         self.loadFade()
-        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
+        self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
         self.fade.setColor(color)
 
     def noFade(self):
@@ -245,7 +246,7 @@ class Transitions:
         if (t == 0):
             self.iris.detachNode()
         else:
-            self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
+            self.iris.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
 
             self.transitionIval = Sequence(LerpScaleInterval(self.iris, t,
                                                    scale = 0.18,
@@ -272,7 +273,7 @@ class Transitions:
             self.iris.detachNode()
             self.fadeOut(0)
         else:
-            self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
+            self.iris.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
 
             self.transitionIval = Sequence(LerpScaleInterval(self.iris, t,
                                                    scale = 0.01,

+ 2 - 2
direct/src/showutil/FreezeTool.py

@@ -30,8 +30,8 @@ isDebugBuild = (python.lower().endswith('_d'))
 # These are modules that Python always tries to import up-front.  They
 # must be frozen in any main.exe.
 startupModules = [
-    'site', 'sitecustomize', 'os', 'encodings.cp1252',
-    'encodings.latin_1', 'encodings.utf_8', 'io', 'org',
+    'os', 'encodings.cp1252',
+    'encodings.latin_1', 'encodings.utf_8', 'io',
     ]
 
 # These are missing modules that we've reported already this session.

+ 7 - 0
direct/src/stdpy/thread.py

@@ -70,6 +70,13 @@ class LockType:
     def __exit__(self, t, v, tb):
         self.release()
 
+# Helper to generate new thread names
+_counter = 0
+def _newname(template="Thread-%d"):
+    global _counter
+    _counter = _counter + 1
+    return template % _counter
+
 _threads = {}
 _nextThreadId = 0
 _threadsLock = core.Mutex('thread._threadsLock')

+ 106 - 105
direct/src/stdpy/threading.py

@@ -42,6 +42,7 @@ __all__ = [
     ]
 
 local = _thread._local
+_newname = _thread._newname
 
 class ThreadBase:
     """ A base class for both Thread and ExternalThread in this
@@ -98,8 +99,7 @@ class Thread(ThreadBase):
         self.__kwargs = kwargs
 
         if not name:
-            import threading2
-            name = threading2._newname()
+            name = _newname()
 
         current = current_thread()
         self.__dict__['daemon'] = current.daemon
@@ -404,106 +404,107 @@ def setprofile(func):
 def stack_size(size = None):
     raise ThreadError
 
-def _test():
-
-    from collections import deque
-    _sleep = core.Thread.sleep
-
-    _VERBOSE = False
-
-    class _Verbose(object):
-
-        def __init__(self, verbose=None):
-            if verbose is None:
-                verbose = _VERBOSE
-            self.__verbose = verbose
-
-        def _note(self, format, *args):
-            if self.__verbose:
-                format = format % args
-                format = "%s: %s\n" % (
-                    currentThread().getName(), format)
-                _sys.stderr.write(format)
-
-    class BoundedQueue(_Verbose):
-
-        def __init__(self, limit):
-            _Verbose.__init__(self)
-            self.mon = Lock(name = "BoundedQueue.mon")
-            self.rc = Condition(self.mon)
-            self.wc = Condition(self.mon)
-            self.limit = limit
-            self.queue = deque()
-
-        def put(self, item):
-            self.mon.acquire()
-            while len(self.queue) >= self.limit:
-                self._note("put(%s): queue full", item)
-                self.wc.wait()
-            self.queue.append(item)
-            self._note("put(%s): appended, length now %d",
-                       item, len(self.queue))
-            self.rc.notify()
-            self.mon.release()
-
-        def get(self):
-            self.mon.acquire()
-            while not self.queue:
-                self._note("get(): queue empty")
-                self.rc.wait()
-            item = self.queue.popleft()
-            self._note("get(): got %s, %d left", item, len(self.queue))
-            self.wc.notify()
-            self.mon.release()
-            return item
-
-    class ProducerThread(Thread):
-
-        def __init__(self, queue, quota):
-            Thread.__init__(self, name="Producer")
-            self.queue = queue
-            self.quota = quota
-
-        def run(self):
-            from random import random
-            counter = 0
-            while counter < self.quota:
-                counter = counter + 1
-                self.queue.put("%s.%d" % (self.getName(), counter))
-                _sleep(random() * 0.00001)
-
-
-    class ConsumerThread(Thread):
-
-        def __init__(self, queue, count):
-            Thread.__init__(self, name="Consumer")
-            self.queue = queue
-            self.count = count
-
-        def run(self):
-            while self.count > 0:
-                item = self.queue.get()
-                print item
-                self.count = self.count - 1
-
-    NP = 3
-    QL = 4
-    NI = 5
-
-    Q = BoundedQueue(QL)
-    P = []
-    for i in range(NP):
-        t = ProducerThread(Q, NI)
-        t.setName("Producer-%d" % (i+1))
-        P.append(t)
-    C = ConsumerThread(Q, NI*NP)
-    for t in P:
-        t.start()
-        _sleep(0.000001)
-    C.start()
-    for t in P:
-        t.join()
-    C.join()
-
-if __name__ == '__main__':
-    _test()
+if __debug__:
+    def _test():
+        from collections import deque
+
+        _sleep = core.Thread.sleep
+
+        _VERBOSE = False
+
+        class _Verbose(object):
+
+            def __init__(self, verbose=None):
+                if verbose is None:
+                    verbose = _VERBOSE
+                self.__verbose = verbose
+
+            def _note(self, format, *args):
+                if self.__verbose:
+                    format = format % args
+                    format = "%s: %s\n" % (
+                        currentThread().getName(), format)
+                    _sys.stderr.write(format)
+
+        class BoundedQueue(_Verbose):
+
+            def __init__(self, limit):
+                _Verbose.__init__(self)
+                self.mon = Lock(name = "BoundedQueue.mon")
+                self.rc = Condition(self.mon)
+                self.wc = Condition(self.mon)
+                self.limit = limit
+                self.queue = deque()
+
+            def put(self, item):
+                self.mon.acquire()
+                while len(self.queue) >= self.limit:
+                    self._note("put(%s): queue full", item)
+                    self.wc.wait()
+                self.queue.append(item)
+                self._note("put(%s): appended, length now %d",
+                           item, len(self.queue))
+                self.rc.notify()
+                self.mon.release()
+
+            def get(self):
+                self.mon.acquire()
+                while not self.queue:
+                    self._note("get(): queue empty")
+                    self.rc.wait()
+                item = self.queue.popleft()
+                self._note("get(): got %s, %d left", item, len(self.queue))
+                self.wc.notify()
+                self.mon.release()
+                return item
+
+        class ProducerThread(Thread):
+
+            def __init__(self, queue, quota):
+                Thread.__init__(self, name="Producer")
+                self.queue = queue
+                self.quota = quota
+
+            def run(self):
+                from random import random
+                counter = 0
+                while counter < self.quota:
+                    counter = counter + 1
+                    self.queue.put("%s.%d" % (self.getName(), counter))
+                    _sleep(random() * 0.00001)
+
+
+        class ConsumerThread(Thread):
+
+            def __init__(self, queue, count):
+                Thread.__init__(self, name="Consumer")
+                self.queue = queue
+                self.count = count
+
+            def run(self):
+                while self.count > 0:
+                    item = self.queue.get()
+                    print item
+                    self.count = self.count - 1
+
+        NP = 3
+        QL = 4
+        NI = 5
+
+        Q = BoundedQueue(QL)
+        P = []
+        for i in range(NP):
+            t = ProducerThread(Q, NI)
+            t.setName("Producer-%d" % (i+1))
+            P.append(t)
+        C = ConsumerThread(Q, NI*NP)
+        for t in P:
+            t.start()
+            _sleep(0.000001)
+        C.start()
+        for t in P:
+            t.join()
+        C.join()
+
+    if __name__ == '__main__':
+        _test()

+ 86 - 93
direct/src/stdpy/threading2.py

@@ -16,13 +16,12 @@ implementation. """
 import sys as _sys
 
 from direct.stdpy import thread
-from direct.stdpy.thread import stack_size, _local as local
+from direct.stdpy.thread import stack_size, _newname, _local as local
 from panda3d import core
 _sleep = core.Thread.sleep
 
 from time import time as _time
 from traceback import format_exc as _format_exc
-from collections import deque
 
 # Rename some stuff so "from threading import *" is safe
 __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
@@ -377,13 +376,6 @@ class _Event(_Verbose):
         finally:
             self.__cond.release()
 
-# Helper to generate new thread names
-_counter = 0
-def _newname(template="Thread-%d"):
-    global _counter
-    _counter = _counter + 1
-    return template % _counter
-
 # Active thread administration
 _active_limbo_lock = _allocate_lock()
 _active = {}    # maps thread id to Thread object
@@ -741,88 +733,89 @@ _shutdown = _MainThread()._exitfunc
 
 
 # Self-test code
+if __debug__:
+    def _test():
+        from collections import deque
+
+        class BoundedQueue(_Verbose):
+
+            def __init__(self, limit):
+                _Verbose.__init__(self)
+                self.mon = RLock()
+                self.rc = Condition(self.mon)
+                self.wc = Condition(self.mon)
+                self.limit = limit
+                self.queue = deque()
+
+            def put(self, item):
+                self.mon.acquire()
+                while len(self.queue) >= self.limit:
+                    self._note("put(%s): queue full", item)
+                    self.wc.wait()
+                self.queue.append(item)
+                self._note("put(%s): appended, length now %d",
+                           item, len(self.queue))
+                self.rc.notify()
+                self.mon.release()
+
+            def get(self):
+                self.mon.acquire()
+                while not self.queue:
+                    self._note("get(): queue empty")
+                    self.rc.wait()
+                item = self.queue.popleft()
+                self._note("get(): got %s, %d left", item, len(self.queue))
+                self.wc.notify()
+                self.mon.release()
+                return item
+
+        class ProducerThread(Thread):
+
+            def __init__(self, queue, quota):
+                Thread.__init__(self, name="Producer")
+                self.queue = queue
+                self.quota = quota
+
+            def run(self):
+                from random import random
+                counter = 0
+                while counter < self.quota:
+                    counter = counter + 1
+                    self.queue.put("%s.%d" % (self.getName(), counter))
+                    _sleep(random() * 0.00001)
+
+
+        class ConsumerThread(Thread):
+
+            def __init__(self, queue, count):
+                Thread.__init__(self, name="Consumer")
+                self.queue = queue
+                self.count = count
+
+            def run(self):
+                while self.count > 0:
+                    item = self.queue.get()
+                    print item
+                    self.count = self.count - 1
+
+        NP = 3
+        QL = 4
+        NI = 5
+
+        Q = BoundedQueue(QL)
+        P = []
+        for i in range(NP):
+            t = ProducerThread(Q, NI)
+            t.setName("Producer-%d" % (i+1))
+            P.append(t)
+        C = ConsumerThread(Q, NI*NP)
+        for t in P:
+            t.start()
+            _sleep(0.000001)
+        C.start()
+        for t in P:
+            t.join()
+        C.join()
 
-def _test():
-
-    class BoundedQueue(_Verbose):
-
-        def __init__(self, limit):
-            _Verbose.__init__(self)
-            self.mon = RLock()
-            self.rc = Condition(self.mon)
-            self.wc = Condition(self.mon)
-            self.limit = limit
-            self.queue = deque()
-
-        def put(self, item):
-            self.mon.acquire()
-            while len(self.queue) >= self.limit:
-                self._note("put(%s): queue full", item)
-                self.wc.wait()
-            self.queue.append(item)
-            self._note("put(%s): appended, length now %d",
-                       item, len(self.queue))
-            self.rc.notify()
-            self.mon.release()
-
-        def get(self):
-            self.mon.acquire()
-            while not self.queue:
-                self._note("get(): queue empty")
-                self.rc.wait()
-            item = self.queue.popleft()
-            self._note("get(): got %s, %d left", item, len(self.queue))
-            self.wc.notify()
-            self.mon.release()
-            return item
-
-    class ProducerThread(Thread):
-
-        def __init__(self, queue, quota):
-            Thread.__init__(self, name="Producer")
-            self.queue = queue
-            self.quota = quota
-
-        def run(self):
-            from random import random
-            counter = 0
-            while counter < self.quota:
-                counter = counter + 1
-                self.queue.put("%s.%d" % (self.getName(), counter))
-                _sleep(random() * 0.00001)
-
-
-    class ConsumerThread(Thread):
-
-        def __init__(self, queue, count):
-            Thread.__init__(self, name="Consumer")
-            self.queue = queue
-            self.count = count
-
-        def run(self):
-            while self.count > 0:
-                item = self.queue.get()
-                print item
-                self.count = self.count - 1
-
-    NP = 3
-    QL = 4
-    NI = 5
-
-    Q = BoundedQueue(QL)
-    P = []
-    for i in range(NP):
-        t = ProducerThread(Q, NI)
-        t.setName("Producer-%d" % (i+1))
-        P.append(t)
-    C = ConsumerThread(Q, NI*NP)
-    for t in P:
-        t.start()
-        _sleep(0.000001)
-    C.start()
-    for t in P:
-        t.join()
-    C.join()
-
-if __name__ == '__main__':
-    _test()
+    if __name__ == '__main__':
+        _test()

+ 20 - 13
direct/src/task/Task.py

@@ -12,6 +12,7 @@ from direct.showbase.PythonUtil import *
 from direct.showbase.MessengerGlobal import messenger
 import types
 import random
+import importlib
 
 try:
     import signal
@@ -149,6 +150,8 @@ class TaskManager:
         self.mgr.setClock(clockObject)
         self.globalClock = clockObject
 
+    clock = property(lambda self: self.mgr.getClock(), setClock)
+
     def invokeDefaultHandler(self, signalNumber, stackFrame):
         print '*** allowing mid-frame keyboard interrupt.'
         # Restore default interrupt handler
@@ -311,6 +314,8 @@ class TaskManager:
         self.mgr.add(task)
         return task
 
+    do_method_later = doMethodLater
+
     def add(self, funcOrTask, name = None, sort = None, extraArgs = None,
             priority = None, uponDeath = None, appendTask = False,
             taskChain = None, owner = None):
@@ -479,6 +484,9 @@ class TaskManager:
         """Starts the task manager running.  Does not return until an
         exception is encountered (including KeyboardInterrupt). """
 
+        if PandaSystem.getPlatform() == 'emscripten':
+            return
+
         # Set the clock to have last frame's time in case we were
         # Paused at the prompt for a long time
         t = self.globalClock.getFrameTime()
@@ -584,7 +592,6 @@ class TaskManager:
     def popupControls(self):
         # Don't use a regular import, to prevent ModuleFinder from picking
         # it up as a dependency when building a .p3d package.
-        import importlib
         TaskManagerPanel = importlib.import_module('direct.tkpanels.TaskManagerPanel')
         return TaskManagerPanel.TaskManagerPanel(self)
 
@@ -595,8 +602,8 @@ class TaskManager:
 
         # Defer this import until we need it: some Python
         # distributions don't provide the profile and pstats modules.
-        from direct.showbase.ProfileSession import ProfileSession
-        return ProfileSession(name)
+        PS = importlib.import_module('direct.showbase.ProfileSession')
+        return PS.ProfileSession(name)
 
     def profileFrames(self, num=None, session=None, callback=None):
         if num is None:
@@ -622,8 +629,8 @@ class TaskManager:
         self._profileFrames.set(profileFrames)
         if (not self._frameProfiler) and profileFrames:
             # import here due to import dependencies
-            from direct.task.FrameProfiler import FrameProfiler
-            self._frameProfiler = FrameProfiler()
+            FP = importlib.import_module('direct.task.FrameProfiler')
+            self._frameProfiler = FP.FrameProfiler()
 
     def getProfileTasks(self):
         return self._profileTasks.get()
@@ -635,8 +642,8 @@ class TaskManager:
         self._profileTasks.set(profileTasks)
         if (not self._taskProfiler) and profileTasks:
             # import here due to import dependencies
-            from direct.task.TaskProfiler import TaskProfiler
-            self._taskProfiler = TaskProfiler()
+            TP = importlib.import_module('direct.task.TaskProfiler')
+            self._taskProfiler = TP.TaskProfiler()
 
     def logTaskProfiles(self, name=None):
         if self._taskProfiler:
@@ -682,9 +689,9 @@ class TaskManager:
 
         # Defer this import until we need it: some Python
         # distributions don't provide the profile and pstats modules.
-        from direct.showbase.ProfileSession import ProfileSession
-        profileSession = ProfileSession('profiled-task-%s' % task.getName(),
-                                        Functor(profileInfo.taskFunc, *profileInfo.taskArgs))
+        PS = importlib.import_module('direct.showbase.ProfileSession')
+        profileSession = PS.ProfileSession('profiled-task-%s' % task.getName(),
+                                           Functor(profileInfo.taskFunc, *profileInfo.taskArgs))
         ret = profileSession.run()
 
         # set these values *after* profiling in case we're profiling the TaskProfiler
@@ -703,12 +710,12 @@ class TaskManager:
     def _getRandomTask(self):
         # Figure out when the next frame is likely to expire, so we
         # won't grab any tasks that are sleeping for a long time.
-        now = globalClock.getFrameTime()
-        avgFrameRate = globalClock.getAverageFrameRate()
+        now = self.globalClock.getFrameTime()
+        avgFrameRate = self.globalClock.getAverageFrameRate()
         if avgFrameRate < .00001:
             avgFrameDur = 0.
         else:
-            avgFrameDur = (1. / globalClock.getAverageFrameRate())
+            avgFrameDur = (1. / self.globalClock.getAverageFrameRate())
         next = now + avgFrameDur
 
         # Now grab a task at random, until we find one that we like.

+ 3 - 3
dtool/metalibs/dtool/dtool.cxx

@@ -1,7 +1,7 @@
-// Filename: dtool.C
+// Filename: dtool.cxx
 // Created by:  drose (15May00)
-// 
-/////////////////////////////////////////////////////////////////////
+//
+////////////////////////////////////////////////////////////////////
 
 // This is a dummy file whose sole purpose is to give the compiler
 // something to compile when making libdtool.so in NO_DEFER mode,

+ 20 - 0
dtool/src/cppparser/cppArrayType.cxx

@@ -87,6 +87,26 @@ is_trivial() const {
   return _element_type->is_trivial();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CPPArrayType::is_default_constructible
+//       Access: Public, Virtual
+//  Description: Returns true if the type is default-constructible.
+////////////////////////////////////////////////////////////////////
+bool CPPArrayType::
+is_default_constructible() const {
+  return _element_type->is_default_constructible();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CPPArrayType::is_copy_constructible
+//       Access: Public, Virtual
+//  Description: Returns true if the type is copy-constructible.
+////////////////////////////////////////////////////////////////////
+bool CPPArrayType::
+is_copy_constructible() const {
+  return false;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CPPArrayType::is_equivalent
 //       Access: Public, Virtual

+ 3 - 1
dtool/src/cppparser/cppArrayType.h

@@ -21,7 +21,7 @@
 
 class CPPExpression;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPArrayType
 // Description :
 ////////////////////////////////////////////////////////////////////
@@ -41,6 +41,8 @@ public:
                                 CPPScope *global_scope);
   virtual bool is_tbd() const;
   virtual bool is_trivial() const;
+  virtual bool is_default_constructible() const;
+  virtual bool is_copy_constructible() const;
   virtual bool is_equivalent(const CPPType &other) const;
 
   virtual void output(ostream &out, int indent_level, CPPScope *scope,

Diferenças do arquivo suprimidas por serem muito extensas
+ 666 - 667
dtool/src/cppparser/cppBison.cxx.prebuilt


+ 9 - 1
dtool/src/cppparser/cppBison.yxx

@@ -1,4 +1,4 @@
-// Filename: cppBison.y
+// Filename: cppBison.yxx
 // Created by:  drose (16Jan99)
 //
 ////////////////////////////////////////////////////////////////////
@@ -1524,6 +1524,14 @@ maybe_initialize_or_function_body:
         | '=' const_expr ';'
 {
   $$ = $2;
+}
+        | '=' KW_DEFAULT ';'
+{
+  $$ = new CPPExpression(CPPExpression::get_default());
+}
+        | '=' KW_DELETE ';'
+{
+  $$ = new CPPExpression(CPPExpression::get_delete());
 }
         | '=' '{' structure_init '}'
 {

+ 1 - 1
dtool/src/cppparser/cppClassTemplateParameter.h

@@ -21,7 +21,7 @@
 
 class CPPIdentifier;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPClassTemplateParameter
 // Description :
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
dtool/src/cppparser/cppCommentBlock.h

@@ -21,7 +21,7 @@
 
 #include <list>
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPCommentBlock
 // Description : This represents a comment appearing in the source
 //               code.  The CPPPreprocessor collects these, and saves

+ 20 - 0
dtool/src/cppparser/cppConstType.cxx

@@ -112,6 +112,26 @@ is_trivial() const {
   return _wrapped_around->is_trivial();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CPPConstType::is_default_constructible
+//       Access: Public, Virtual
+//  Description: Returns true if the type is default-constructible.
+////////////////////////////////////////////////////////////////////
+bool CPPConstType::
+is_default_constructible() const {
+  return false;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CPPConstType::is_copy_constructible
+//       Access: Public, Virtual
+//  Description: Returns true if the type is copy-constructible.
+////////////////////////////////////////////////////////////////////
+bool CPPConstType::
+is_copy_constructible() const {
+  return _wrapped_around->is_copy_constructible();
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CPPConstType::is_equivalent
 //       Access: Public, Virtual

+ 3 - 1
dtool/src/cppparser/cppConstType.h

@@ -19,7 +19,7 @@
 
 #include "cppType.h"
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPConstType
 // Description :
 ////////////////////////////////////////////////////////////////////
@@ -39,6 +39,8 @@ public:
 
   virtual bool is_tbd() const;
   virtual bool is_trivial() const;
+  virtual bool is_default_constructible() const;
+  virtual bool is_copy_constructible() const;
   virtual bool is_equivalent(const CPPType &other) const;
 
   virtual void output(ostream &out, int indent_level, CPPScope *scope,

+ 1 - 1
dtool/src/cppparser/cppDeclaration.h

@@ -55,7 +55,7 @@ class CPPScope;
 class CPPTemplateScope;
 class CPPPreprocessor;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPDeclaration
 // Description :
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
dtool/src/cppparser/cppEnumType.h

@@ -26,7 +26,7 @@ class CPPInstance;
 class CPPScope;
 
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPEnumType
 // Description :
 ////////////////////////////////////////////////////////////////////

+ 67 - 1
dtool/src/cppparser/cppExpression.cxx

@@ -201,6 +201,19 @@ output(ostream &out) const {
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CPPExpression::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+CPPExpression::
+CPPExpression(bool value) :
+  CPPDeclaration(CPPFile())
+{
+  _type = T_boolean;
+  _u._boolean = value;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CPPExpression::Constructor
 //       Access: Public
@@ -494,6 +507,30 @@ get_nullptr() {
   return expr;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CPPExpression::get_default
+//       Access: Public, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+const CPPExpression &CPPExpression::
+get_default() {
+  static CPPExpression expr(0);
+  expr._type = T_default;
+  return expr;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CPPExpression::get_delete
+//       Access: Public, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+const CPPExpression &CPPExpression::
+get_delete() {
+  static CPPExpression expr(0);
+  expr._type = T_delete;
+  return expr;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CPPExpression::Destructor
 //       Access: Public
@@ -516,6 +553,9 @@ evaluate() const {
   case T_nullptr:
     return Result((void *)0);
 
+  case T_boolean:
+    return Result((int)_u._boolean);
+
   case T_integer:
     return Result((int)_u._integer);
 
@@ -556,8 +596,12 @@ evaluate() const {
     if (r1._type != RT_error) {
       CPPSimpleType *stype = _u._typecast._to->as_simple_type();
       if (stype != NULL) {
-        if (stype->_type == CPPSimpleType::T_int) {
+        if (stype->_type == CPPSimpleType::T_bool) {
+          return Result(r1.as_boolean());
+
+        } else if (stype->_type == CPPSimpleType::T_int) {
           return Result(r1.as_integer());
+
         } else if (stype->_type == CPPSimpleType::T_float ||
                    stype->_type == CPPSimpleType::T_double) {
           return Result(r1.as_real());
@@ -855,6 +899,9 @@ determine_type() const {
   case T_nullptr:
     return nullptr_type;
 
+  case T_boolean:
+    return bool_type;
+
   case T_integer:
     return int_type;
 
@@ -1036,6 +1083,7 @@ is_fully_specified() const {
 
   switch (_type) {
   case T_nullptr:
+  case T_boolean:
   case T_integer:
   case T_real:
   case T_string:
@@ -1290,6 +1338,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
     out << "nullptr";
     break;
 
+  case T_boolean:
+    out << (_u._boolean ? "true" : "false");
+    break;
+
   case T_integer:
     out << _u._integer;
     break;
@@ -1619,6 +1671,14 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
     }
     break;
 
+  case T_default:
+    out << "default";
+    break;
+
+  case T_delete:
+    out << "delete";
+    break;
+
   default:
     out << "(** invalid operand type " << (int)_type << " **)";
   }
@@ -1716,6 +1776,9 @@ is_equal(const CPPDeclaration *other) const {
   case T_nullptr:
     return true;
 
+  case T_boolean:
+    return _u._boolean == ot->_u._boolean;
+
   case T_integer:
     return _u._integer == ot->_u._integer;
 
@@ -1796,6 +1859,9 @@ is_less(const CPPDeclaration *other) const {
   case T_nullptr:
     return false;
 
+  case T_boolean:
+    return _u._boolean < ot->_u._boolean;
+
   case T_integer:
     return _u._integer < ot->_u._integer;
 

+ 10 - 1
dtool/src/cppparser/cppExpression.h

@@ -24,12 +24,13 @@ class CPPType;
 class CPPPreprocessor;
 class CPPFunctionGroup;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPExpression
 // Description :
 ////////////////////////////////////////////////////////////////////
 class CPPExpression : public CPPDeclaration {
 public:
+  CPPExpression(bool value);
   CPPExpression(unsigned long long value);
   CPPExpression(int value);
   CPPExpression(const string &value);
@@ -52,6 +53,8 @@ public:
   static CPPExpression raw_literal(const string &raw, CPPInstance *lit_op);
 
   static const CPPExpression &get_nullptr();
+  static const CPPExpression &get_default();
+  static const CPPExpression &get_delete();
 
   ~CPPExpression();
 
@@ -102,6 +105,7 @@ public:
 
   enum Type {
     T_nullptr,
+    T_boolean,
     T_integer,
     T_real,
     T_string,
@@ -124,11 +128,16 @@ public:
     T_trinary_operation,
     T_literal,
     T_raw_literal,
+
+    // These are used when parsing =default and =delete methods.
+    T_default,
+    T_delete,
   };
 
   Type _type;
   string _str;
   union {
+    bool _boolean;
     unsigned long long _integer;
     long double _real;
     CPPInstance *_variable;

+ 1 - 1
dtool/src/cppparser/cppExpressionParser.h

@@ -22,7 +22,7 @@
 class CPPExpression;
 class CPPScope;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPExpressionParser
 // Description :
 ////////////////////////////////////////////////////////////////////

+ 20 - 0
dtool/src/cppparser/cppExtensionType.cxx

@@ -114,6 +114,26 @@ is_trivial() const {
   return (_type == T_enum);
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CPPExtensionType::is_default_constructible
+//       Access: Public, Virtual
+//  Description: Returns true if the type is default-constructible.
+////////////////////////////////////////////////////////////////////
+bool CPPExtensionType::
+is_default_constructible() const {
+  return (_type == T_enum);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: CPPExtensionType::is_copy_constructible
+//       Access: Public, Virtual
+//  Description: Returns true if the type is copy-constructible.
+////////////////////////////////////////////////////////////////////
+bool CPPExtensionType::
+is_copy_constructible() const {
+  return (_type == T_enum);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CPPExtensionType::substitute_decl
 //       Access: Public, Virtual

+ 3 - 1
dtool/src/cppparser/cppExtensionType.h

@@ -23,7 +23,7 @@
 class CPPScope;
 class CPPIdentifier;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPExtensionType
 // Description : Base class of enum, class, struct, and union types.
 //               An instance of the base class (instead of one of
@@ -48,6 +48,8 @@ public:
   virtual bool is_incomplete() const;
   virtual bool is_tbd() const;
   virtual bool is_trivial() const;
+  virtual bool is_default_constructible() const;
+  virtual bool is_copy_constructible() const;
 
   virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
                                           CPPScope *current_scope,

+ 1 - 1
dtool/src/cppparser/cppFile.h

@@ -18,7 +18,7 @@
 #include "dtoolbase.h"
 #include "filename.h"
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPFile
 // Description : This defines a source file (typically a C++ header
 //               file) that is parsed by the CPPParser.  Each

+ 1 - 1
dtool/src/cppparser/cppFunctionGroup.h

@@ -21,7 +21,7 @@
 
 class CPPInstance;
 
-///////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
 //       Class : CPPFunctionGroup
 // Description : This class is simply a container for one or more
 //               CPPInstances for functions of the same name.  It's

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff