Instances dropped on Document::Polygonize



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

    On 26/07/2007 at 03:12, xxxxxxxx wrote:

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

    ---------
    Hello, I am working on an exporter for C4D.

    I need to export instances, since our format is intended for real-time purposes, I let C4D polygonize object through the use of BaseDocument::Polygonize().

    The problem, is that Oinstances seems to be dropped by this function.
    Is there any way to recover Instances, or to do a stable match of the hiearchy between the original document, and the polygonized one ?

    Thanks :)



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

    On 26/07/2007 at 05:55, xxxxxxxx wrote:

    Maybe it's better to get your polygon objects on a per object basis. You can do this with GetDeformCache() and GetCache(). Here is a helper function to get the deformed polygon object of a selected object (it's from the upcoming SDK docu update).

      
    static void DoRecursion(BaseObject *op)  
    {  
         BaseObject *tp = op->GetDeformCache();  
         if (tp)  
         {  
              DoRecursion(tp);  
         }  
         else  
         {  
              tp = op->GetCache(NULL);  
              if (tp)  
              {  
                   DoRecursion(tp);  
              }  
              else  
              {  
                   if (!op->GetBit(BIT_CONTROLOBJECT))  
                   {  
                        if (op->IsInstanceOf(Opolygon))  
                        {  
                             // --------------------------  
                             // HERE IS THE DEFORMED POLYGON OBJECT  
                             // --------------------------  
                        }  
                   }  
              }  
         }  
         for (tp = op->GetDown(); tp; tp=tp->GetNext())  
         {  
              DoRecursion(tp);  
         }  
    }  
    

    cheers,
    Matthias



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

    On 26/07/2007 at 06:00, xxxxxxxx wrote:

    Ok !!! I will try this immediately

    Thanks :)



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

    On 27/07/2007 at 02:24, xxxxxxxx wrote:

    Arghhh, hell is in details :D

    It seems that the texture tag is "lost" when processing a the last "op" level.

    One of the situation where the problem arises:
    - Make a landscape
    - Texture it basically (UVW mapping)
    - So that the object has only: a Texture Tag, and a Phong Tag

    When processing, the Texture Tag has gone (but it seems i have the UVW Tag).

    When using Polygonize(), i used to got everybody (TextureTag, UVWTag, PhongTag).

    I suppose that the TextureTag is on the previous recusion, i will dig onto this.

    But i will take any hints :)



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

    On 27/07/2007 at 02:27, xxxxxxxx wrote:

    BTW, i moved processing of sub objects to just after the polyobject generation.
    (i have a general hiearchy tracking outside of the equivalent of this recursive routine)



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

    On 07/08/2007 at 08:40, xxxxxxxx wrote:

    arghh, I hit another wall, so I have ended with a temporary solution involving just this (taken from Document::Polygonize() routine) :

      
    BaseObject *PolygonizeBaseObject( BaseObject *Src )  
    {  
    BaseContainer Ctr;  
           
    ModelingCommandData CData;  
    CData.doc = Src->GetDocument();  
    CData.bc = &Ctr;       
      
    Ctr.SetBool(MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION,TRUE);  
      
    CData.op = Src;   
      
    if( !SendModelingCommand( MCOMMAND_CURRENTSTATETOOBJECT, CData ) || !CData.result )  
    return NULL;       
      
    BaseObject *CollapsedObject = (BaseObject* )CData.result->GetIndex(0);  
      
    AtomArray::Free( CData.result );  
      
    return CollapsedObject;  
    }  
    

    So I just collapse a hierarchy branch with this call:

      
    AutoFree<BaseObject> PolyObject = PolygonizeBaseObject( Object );  
      
    if( PolyObject )  
        MyObjectProcessor( PolyObject.... );       
    

    I just wanted to know if the sequence above would disrupt or leak C4D ressources.


Log in to reply