latest build

This commit is contained in:
David Rose 2005-08-02 00:27:14 +00:00
parent 916bce3009
commit 565e15ad15

View File

@ -476,12 +476,11 @@ check_lods() {
// There ought to be the one fewer elements in the array than // There ought to be the one fewer elements in the array than
// there are children of the node. // there are children of the node.
unsigned int num_elements = plug.numElements(); unsigned int num_elements = plug.numElements();
if (num_elements + 1 != _children.size()) { unsigned int num_children = _children.size();
if (num_elements + 1 != num_children) {
mayaegg_cat.warning() mayaegg_cat.warning()
<< "Node " << get_name() << " has " << plug.numElements() << "Node " << get_name() << " has " << num_elements
<< " LOD entries, but " << _children.size() << " LOD entries, but " << num_children << " children.\n";
<< " children. Ignoring LOD specification.\n";
return;
} }
// Should we also consider cameraMatrix, to transform the LOD's // Should we also consider cameraMatrix, to transform the LOD's
@ -490,7 +489,8 @@ check_lods() {
// demonstrates its use. // demonstrates its use.
double switch_out = 0.0; double switch_out = 0.0;
for (unsigned int i = 0; i < num_elements; ++i) { unsigned int i = 0;
while (i < num_elements && i < num_children) {
MPlug element = plug.elementByLogicalIndex(i); MPlug element = plug.elementByLogicalIndex(i);
MayaNodeDesc *child = _children[i]; MayaNodeDesc *child = _children[i];
@ -506,14 +506,19 @@ check_lods() {
child->_switch_out = switch_out; child->_switch_out = switch_out;
switch_out = switch_in; switch_out = switch_in;
++i;
} }
// Also set the last child. Maya wants this to switch in at while (i < num_children) {
// infinity, but Panda doesn't have such a concept; we'll settle // Also set the last child(ren). Maya wants this to switch in
// for four times the switch_out distance. // at infinity, but Panda doesn't have such a concept; we'll
MayaNodeDesc *child = _children[num_elements]; // settle for four times the switch_out distance.
child->_is_lod = true; MayaNodeDesc *child = _children[i];
child->_switch_in = switch_out * 4.0; child->_is_lod = true;
child->_switch_out = switch_out; child->_switch_in = switch_out * 4.0;
child->_switch_out = switch_out;
++i;
}
} }
} }