Browse Source

Merge branch 'release/1.10.x'

rdb 5 năm trước cách đây
mục cha
commit
54a4a6abfc
4 tập tin đã thay đổi với 92 bổ sung9 xóa
  1. 1 0
      BACKERS.md
  2. 43 3
      panda/src/pgui/pgEntry.I
  3. 47 6
      panda/src/pgui/pgEntry.cxx
  4. 1 0
      panda/src/pgui/pgEntry.h

+ 1 - 0
BACKERS.md

@@ -22,6 +22,7 @@ This is a list of all the people who are contributing financially to Panda3D.  I
 
 * Sam Edwards
 * Max Voss
+* Hawkheart
 
 ## Enthusiasts
 

+ 43 - 3
panda/src/pgui/pgEntry.I

@@ -113,6 +113,12 @@ set_cursor_position(int position) {
     _cursor_position = position;
     _cursor_stale = true;
     _blink_start = ClockObject::get_global_clock()->get_frame_time();
+
+#ifdef THREADED_PIPELINE
+    if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+      update_cursor();
+    }
+#endif
   }
 }
 
@@ -185,6 +191,13 @@ set_max_width(PN_stdfloat max_width) {
   LightReMutexHolder holder(_lock);
   _max_width = max_width;
   _text_geom_stale = true;
+
+#ifdef THREADED_PIPELINE
+  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+    update_text();
+    update_cursor();
+  }
+#endif
 }
 
 /**
@@ -206,9 +219,17 @@ INLINE void PGEntry::
 set_num_lines(int num_lines) {
   LightReMutexHolder holder(_lock);
   nassertv(num_lines >= 1);
-  _num_lines = num_lines;
-  _text_geom_stale = true;
-  update_text();
+  if (_num_lines != num_lines) {
+    _num_lines = num_lines;
+    _text_geom_stale = true;
+    update_text();
+
+#ifdef THREADED_PIPELINE
+    if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+      update_cursor();
+    }
+#endif
+  }
 }
 
 /**
@@ -300,6 +321,13 @@ set_obscure_mode(bool flag) {
   if (_obscure_mode != flag) {
     _obscure_mode = flag;
     _text_geom_stale = true;
+
+#ifdef THREADED_PIPELINE
+    if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+      update_text();
+      update_cursor();
+    }
+#endif
   }
 }
 
@@ -325,6 +353,13 @@ set_overflow_mode(bool flag) {
     _overflow_mode = flag;
     _text_geom_stale = true;
     _cursor_stale = true;
+
+#ifdef THREADED_PIPELINE
+    if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+      update_text();
+      update_cursor();
+    }
+#endif
   }
 }
 
@@ -518,6 +553,11 @@ set_wtext(const std::wstring &wtext) {
     ret = _obscure_text.set_wtext(std::wstring(_text.get_num_characters(), '*'));
   }
   _text_geom_stale = true;
+#ifdef THREADED_PIPELINE
+  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+    update_text();
+  }
+#endif
   set_cursor_position(std::min(_cursor_position, _text.get_num_characters()));
   return ret;
 }

+ 47 - 6
panda/src/pgui/pgEntry.cxx

@@ -176,8 +176,10 @@ bool PGEntry::
 cull_callback(CullTraverser *trav, CullTraverserData &data) {
   LightReMutexHolder holder(_lock);
   PGItem::cull_callback(trav, data);
-  update_text();
-  update_cursor();
+  if (Thread::get_current_pipeline_stage() == 0) {
+    update_text();
+    update_cursor();
+  }
 
   // Now render the text.
   CullTraverserData next_data(data, _text_render_root.node());
@@ -260,7 +262,7 @@ press(const MouseWatcherParameter &param, bool background) {
             }
             _cursor_stale = true;
             if (overflow_mode){
-                _text_geom_stale = true;
+              _text_geom_stale = true;
             }
           }
 
@@ -276,7 +278,7 @@ press(const MouseWatcherParameter &param, bool background) {
             }
             _cursor_stale = true;
             if (overflow_mode){
-                _text_geom_stale = true;
+              _text_geom_stale = true;
             }
           }
 
@@ -286,7 +288,7 @@ press(const MouseWatcherParameter &param, bool background) {
             _cursor_position = 0;
             _cursor_stale = true;
             if (overflow_mode){
-                _text_geom_stale = true;
+              _text_geom_stale = true;
             }
             type(param);
           }
@@ -297,7 +299,7 @@ press(const MouseWatcherParameter &param, bool background) {
             _cursor_position = _text.get_num_characters();
             _cursor_stale = true;
             if (overflow_mode){
-                _text_geom_stale = true;
+              _text_geom_stale = true;
             }
             type(param);
           }
@@ -306,6 +308,17 @@ press(const MouseWatcherParameter &param, bool background) {
     }
   }
   PGItem::press(param, background);
+
+#ifdef THREADED_PIPELINE
+  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+    if (_text_geom_stale) {
+      update_text();
+    }
+    if (_cursor_stale) {
+      update_cursor();
+    }
+  }
+#endif
 }
 
 /**
@@ -411,6 +424,17 @@ keystroke(const MouseWatcherParameter &param, bool background) {
     }
   }
   PGItem::keystroke(param, background);
+
+#ifdef THREADED_PIPELINE
+  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+    if (_text_geom_stale) {
+      update_text();
+    }
+    if (_cursor_stale) {
+      update_cursor();
+    }
+  }
+#endif
 }
 
 /**
@@ -434,6 +458,17 @@ candidate(const MouseWatcherParameter &param, bool background) {
     }
   }
   PGItem::candidate(param, background);
+
+#ifdef THREADED_PIPELINE
+  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+    if (_text_geom_stale) {
+      update_text();
+    }
+    if (_cursor_stale) {
+      update_cursor();
+    }
+  }
+#endif
 }
 
 /**
@@ -924,4 +959,10 @@ update_state() {
   } else {
     set_state(S_inactive);
   }
+#ifdef THREADED_PIPELINE
+  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
+    update_text();
+    update_cursor();
+  }
+#endif
 }

+ 1 - 0
panda/src/pgui/pgEntry.h

@@ -23,6 +23,7 @@
 #include "pvector.h"
 #include "clockObject.h"
 #include "textAssembler.h"
+#include "pipeline.h"
 
 /**
  * This is a particular kind of PGItem that handles simple one-line or short