Beispiel #1
0
static INode *FindObjectsNode(ReferenceTarget *ths, Object *obj) 
{
	if (NULL == ths) {
		return NULL;
	}
	DependentIterator di(ths);
	ReferenceMaker* maker = NULL;
	while ((maker = di.Next()) != NULL) {
		if (maker->SuperClassID()==BASENODE_CLASS_ID) {
			// Verify that we are this node's object
			INode  *node   = (INode*)maker;
			Object *nobj   = node->GetObjectRef();
			if (nobj) nobj = nobj->FindBaseObject();
			if (nobj==obj)
				return (INode*)maker;
			}

		if (maker->IsRefTarget()) {
			INode *node = FindObjectsNode((ReferenceTarget*)maker, obj);
			if (node) return node;
			}
	}

	return NULL;
}
void mrGeomShaderObject::UserDlgProc::SetThing(ReferenceTarget *m) {

	ReferenceMaker* owner = m;
	if((owner == NULL) || ((owner->SuperClassID() == GEOMOBJECT_CLASS_ID) && (owner->ClassID() == MRGEOMETRYOBJECT_CLASS_ID))) {
		m_theObject = static_cast<mrGeomShaderObject*>(owner);
	}
	else {
		DbgAssert(false);
		m_theObject = NULL;
	}
}
Beispiel #3
0
INode *plAnimStealthNode::GetINode()
{
    // Go through the reflist looking for RefMakers with a ref to this component.
    // There should only be one INode in this list.
    DependentIterator di(this);
    ReferenceMaker* item = di.Next();
    while( item )
    {
        if( item->SuperClassID() == BASENODE_CLASS_ID )
            return (INode *)item;

        item = di.Next();
    }

    return nil;
}
Beispiel #4
0
plMaxNodeBase *plComponentBase::GetINode()
{
    // Go through the reflist looking for RefMakers with a ref to this component.
    // There should only be one INode in this list.
    DependentIterator di(this);
    ReferenceMaker* rm = di.Next();
    while (rm != nil) 
    {
        if (rm->SuperClassID() == BASENODE_CLASS_ID)
            return (plMaxNodeBase*)rm;

        rm = di.Next();
    }

    return nil;
}
Beispiel #5
0
static ICustAttribContainer * GetOwnerContainer(ReferenceTarget * owner)
{
	if (NULL == owner) {
		return NULL;
	}

	//Lets find our Parent - which should be a custom Attribute Container
	DependentIterator di(owner);
	ReferenceMaker* maker = NULL;
	while ((maker = di.Next()) != NULL) 
	{
		if (maker->SuperClassID() == REF_MAKER_CLASS_ID &&
				maker->ClassID() == CUSTATTRIB_CONTAINER_CLASS_ID ) 
		{
			return (ICustAttribContainer*)maker;
		}
	}
	
	return NULL;
}
plComponentBase *plMaxNodeBase::IRefMakerToComponent(ReferenceMaker *maker, bool all)
{
    if (!maker)
        return nil;

    // Is the refmaker a paramblock?  If so, it may be the
    // targets block of a component
    if (maker->SuperClassID() == PARAMETER_BLOCK2_CLASS_ID)
    {
        IParamBlock2 *pb = (IParamBlock2*)maker;
        ReferenceMaker *pbowner = pb->GetOwner();

        // Is the owner of the paramblock a helper object (component superclass)?
        if (pbowner && pbowner->SuperClassID() == HELPER_CLASS_ID)
        {
            Object *obj = (Object*)pbowner;
            // Is the owner of the paramblock a component?
            if (IsComponent(obj))
            {
                plComponentBase *comp = (plComponentBase*)obj;

                if (!all)
                {
                    // Does this component actually ref us? (A component can have other
                    // refs to a node, like a proxy object, so we want to make sure this
                    // node is actually in the target list.)
                    for (uint32_t i = 0; i < comp->NumTargets(); i++)
                    {
                        if (comp->GetTarget(i) == this)
                            return comp;
                    }
                }
                else
                    return comp;
            }
        }
    }

    return nil;
}
Beispiel #7
0
INode* FindNodeRef(ReferenceTarget *Rt) 
{
	DependentIterator Di(Rt);
	ReferenceMaker	*Rm;
	INode	*Nd = NULL;

	while (Rm = Di.Next()) 
	{	
		if(Rm->SuperClassID() == BASENODE_CLASS_ID) 
		{
			return (INode *)Rm;
		}

		Nd = FindNodeRef((ReferenceTarget *)Rm);

		if(Nd)
		{
			 return(Nd);
		}
	}

	return(NULL);
}
Beispiel #8
0
bool        plAnimStealthNode::IsParentUsedInScene( void )
{
    if( GetParentMtl() == nil )
        return false;

    // There are two possibilities: either a node uses us and thus has a ref to us,
    // or a multi-sub uses us that a node has a ref to us.

    // Note: we could do the loop as a helper function, but we only do it twice,
    // so it's not *really* worth the effort...
    //// NOTE: the following doesn't seem to work, but keeping here in case it ever does. 
    //// What really actually finds something is the enum dependents loop below
    const char *mtlName = GetParentMtl()->GetName();

    DependentIterator di(this);
    ReferenceMaker* item = di.Next();
    while( item != nil )
    {
        TSTR s;
        item->GetClassName( s );

        if( item->SuperClassID() == BASENODE_CLASS_ID && !CanConvertToStealth( (INode *)( item ) ) )
            return true;        // Horray, a node has a ref to us!

        else if( item->ClassID() == Class_ID(MULTI_CLASS_ID,0) )
        {
            // Multi-sub, run the refs on that guy (we only go one up)
            Mtl *multisub = (Mtl *)item;

            DependentIterator sub(multisub);
            ReferenceMaker* item2 = sub.Next();
            while( item2 != nil )
            {
                if( item2->SuperClassID() == BASENODE_CLASS_ID )
                    return true;        // Horray, a node has a ref to us!
                item2 = sub.Next();
            }

            // No go, keep trying
        }
        else if( item->SuperClassID() == MATERIAL_CLASS_ID )
        {
            int q = 0;
        }

        item = di.Next();
    }

    // Enum dependents
    plGetRefs callback;
    ENUMDEPENDENTS(GetParentMtl(), &callback);
    for(int i = 0; i < callback.fList.GetCount(); i++ )
    {
        ReferenceMaker *maker = callback.fList[ i ];

        TSTR s;
        maker->GetClassName( s );

        if( maker->SuperClassID() == BASENODE_CLASS_ID && !CanConvertToStealth( (INode *)maker ) )
            return true;        // Horray, a node has a ref to us!
    }
    return false;
}