Can't find Texture Tags using Hierarchy



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/10/2004 at 03:39, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.500 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi!

    I am using the Hierarchy Class to walk through the Scene Hierarchy. I am trying to Export an object that has a Texture Tag applied, but when I iterate through the Tags, there is no Texture Tag. UVW and Phong Tags as well as two hidden Tags (Tpoint & Tpolygon) are there, but no Texture Tag.
    Yes, the Material is applied to exactly the object I am looking at in the editor (it also shows up on that object when I call "Current State To Object" in the editor). Does the Hierarchy Class perhaps store Hierarchical Tags somewhere else?

    Timm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/10/2004 at 01:54, xxxxxxxx wrote:

    Confirmed. I'm investigating why this is and if there's a workaround. I guess one possibility is to use SendModelingCommand() with CSTO and do the hierarchy traversal yourself.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/10/2004 at 08:42, xxxxxxxx wrote:

    Hi Mikael!

    Thanks for the prompt reply. The problem is, that I need both, the original hierarchy and the hierarchy with the virtual objects at the same time and (more importantly) know in which relation they are standing (via, GetCacheParent()), so I can pick objects from both hiararchies. As far as I remember this doesn't work with SendModelingCommand, because the connections are gone, but I might be wrong here...

    Timm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/11/2008 at 22:35, xxxxxxxx wrote:

    An old thread, back from the dead...

        
        
        
        
        // helper method, since the main material won't have selections
        
        
        
        
        Bool hasSelection(BaseTag* tag)  
        {  
            if (!tag)   
                return FALSE;
        
        
        
        
            GeData tempGeData;
        
        
        
        
            if (!tag->GetParameter(DescID(DescLevel(TEXTURETAG_RESTRICTION)), tempGeData, 0))  
                return FALSE;
        
        
        
        
            return tempGeData.GetString().Content();  
        }
        
        
        
        
        // the Hierarchy::Do method 
        
        
        
        
        virtual Bool Do(void *data, BaseObject *op, const Matrix &mg, Bool controlobject)  
        {  
            ExampleStruct *d = (ExampleStruct* ) data;
        
        
        
        
            LONG mode = op->GetRenderMode();
        
        
        
        
            if (mode != MODE_UNDEF)    
                d->parent_state = mode;
        
        
        
        
            if (controlobject) return TRUE;    
            if (op->GetType() != Opolygon) return TRUE; 
        
        
        
        
            TextureTag*   textag = 0;  
            BaseMaterial* material = 0;  
            BaseObject*   source = 0;
        
        
        
        
            for (BaseObject* up = op; up && !textag && !material && !source;   
                (up->GetUp()) ? up = up->GetUp() : up = up->GetCacheParent())  
            {  
                for (BaseTag* bt = up->GetFirstTag(); bt; bt = bt->GetNext())  
                {  
                    if (bt->GetType() == Ttexture && !hasSelection(bt))  
                    {  
                        TextureTag* tmp = static_cast<TextureTag*>(bt);
        
        
        
        
                        if (tmp->GetMaterial())  
                        {  
                            textag   = tmp;  
                            material = tmp->GetMaterial();  
                            source   = up;  
                        }  
                    }  
                }  
            }
        
        
        
        
            if (textag && material && source)  
                GePrint(String("Found material ") + material->GetName() +   
                        String(" on TextureTag ") + textag->GetName() +  
                        String(" on object ")   + source->GetName());  
            else  
                GePrint("No material was found for this object.");
        
        
        
        
            return TRUE;  
        }
        
        
        
    


Log in to reply