onOffTransition.I 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // Filename: onOffTransition.I
  2. // Created by: drose (20Mar00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: OnOffTransition::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE_GRAPH OnOffTransition::
  24. OnOffTransition(TransitionDirection direction) {
  25. _direction = direction;
  26. }
  27. ////////////////////////////////////////////////////////////////////
  28. // Function: OnOffTransition::Copy Constructor
  29. // Access: Public
  30. // Description:
  31. ////////////////////////////////////////////////////////////////////
  32. INLINE_GRAPH OnOffTransition::
  33. OnOffTransition(const OnOffTransition &copy) :
  34. NodeTransition(copy),
  35. _direction(copy._direction)
  36. {
  37. }
  38. ////////////////////////////////////////////////////////////////////
  39. // Function: OnOffTransition::Copy Assignment Operator
  40. // Access: Public
  41. // Description:
  42. ////////////////////////////////////////////////////////////////////
  43. INLINE_GRAPH void OnOffTransition::
  44. operator = (const OnOffTransition &copy) {
  45. NodeTransition::operator = (copy);
  46. _direction = copy._direction;
  47. }
  48. ////////////////////////////////////////////////////////////////////
  49. // Function: OnOffTransition::set_identity
  50. // Access: Public
  51. // Description: Changes the transition to an identity transition;
  52. // this has no effect on the attribute for any nodes at
  53. // this point and below.
  54. ////////////////////////////////////////////////////////////////////
  55. INLINE_GRAPH void OnOffTransition::
  56. set_identity() {
  57. _direction = TD_identity;
  58. state_changed();
  59. }
  60. ////////////////////////////////////////////////////////////////////
  61. // Function: OnOffTransition::set_on
  62. // Access: Public
  63. // Description: Changes the transition to an 'on' transition;
  64. // this turns on the attribute for all nodes at this
  65. // point and below. However, this particular function
  66. // does not change the attribute value itself, and is
  67. // thus only appropriate for derived transition types
  68. // that do not actually carry an attribute value.
  69. // Derived types that *do* have an attribute value
  70. // should override this function to accept a value
  71. // parameter of the appropriate type.
  72. ////////////////////////////////////////////////////////////////////
  73. INLINE_GRAPH void OnOffTransition::
  74. set_on() {
  75. _direction = TD_on;
  76. state_changed();
  77. }
  78. ////////////////////////////////////////////////////////////////////
  79. // Function: OnOffTransition::set_off
  80. // Access: Public
  81. // Description: Changes the transition to an 'off' transition; this
  82. // turns off the attribute for all nodes at this point
  83. // and below.
  84. ////////////////////////////////////////////////////////////////////
  85. INLINE_GRAPH void OnOffTransition::
  86. set_off() {
  87. _direction = TD_off;
  88. state_changed();
  89. }
  90. ////////////////////////////////////////////////////////////////////
  91. // Function: OnOffTransition::is_identity
  92. // Access: Public
  93. // Description: Returns true if this is the identity transition,
  94. // false otherwise.
  95. ////////////////////////////////////////////////////////////////////
  96. INLINE_GRAPH bool OnOffTransition::
  97. is_identity() const {
  98. return _direction == TD_identity;
  99. }
  100. ////////////////////////////////////////////////////////////////////
  101. // Function: OnOffTransition::is_on
  102. // Access: Public
  103. // Description: Returns true if this transition is 'on', false
  104. // otherwise. If the derived transition type carries a
  105. // value, it should define a get_value() function which
  106. // allows you to query the on value.
  107. ////////////////////////////////////////////////////////////////////
  108. INLINE_GRAPH bool OnOffTransition::
  109. is_on() const {
  110. return _direction == TD_on;
  111. }
  112. ////////////////////////////////////////////////////////////////////
  113. // Function: OnOffTransition::is_off
  114. // Access: Public
  115. // Description: Returns true if this transition is the 'off'
  116. // transition, false otherwise.
  117. ////////////////////////////////////////////////////////////////////
  118. INLINE_GRAPH bool OnOffTransition::
  119. is_off() const {
  120. return _direction == TD_off;
  121. }