Exemplo n.º 1
0
void VrmlNodeGroup::accumulateTransform(VrmlNode *parent)
{
    d_parentTransform = parent;

    int i, n = d_children.size();

    for (i = 0; i < n; ++i)
    {
        VrmlNode *kid = d_children[i];
        if (kid)
            kid->accumulateTransform(parent);
    }
}
Exemplo n.º 2
0
void VrmlNodeGroup::addChildren(const VrmlMFNode &children)
{
    int nNow = d_children.size();
    int n = children.size();

    for (int i = 0; i < n; ++i)
    {
        VrmlNode *child = children[i];
        if (child == NULL)
        {
            continue;
        }

        child->parentList.push_back(this);
        if (child->getTraversalForce() > 0)
        {
            forceTraversal(false, child->getTraversalForce());
        }

        VrmlNodeProto *p = 0;

        // Add legal children and un-instantiated EXTERNPROTOs
        // Is it legal to add null children nodes?
        if (child == 0 || child->toChild() || ((p = child->toProto()) != 0 && p->size() == 0))
        {
            d_children.addNode(child);
            if (child)
            {
                child->addToScene(d_scene, d_relative.get());
                child->accumulateTransform(d_parentTransform);
            }
        }
        else
            System::the->error("Error: Attempt to add a %s node as a child of a %s node.\n",
                               child->nodeType()->getName(), nodeType()->getName());
    }

    if (nNow != d_children.size())
    {
        //??eventOut( d_scene->timeNow(), "children_changed", d_children );
        setModified();
    }
}