浏览代码

add shift-L to pview

David Rose 23 年之前
父节点
当前提交
cccf0f02cc
共有 2 个文件被更改,包括 24 次插入4 次删除
  1. 23 4
      panda/src/framework/pandaFramework.cxx
  2. 1 0
      panda/src/framework/pandaFramework.h

+ 23 - 4
panda/src/framework/pandaFramework.cxx

@@ -488,6 +488,7 @@ do_enable_default_keys() {
   _event_handler.add_hook("b", event_b, this);
   _event_handler.add_hook("b", event_b, this);
   _event_handler.add_hook("l", event_l, this);
   _event_handler.add_hook("l", event_l, this);
   _event_handler.add_hook("c", event_c, this);
   _event_handler.add_hook("c", event_c, this);
+  _event_handler.add_hook("shift-l", event_L, this);
   _event_handler.add_hook("h", event_h, this);
   _event_handler.add_hook("h", event_h, this);
   _event_handler.add_hook("arrow_up", event_arrow_up, this);
   _event_handler.add_hook("arrow_up", event_arrow_up, this);
   _event_handler.add_hook("arrow_down", event_arrow_down, this);
   _event_handler.add_hook("arrow_down", event_arrow_down, this);
@@ -576,18 +577,36 @@ void PandaFramework::
 event_c(CPT_Event, void *data) {
 event_c(CPT_Event, void *data) {
   PandaFramework *self = (PandaFramework *)data;
   PandaFramework *self = (PandaFramework *)data;
 
 
-  NodePath center_around = self->get_highlight();
-  if (center_around.is_empty()) {
-    center_around = self->get_models();
+  NodePath node = self->get_highlight();
+  if (node.is_empty()) {
+    node = self->get_models();
   }
   }
 
 
   Windows::iterator wi;
   Windows::iterator wi;
   for (wi = self->_windows.begin(); wi != self->_windows.end(); ++wi) {
   for (wi = self->_windows.begin(); wi != self->_windows.end(); ++wi) {
     WindowFramework *wf = (*wi);
     WindowFramework *wf = (*wi);
-    wf->center_trackball(center_around);
+    wf->center_trackball(node);
   }
   }
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PandaFramework::event_L
+//       Access: Protected, Static
+//  Description: Default handler for shift-L key: list the contents of
+//               the scene graph, or the highlighted node.
+////////////////////////////////////////////////////////////////////
+void PandaFramework::
+event_L(CPT_Event, void *data) {
+  PandaFramework *self = (PandaFramework *)data;
+
+  NodePath node = self->get_highlight();
+  if (node.is_empty()) {
+    node = self->get_models();
+  }
+
+  node.ls();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PandaFramework::event_h
 //     Function: PandaFramework::event_h
 //       Access: Protected, Static
 //       Access: Protected, Static

+ 1 - 0
panda/src/framework/pandaFramework.h

@@ -102,6 +102,7 @@ protected:
   static void event_b(CPT_Event, void *data);
   static void event_b(CPT_Event, void *data);
   static void event_l(CPT_Event, void *data);
   static void event_l(CPT_Event, void *data);
   static void event_c(CPT_Event, void *data);
   static void event_c(CPT_Event, void *data);
+  static void event_L(CPT_Event, void *data);
   static void event_h(CPT_Event, void *data);
   static void event_h(CPT_Event, void *data);
   static void event_arrow_up(CPT_Event, void *data);
   static void event_arrow_up(CPT_Event, void *data);
   static void event_arrow_down(CPT_Event, void *data);
   static void event_arrow_down(CPT_Event, void *data);