فهرست منبع

set_visible_child

David Rose 23 سال پیش
والد
کامیت
1afba99e1f
2فایلهای تغییر یافته به همراه18 افزوده شده و 0 حذف شده
  1. 17 0
      panda/src/pgraph/sequenceNode.I
  2. 1 0
      panda/src/pgraph/sequenceNode.h

+ 17 - 0
panda/src/pgraph/sequenceNode.I

@@ -88,6 +88,23 @@ get_cycle_rate() const {
   return cdata->_cycle_rate;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: SequenceNode::set_visible_child
+//       Access: Published
+//  Description: Sets the particular child that this SequenceNode will
+//               display this frame.  Future frames will proceed from
+//               here.
+////////////////////////////////////////////////////////////////////
+INLINE void SequenceNode::
+set_visible_child(int index) {
+  int num_children = get_num_children();
+  if (num_children != 0) {
+    CDWriter cdata(_cycler);
+    float now = ClockObject::get_global_clock()->get_frame_time();
+    cdata->_frame_offset = (index - (now - cdata->_start_time) * cdata->_cycle_rate);
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: SequenceNode::get_visible_child
 //       Access: Published

+ 1 - 0
panda/src/pgraph/sequenceNode.h

@@ -46,6 +46,7 @@ PUBLISHED:
   INLINE void set_cycle_rate(float cycle_rate);
   INLINE float get_cycle_rate() const;
 
+  INLINE void set_visible_child(int index);
   INLINE int get_visible_child() const;
 
 private: