fix flatten some more
This commit is contained in:
parent
0bf2b83727
commit
4cb4ba7598
|
|
@ -377,6 +377,12 @@ collapse_siblings(Node *parent, NodeRelation *arc1, NodeRelation *arc2) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
Node *GraphReducer::
|
||||
collapse_nodes(Node *node1, Node *node2, bool) {
|
||||
if (!node1->safe_to_combine() || !node2->safe_to_combine()) {
|
||||
// One or both nodes cannot be safely combined with another node;
|
||||
// do nothing.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// We get to choose whether to remove node1 or node2.
|
||||
if (node2->is_exact_type(Node::get_class_type()) ||
|
||||
node2->is_exact_type(NamedNode::get_class_type())) {
|
||||
|
|
|
|||
|
|
@ -159,6 +159,20 @@ safe_to_transform() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Node::safe_to_combine
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if it is generally safe to combine
|
||||
// this particular kind of Node with other kinds of
|
||||
// Nodes, adding children or whatever. For instance, an
|
||||
// LODNode should not be combined with any other node,
|
||||
// because its set of children is meaningful.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool Node::
|
||||
safe_to_combine() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Node::xform
|
||||
// Access: Public, Virtual
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public:
|
|||
|
||||
virtual bool safe_to_flatten() const;
|
||||
virtual bool safe_to_transform() const;
|
||||
virtual bool safe_to_combine() const;
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
||||
virtual void transform_changed(NodeRelation *arc);
|
||||
|
|
|
|||
|
|
@ -19,3 +19,18 @@
|
|||
#include "switchNode.h"
|
||||
|
||||
TypeHandle SwitchNode::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: SwitchNode::safe_to_combine
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if it is generally safe to combine
|
||||
// this particular kind of Node with other kinds of
|
||||
// Nodes, adding children or whatever. For instance, an
|
||||
// LODNode should not be combined with any other node,
|
||||
// because its set of children is meaningful.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool SwitchNode::
|
||||
safe_to_combine() const {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ PUBLISHED:
|
|||
INLINE void operator = (const SwitchNode ©);
|
||||
|
||||
public:
|
||||
virtual bool safe_to_combine() const;
|
||||
virtual void compute_switch(RenderTraverser *trav)=0;
|
||||
|
||||
virtual bool is_child_visible(TypeHandle type, int index)=0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue