mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
Merge branch 'release/1.10.x'
This commit is contained in:
commit
5ae08eadf7
@ -32,6 +32,7 @@ This is a list of all the people who are contributing financially to Panda3D. I
|
|||||||
* Eric Thomson
|
* Eric Thomson
|
||||||
* Kyle Roach
|
* Kyle Roach
|
||||||
* Brian Lach
|
* Brian Lach
|
||||||
|
* C0MPU73R
|
||||||
|
|
||||||
## Backers
|
## Backers
|
||||||
|
|
||||||
|
@ -334,6 +334,18 @@ get_slotted_function_def(Object *obj, Function *func, FunctionRemap *remap,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (method_name == "__truediv__") {
|
||||||
|
def._answer_location = "nb_true_divide";
|
||||||
|
def._wrapper_type = WT_binary_operator;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_name == "__floordiv__") {
|
||||||
|
def._answer_location = "nb_floor_divide";
|
||||||
|
def._wrapper_type = WT_binary_operator;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (method_name == "operator %") {
|
if (method_name == "operator %") {
|
||||||
def._answer_location = "nb_remainder";
|
def._answer_location = "nb_remainder";
|
||||||
def._wrapper_type = WT_binary_operator;
|
def._wrapper_type = WT_binary_operator;
|
||||||
@ -406,6 +418,18 @@ get_slotted_function_def(Object *obj, Function *func, FunctionRemap *remap,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (method_name == "__itruediv__") {
|
||||||
|
def._answer_location = "nb_inplace_true_divide";
|
||||||
|
def._wrapper_type = WT_binary_operator;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_name == "__ifloordiv__") {
|
||||||
|
def._answer_location = "nb_inplace_floor_divide";
|
||||||
|
def._wrapper_type = WT_binary_operator;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (method_name == "operator %=") {
|
if (method_name == "operator %=") {
|
||||||
def._answer_location = "nb_inplace_remainder";
|
def._answer_location = "nb_inplace_remainder";
|
||||||
def._wrapper_type = WT_inplace_binary_operator;
|
def._wrapper_type = WT_inplace_binary_operator;
|
||||||
|
@ -68,7 +68,7 @@ ConfigVariableBool vorbis_enable_seek
|
|||||||
"using the Ogg Vorbis decoder."));
|
"using the Ogg Vorbis decoder."));
|
||||||
|
|
||||||
ConfigVariableBool vorbis_seek_lap
|
ConfigVariableBool vorbis_seek_lap
|
||||||
("vorbis-seek-lap", true,
|
("vorbis-seek-lap", false,
|
||||||
PRC_DESC("If this is set to true, the Ogg Vorbis decoder will automatically "
|
PRC_DESC("If this is set to true, the Ogg Vorbis decoder will automatically "
|
||||||
"crosslap the transition from the previous playback position into "
|
"crosslap the transition from the previous playback position into "
|
||||||
"the new playback position when seeking in order to eliminate "
|
"the new playback position when seeking in order to eliminate "
|
||||||
|
@ -998,7 +998,8 @@ compose_color_scale(PN_stdfloat sr, PN_stdfloat sg, PN_stdfloat sb, PN_stdfloat
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the red scale component of the transform
|
* Sets the red component of the color scale.
|
||||||
|
* @see set_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE void NodePath::
|
INLINE void NodePath::
|
||||||
set_sr(PN_stdfloat sr) {
|
set_sr(PN_stdfloat sr) {
|
||||||
@ -1009,7 +1010,8 @@ set_sr(PN_stdfloat sr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the alpha scale component of the transform
|
* Sets the green component of the color scale.
|
||||||
|
* @see set_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE void NodePath::
|
INLINE void NodePath::
|
||||||
set_sg(PN_stdfloat sg) {
|
set_sg(PN_stdfloat sg) {
|
||||||
@ -1020,7 +1022,8 @@ set_sg(PN_stdfloat sg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the blue scale component of the transform
|
* Sets the blue component of the color scale.
|
||||||
|
* @see set_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE void NodePath::
|
INLINE void NodePath::
|
||||||
set_sb(PN_stdfloat sb) {
|
set_sb(PN_stdfloat sb) {
|
||||||
@ -1031,7 +1034,8 @@ set_sb(PN_stdfloat sb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the alpha scale component of the transform
|
* Sets the alpha component of the color scale.
|
||||||
|
* @see set_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE void NodePath::
|
INLINE void NodePath::
|
||||||
set_sa(PN_stdfloat sa) {
|
set_sa(PN_stdfloat sa) {
|
||||||
@ -1042,7 +1046,8 @@ set_sa(PN_stdfloat sa) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the red scale component of the transform
|
* Gets the red component of the color scale.
|
||||||
|
* @see get_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE PN_stdfloat NodePath::
|
INLINE PN_stdfloat NodePath::
|
||||||
get_sr() const {
|
get_sr() const {
|
||||||
@ -1050,7 +1055,8 @@ get_sr() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the green scale component of the transform
|
* Gets the green component of the color scale.
|
||||||
|
* @see get_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE PN_stdfloat NodePath::
|
INLINE PN_stdfloat NodePath::
|
||||||
get_sg() const {
|
get_sg() const {
|
||||||
@ -1058,7 +1064,8 @@ get_sg() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the blue scale component of the transform
|
* Gets the blue component of the color scale.
|
||||||
|
* @see get_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE PN_stdfloat NodePath::
|
INLINE PN_stdfloat NodePath::
|
||||||
get_sb() const {
|
get_sb() const {
|
||||||
@ -1066,7 +1073,8 @@ get_sb() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the alpha scale component of the transform
|
* Gets the alpha component of the color scale.
|
||||||
|
* @see get_color_scale()
|
||||||
*/
|
*/
|
||||||
INLINE PN_stdfloat NodePath::
|
INLINE PN_stdfloat NodePath::
|
||||||
get_sa() const {
|
get_sa() const {
|
||||||
@ -1838,6 +1846,8 @@ show_through(DrawMask camera_mask) {
|
|||||||
* invisible to all cameras. It remains part of the scene graph, its bounding
|
* invisible to all cameras. It remains part of the scene graph, its bounding
|
||||||
* volume still contributes to its parent's bounding volume, and it will still
|
* volume still contributes to its parent's bounding volume, and it will still
|
||||||
* be involved in collision tests.
|
* be involved in collision tests.
|
||||||
|
*
|
||||||
|
* To undo this, call show().
|
||||||
*/
|
*/
|
||||||
INLINE void NodePath::
|
INLINE void NodePath::
|
||||||
hide() {
|
hide() {
|
||||||
|
@ -959,6 +959,11 @@ set_pos(const LVecBase3 &pos) {
|
|||||||
node()->reset_prev_transform();
|
node()->reset_prev_transform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the X component of the position transform, leaving other components
|
||||||
|
* untouched.
|
||||||
|
* @see set_pos()
|
||||||
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_x(PN_stdfloat x) {
|
set_x(PN_stdfloat x) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
@ -967,6 +972,11 @@ set_x(PN_stdfloat x) {
|
|||||||
set_pos(pos);
|
set_pos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Y component of the position transform, leaving other components
|
||||||
|
* untouched.
|
||||||
|
* @see set_pos()
|
||||||
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_y(PN_stdfloat y) {
|
set_y(PN_stdfloat y) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
@ -975,6 +985,11 @@ set_y(PN_stdfloat y) {
|
|||||||
set_pos(pos);
|
set_pos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Z component of the position transform, leaving other components
|
||||||
|
* untouched.
|
||||||
|
* @see set_pos()
|
||||||
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_z(PN_stdfloat z) {
|
set_z(PN_stdfloat z) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
@ -1127,6 +1142,11 @@ set_scale(const LVecBase3 &scale) {
|
|||||||
set_transform(transform->set_scale(scale));
|
set_transform(transform->set_scale(scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the x-scale component of the transform, leaving other components
|
||||||
|
* untouched.
|
||||||
|
* @see set_scale()
|
||||||
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_sx(PN_stdfloat sx) {
|
set_sx(PN_stdfloat sx) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
@ -1136,6 +1156,11 @@ set_sx(PN_stdfloat sx) {
|
|||||||
set_transform(transform->set_scale(scale));
|
set_transform(transform->set_scale(scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the y-scale component of the transform, leaving other components
|
||||||
|
* untouched.
|
||||||
|
* @see set_scale()
|
||||||
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_sy(PN_stdfloat sy) {
|
set_sy(PN_stdfloat sy) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
@ -1145,6 +1170,11 @@ set_sy(PN_stdfloat sy) {
|
|||||||
set_transform(transform->set_scale(scale));
|
set_transform(transform->set_scale(scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the z-scale component of the transform, leaving other components
|
||||||
|
* untouched.
|
||||||
|
* @see set_scale()
|
||||||
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_sz(PN_stdfloat sz) {
|
set_sz(PN_stdfloat sz) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
@ -4214,6 +4244,8 @@ get_material() const {
|
|||||||
/**
|
/**
|
||||||
* Recursively searches the scene graph for references to the given material,
|
* Recursively searches the scene graph for references to the given material,
|
||||||
* and replaces them with the new material.
|
* and replaces them with the new material.
|
||||||
|
*
|
||||||
|
* @since 1.10.0
|
||||||
*/
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
replace_material(Material *mat, Material *new_mat) {
|
replace_material(Material *mat, Material *new_mat) {
|
||||||
@ -4936,6 +4968,8 @@ get_transparency() const {
|
|||||||
* Specifically sets or disables a logical operation on this particular node.
|
* Specifically sets or disables a logical operation on this particular node.
|
||||||
* If no other nodes override, this will cause geometry to be rendered without
|
* If no other nodes override, this will cause geometry to be rendered without
|
||||||
* color blending but instead using the given logical operator.
|
* color blending but instead using the given logical operator.
|
||||||
|
*
|
||||||
|
* @since 1.10.0
|
||||||
*/
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_logic_op(LogicOpAttrib::Operation op, int priority) {
|
set_logic_op(LogicOpAttrib::Operation op, int priority) {
|
||||||
@ -4948,6 +4982,8 @@ set_logic_op(LogicOpAttrib::Operation op, int priority) {
|
|||||||
* Completely removes any logical operation that may have been set on this
|
* Completely removes any logical operation that may have been set on this
|
||||||
* node via set_logic_op(). The geometry at this level and below will
|
* node via set_logic_op(). The geometry at this level and below will
|
||||||
* subsequently be rendered using standard color blending.
|
* subsequently be rendered using standard color blending.
|
||||||
|
*
|
||||||
|
* @since 1.10.0
|
||||||
*/
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
clear_logic_op() {
|
clear_logic_op() {
|
||||||
@ -4960,6 +4996,8 @@ clear_logic_op() {
|
|||||||
* particular node via set_logic_op(). If this returns true, then
|
* particular node via set_logic_op(). If this returns true, then
|
||||||
* get_logic_op() may be called to determine whether a logical operation has
|
* get_logic_op() may be called to determine whether a logical operation has
|
||||||
* been explicitly disabled for this node or set to particular operation.
|
* been explicitly disabled for this node or set to particular operation.
|
||||||
|
*
|
||||||
|
* @since 1.10.0
|
||||||
*/
|
*/
|
||||||
bool NodePath::
|
bool NodePath::
|
||||||
has_logic_op() const {
|
has_logic_op() const {
|
||||||
@ -4974,6 +5012,8 @@ has_logic_op() const {
|
|||||||
* has_logic_op(). This does not necessarily imply that the geometry will
|
* has_logic_op(). This does not necessarily imply that the geometry will
|
||||||
* or will not be rendered with the given logical operation, as there may be
|
* or will not be rendered with the given logical operation, as there may be
|
||||||
* other nodes that override.
|
* other nodes that override.
|
||||||
|
*
|
||||||
|
* @since 1.10.0
|
||||||
*/
|
*/
|
||||||
LogicOpAttrib::Operation NodePath::
|
LogicOpAttrib::Operation NodePath::
|
||||||
get_logic_op() const {
|
get_logic_op() const {
|
||||||
|
@ -124,6 +124,13 @@ PGItem(const PGItem ©) :
|
|||||||
new_sd._frame_style = old_sd._frame_style;
|
new_sd._frame_style = old_sd._frame_style;
|
||||||
|
|
||||||
_state_defs.push_back(new_sd);
|
_state_defs.push_back(new_sd);
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
((PGItem &)copy).update_frame((int)i);
|
||||||
|
update_frame((int)i);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,8 +206,10 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
|
|||||||
if (state >= 0 && (size_t)state < _state_defs.size()) {
|
if (state >= 0 && (size_t)state < _state_defs.size()) {
|
||||||
StateDef &state_def = _state_defs[state];
|
StateDef &state_def = _state_defs[state];
|
||||||
if (!state_def._root.is_empty()) {
|
if (!state_def._root.is_empty()) {
|
||||||
if (state_def._frame_stale) {
|
if (Thread::get_current_pipeline_stage() == 0) {
|
||||||
update_frame(state);
|
if (state_def._frame_stale) {
|
||||||
|
update_frame(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state_def_root = state_def._root.node();
|
state_def_root = state_def._root.node();
|
||||||
@ -347,9 +356,8 @@ void PGItem::
|
|||||||
r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state,
|
r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state,
|
||||||
GeomTransformer &transformer, Thread *current_thread) {
|
GeomTransformer &transformer, Thread *current_thread) {
|
||||||
LightReMutexHolder holder(_lock);
|
LightReMutexHolder holder(_lock);
|
||||||
StateDefs::iterator di;
|
for (StateDef &def : _state_defs) {
|
||||||
for (di = _state_defs.begin(); di != _state_defs.end(); ++di) {
|
NodePath &root = def._root;
|
||||||
NodePath &root = (*di)._root;
|
|
||||||
if (!root.is_empty()) {
|
if (!root.is_empty()) {
|
||||||
PandaNode *child = root.node();
|
PandaNode *child = root.node();
|
||||||
CPT(RenderState) child_state = node_state->compose(child->get_state());
|
CPT(RenderState) child_state = node_state->compose(child->get_state());
|
||||||
@ -375,9 +383,9 @@ xform(const LMatrix4 &mat) {
|
|||||||
_frame.set(ll[0], ur[0], ll[2], ur[2]);
|
_frame.set(ll[0], ur[0], ll[2], ur[2]);
|
||||||
|
|
||||||
// Transform the individual states and their frame styles.
|
// Transform the individual states and their frame styles.
|
||||||
StateDefs::iterator di;
|
for (size_t state = 0; state < _state_defs.size(); ++state) {
|
||||||
for (di = _state_defs.begin(); di != _state_defs.end(); ++di) {
|
StateDef &def = _state_defs[state];
|
||||||
NodePath &root = (*di)._root;
|
NodePath &root = def._root;
|
||||||
// Apply the matrix to the previous transform.
|
// Apply the matrix to the previous transform.
|
||||||
root.set_transform(root.get_transform()->compose(TransformState::make_mat(mat)));
|
root.set_transform(root.get_transform()->compose(TransformState::make_mat(mat)));
|
||||||
|
|
||||||
@ -386,8 +394,16 @@ xform(const LMatrix4 &mat) {
|
|||||||
gr.apply_attribs(root.node());
|
gr.apply_attribs(root.node());
|
||||||
|
|
||||||
// Transform the frame style too.
|
// Transform the frame style too.
|
||||||
if ((*di)._frame_style.xform(mat)) {
|
if (def._frame_style.xform(mat)) {
|
||||||
(*di)._frame_stale = true;
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_frame((int)state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
def._frame_stale = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mark_internal_bounds_stale();
|
mark_internal_bounds_stale();
|
||||||
@ -767,9 +783,7 @@ move(const MouseWatcherParameter ¶m) {
|
|||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
background_press(const MouseWatcherParameter ¶m) {
|
background_press(const MouseWatcherParameter ¶m) {
|
||||||
BackgroundFocus::const_iterator fi;
|
for (PGItem *item : _background_focus) {
|
||||||
for (fi = _background_focus.begin(); fi != _background_focus.end(); ++fi) {
|
|
||||||
PGItem *item = *fi;
|
|
||||||
if (!item->get_focus()) {
|
if (!item->get_focus()) {
|
||||||
item->press(param, true);
|
item->press(param, true);
|
||||||
}
|
}
|
||||||
@ -781,9 +795,7 @@ background_press(const MouseWatcherParameter ¶m) {
|
|||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
background_release(const MouseWatcherParameter ¶m) {
|
background_release(const MouseWatcherParameter ¶m) {
|
||||||
BackgroundFocus::const_iterator fi;
|
for (PGItem *item : _background_focus) {
|
||||||
for (fi = _background_focus.begin(); fi != _background_focus.end(); ++fi) {
|
|
||||||
PGItem *item = *fi;
|
|
||||||
if (!item->get_focus()) {
|
if (!item->get_focus()) {
|
||||||
item->release(param, true);
|
item->release(param, true);
|
||||||
}
|
}
|
||||||
@ -795,9 +807,7 @@ background_release(const MouseWatcherParameter ¶m) {
|
|||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
background_keystroke(const MouseWatcherParameter ¶m) {
|
background_keystroke(const MouseWatcherParameter ¶m) {
|
||||||
BackgroundFocus::const_iterator fi;
|
for (PGItem *item : _background_focus) {
|
||||||
for (fi = _background_focus.begin(); fi != _background_focus.end(); ++fi) {
|
|
||||||
PGItem *item = *fi;
|
|
||||||
if (!item->get_focus()) {
|
if (!item->get_focus()) {
|
||||||
item->keystroke(param, true);
|
item->keystroke(param, true);
|
||||||
}
|
}
|
||||||
@ -809,9 +819,7 @@ background_keystroke(const MouseWatcherParameter ¶m) {
|
|||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
background_candidate(const MouseWatcherParameter ¶m) {
|
background_candidate(const MouseWatcherParameter ¶m) {
|
||||||
BackgroundFocus::const_iterator fi;
|
for (PGItem *item : _background_focus) {
|
||||||
for (fi = _background_focus.begin(); fi != _background_focus.end(); ++fi) {
|
|
||||||
PGItem *item = *fi;
|
|
||||||
if (!item->get_focus()) {
|
if (!item->get_focus()) {
|
||||||
item->candidate(param, true);
|
item->candidate(param, true);
|
||||||
}
|
}
|
||||||
@ -952,6 +960,12 @@ clear_state_def(int state) {
|
|||||||
_state_defs[state]._frame_stale = true;
|
_state_defs[state]._frame_stale = true;
|
||||||
|
|
||||||
mark_internal_bounds_stale();
|
mark_internal_bounds_stale();
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_frame(state);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -991,15 +1005,24 @@ get_frame_style(int state) {
|
|||||||
void PGItem::
|
void PGItem::
|
||||||
set_frame_style(int state, const PGFrameStyle &style) {
|
set_frame_style(int state, const PGFrameStyle &style) {
|
||||||
LightReMutexHolder holder(_lock);
|
LightReMutexHolder holder(_lock);
|
||||||
// Get the state def node, mainly to ensure that this state is slotted and
|
|
||||||
// listed as having been defined.
|
slot_state_def(state);
|
||||||
NodePath &root = do_get_state_def(state);
|
|
||||||
nassertv(!root.is_empty());
|
if (_state_defs[state]._root.is_empty()) {
|
||||||
|
// Create a new node.
|
||||||
|
_state_defs[state]._root = NodePath("state_" + format_string(state));
|
||||||
|
}
|
||||||
|
|
||||||
_state_defs[state]._frame_style = style;
|
_state_defs[state]._frame_style = style;
|
||||||
_state_defs[state]._frame_stale = true;
|
_state_defs[state]._frame_stale = true;
|
||||||
|
|
||||||
mark_internal_bounds_stale();
|
mark_internal_bounds_stale();
|
||||||
|
|
||||||
|
#ifdef THREADED_PIPELINE
|
||||||
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
|
update_frame(state);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_AUDIO
|
#ifdef HAVE_AUDIO
|
||||||
@ -1165,11 +1188,10 @@ mouse_to_local(const LPoint2 &mouse_point) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the user changes the frame size.
|
* Called when the user changes the frame size. Assumes the lock is held.
|
||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
frame_changed() {
|
frame_changed() {
|
||||||
LightReMutexHolder holder(_lock);
|
|
||||||
mark_frames_stale();
|
mark_frames_stale();
|
||||||
if (_notify != nullptr) {
|
if (_notify != nullptr) {
|
||||||
_notify->item_frame_changed(this);
|
_notify->item_frame_changed(this);
|
||||||
@ -1202,6 +1224,7 @@ do_get_state_def(int state) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures there is a slot in the array for the given state definition.
|
* Ensures there is a slot in the array for the given state definition.
|
||||||
|
* Assumes the lock is already held.
|
||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
slot_state_def(int state) {
|
slot_state_def(int state) {
|
||||||
@ -1212,6 +1235,7 @@ slot_state_def(int state) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a new instance of the frame geometry for the indicated state.
|
* Generates a new instance of the frame geometry for the indicated state.
|
||||||
|
* Assumes the lock is already held.
|
||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
update_frame(int state) {
|
update_frame(int state) {
|
||||||
@ -1234,15 +1258,26 @@ update_frame(int state) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks all the frames in all states stale, so that they will be regenerated
|
* Marks all the frames in all states stale, so that they will be regenerated
|
||||||
* the next time each state is requested.
|
* the next time each state is requested. Assumes the lock is already held.
|
||||||
*/
|
*/
|
||||||
void PGItem::
|
void PGItem::
|
||||||
mark_frames_stale() {
|
mark_frames_stale() {
|
||||||
StateDefs::iterator di;
|
#ifdef THREADED_PIPELINE
|
||||||
for (di = _state_defs.begin(); di != _state_defs.end(); ++di) {
|
// If we are using the threaded pipeline, we must update the frame geometry
|
||||||
// Remove the old frame, if any.
|
// immediately on the App thread, since this class isn't pipeline-cycled.
|
||||||
(*di)._frame.remove_node();
|
if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
|
||||||
(*di)._frame_stale = true;
|
for (int state = 0; state < (int)_state_defs.size(); ++state) {
|
||||||
|
update_frame(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
for (StateDef &def : _state_defs) {
|
||||||
|
// Remove the old frame, if any.
|
||||||
|
def._frame.remove_node();
|
||||||
|
def._frame_stale = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mark_internal_bounds_stale();
|
mark_internal_bounds_stale();
|
||||||
}
|
}
|
||||||
@ -1294,9 +1329,8 @@ clip_frame(ClipPoints &source_points, const LPlane &plane) const {
|
|||||||
LPoint2 last_point(source_points.back());
|
LPoint2 last_point(source_points.back());
|
||||||
bool last_is_in = is_right(last_point - from2d, delta2d);
|
bool last_is_in = is_right(last_point - from2d, delta2d);
|
||||||
bool all_in = last_is_in;
|
bool all_in = last_is_in;
|
||||||
ClipPoints::const_iterator pi;
|
|
||||||
for (pi = source_points.begin(); pi != source_points.end(); ++pi) {
|
for (LPoint2 this_point : source_points) {
|
||||||
LPoint2 this_point(*pi);
|
|
||||||
bool this_is_in = is_right(this_point - from2d, delta2d);
|
bool this_is_in = is_right(this_point - from2d, delta2d);
|
||||||
|
|
||||||
// There appears to be a compiler bug in gcc 4.0: we need to extract this
|
// There appears to be a compiler bug in gcc 4.0: we need to extract this
|
||||||
|
@ -284,11 +284,10 @@ remanage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the user changes the frame size.
|
* Called when the user changes the frame size. Assumes the lock is held.
|
||||||
*/
|
*/
|
||||||
void PGScrollFrame::
|
void PGScrollFrame::
|
||||||
frame_changed() {
|
frame_changed() {
|
||||||
LightReMutexHolder holder(_lock);
|
|
||||||
PGVirtualFrame::frame_changed();
|
PGVirtualFrame::frame_changed();
|
||||||
_needs_remanage = true;
|
_needs_remanage = true;
|
||||||
_needs_recompute_clip = true;
|
_needs_recompute_clip = true;
|
||||||
|
@ -551,11 +551,10 @@ recompute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the user changes the frame size.
|
* Called when the user changes the frame size. Assumes the lock is held.
|
||||||
*/
|
*/
|
||||||
void PGSliderBar::
|
void PGSliderBar::
|
||||||
frame_changed() {
|
frame_changed() {
|
||||||
LightReMutexHolder holder(_lock);
|
|
||||||
PGItem::frame_changed();
|
PGItem::frame_changed();
|
||||||
_needs_remanage = true;
|
_needs_remanage = true;
|
||||||
_needs_recompute = true;
|
_needs_recompute = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user