Disappearing tags



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

    On 04/09/2009 at 15:02, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R11.5 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    This is very odd. Same code works in R8-R11 (and everywhere inbetween on both systems, 32-bit and 64-bit) but in R11.5, the tags disappear as if InsertTag() is failing. Anything need to be different?

    > // Sort Polygon/Point Selection tags on Figure/Prop \> //\*---------------------------------------------------------------------------\* \> void IPPSortSelections(BaseDocument\* doc, BaseObject\* baseObject, BaseTag\* ptag) \> //\*---------------------------------------------------------------------------\* \> { \>      // Separate material and bodypart selections \>      AutoAlloc<AtomArray>     aa; \>      if (!aa)                    return; \>      BaseTag\*     tag; \>      LONG          cnt, i; \>      // - Fill array with Material polygon selection tags \>      for (tag = baseObject->GetFirstTag(); tag; tag = tag->GetNext()) \>      { \>           if (tag->IsInstanceOf(Tpolygonselection) && tag->GetName().FindLast(".mtl", &cnt;)) \>                aa->Append(tag); \>      } \>      cnt =                         aa->GetCount(); \>      for (i = 0L; i != cnt; ++i) \>      { \>           tag =     static_cast<BaseTag\*>(aa->GetIndex(i)); \>           doc->AddUndo(UNDO_CHANGE,     tag); \>           tag->Remove(); \>           tag->InsertBefore(ptag); \>      } \>      aa->Flush(); \>      // - Fill array with Bodypart polygon selection tags \>      for (tag = baseObject->GetFirstTag(); tag; tag = tag->GetNext()) \>      { \>           if (tag->IsInstanceOf(Tpolygonselection) && !tag->GetName().FindLast(".mtl", &cnt;)) \>                aa->Append(tag); \>      } \>      cnt =                         aa->GetCount(); \>      for (i = cnt-1L; i >= 0L; --i) \>      { \>           tag =     static_cast<BaseTag\*>(aa->GetIndex(i)); \>           doc->AddUndo(UNDO_CHANGE,     tag); \>           tag->Remove(); \>           baseObject->InsertTag(tag, ptag); \>      } \>      aa->Flush(); \>      // - Fill array with Bodypart point selection tags \>      for (tag = baseObject->GetFirstTag(); tag; tag = tag->GetNext()) \>      { \>           if (tag->IsInstanceOf(Tpointselection)) \>                aa->Append(tag); \>      } \>      cnt =                         aa->GetCount(); \>      for (i = cnt-1L; i >= 0L; --i) \>      { \>           tag =     static_cast<BaseTag\*>(aa->GetIndex(i)); \>           doc->AddUndo(UNDO_CHANGE,     tag); \>           tag->Remove(); \>           baseObject->InsertTag(tag, ptag); \>      } \> }

    ETA: This is Cinema 4D R11.514 Demo. Have not yet had a chance to test in the non-demo version and no complaints (yet).



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

    On 10/09/2009 at 10:17, xxxxxxxx wrote:

    Six days? Nothing on this. Not my imagination here - just installed the full version and the same symptoms using either the R11 build or the R11.5 build plugins. So this is either a bug in the SDK or something has changed (nothing indicated in the SDK though). I'm going to rebuild using the full version API/SDK but that really shouldn't matter.

    I should note that baseObject->Message(MSG_UPDATE) and EventAdd() are done in the calling function.

    Thanks!



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

    On 10/09/2009 at 11:13, xxxxxxxx wrote:

    Used the full version API/SDK for the R11.5 build. Since the two functions being used are global, tried the code directly in the calling functions. No difference, same problem.

    No clue here.



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

    On 10/09/2009 at 15:11, xxxxxxxx wrote:

    I'll try to sort this out. Sorry but really busy with the 11.5er SDK docu.

    cheers,
    Matthias



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

    On 10/09/2009 at 15:33, xxxxxxxx wrote:

    Appreciated, Matthias. This speaks to having another support person. Samir and I do our best but we don't have that direct connection to the developers. ;)



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

    On 11/09/2009 at 00:55, xxxxxxxx wrote:

    Robert, do you have an idea at which point in your code the tags are disappearing?

    cheers,
    Matthias



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

    On 11/09/2009 at 08:58, xxxxxxxx wrote:

    Where I have colored red:

    // Sort Polygon/Point Selection tags on Figure/Prop
    //*---------------------------------------------------------------------------*
    void IPPSortSelections(BaseDocument* doc, BaseObject* baseObject, BaseTag* ptag)
    //*---------------------------------------------------------------------------*
    {
         // Separate material and bodypart selections
         AutoAlloc<AtomArray>     aa;
         if (!aa)                    return;
         BaseTag*     tag;
         LONG          cnt, i;
         // - Fill array with Material polygon selection tags
         for (tag = baseObject->GetFirstTag(); tag; tag = tag->GetNext())
         {
              if (tag->IsInstanceOf(Tpolygonselection) && tag->GetName().FindLast(".mtl", &cnt;))
                   aa->Append(tag);
         }
         cnt =                         aa->GetCount();
         for (i = 0L; i != cnt; ++i)
         {
              tag =     static_cast<BaseTag*>(aa->GetIndex(i));
              doc->AddUndo(UNDO_CHANGE,     tag);
              tag->Remove();
              tag->InsertBefore(ptag);
         }
         aa->Flush();
         // - Fill array with Bodypart polygon selection tags
         for (tag = baseObject->GetFirstTag(); tag; tag = tag->GetNext())
         {
              if (tag->IsInstanceOf(Tpolygonselection) && !tag->GetName().FindLast(".mtl", &cnt;))
                   aa->Append(tag);
         }
         cnt =                         aa->GetCount();
         for (i = cnt-1L; i >= 0L; --i)
         {
              tag =     static_cast<BaseTag*>(aa->GetIndex(i));
              doc->AddUndo(UNDO_CHANGE,     tag);
              tag->Remove();
              baseObject->InsertTag(tag, ptag);
         }
         aa->Flush();
         // - Fill array with Bodypart point selection tags
         for (tag = baseObject->GetFirstTag(); tag; tag = tag->GetNext())
         {
              if (tag->IsInstanceOf(Tpointselection))
                   aa->Append(tag);
         }
         cnt =                         aa->GetCount();
         for (i = cnt-1L; i >= 0L; --i)
         {
              tag =     static_cast<BaseTag*>(aa->GetIndex(i));
              doc->AddUndo(UNDO_CHANGE,     tag);
              tag->Remove();
              baseObject->InsertTag(tag, ptag);
         }
    }

    When I changed all of those to simply baseObject->InsertTag(tag);, it worked (but, of course, no sorting). So, insertion works as long as there is no predecessor set or not using the InsertBefore(). The tags are disappearing since they are first removed and then the reinsertion is failing under these circumstances - R11.5 only.

    ptag is a valid tag (a Phong tag added just before this is called using MakeTag() and checked) :

    // Add Phong Tag
    BaseTag* tag =     baseObject->MakeTag(Tphong);
    if (!tag) return ErrorException::OOMThrow(EE_DIALOG, logging, GeLoadString(IPPERR_MEMORY_TEXT), "IPPLoader.ParseFigureResFile.tag(Tphong)");
    if (storeUndoLoad) baseDocument->AddUndo(UNDO_NEW, tag);
    baseObject->SetPhong(TRUE, TRUE, pi05); //pi);
    IPPSortSelections(baseDocument, baseObject, tag);



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

    On 12/09/2009 at 11:44, xxxxxxxx wrote:

    Solved. I see that this has been done for a while but how it never impacted previous versions astounds me. Ya see, SetPhong() does something that I never knew about (between the asterisks) :

    > Bool BaseObject::SetPhong(Bool on, Bool anglelimit, Real angle) \> { \> \*\*\*\* \>      KillTag(Tphong); \>      if (!on) return TRUE; \>      BaseTag \*tag=MakeTag(Tphong); \>      if (!tag) return FALSE; \> \*\*\*\* \>      BaseContainer bc; \>      bc.SetBool(PHONGTAG_PHONG_ANGLELIMIT,anglelimit); \>      bc.SetReal(PHONGTAG_PHONG_ANGLE,angle); \>      tag->SetData(bc,FALSE); \>      return TRUE; \> }

    See there. It actually deletes the current tag and makes a new one. This *invalidates* my MakeTag(Tphong) tag pointer. Again, no idea how previous versions of my plugin work still (???). That seems like one of those 'need to know' type of things, ya know...

    I see a full-spectrum update in my near future. ;)



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

    On 12/09/2009 at 18:41, xxxxxxxx wrote:

    Matthias,

    Maybe an addition to the SDK documentation for R11.5 under SetPhong() :

    Bool on
    FALSE removes the phong tag from the object. TRUE deletes the current phong tag and adds a new one.

    Can't wait to get the new docs!!! :)



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

    On 14/09/2009 at 01:53, xxxxxxxx wrote:

    Thanks for the heads-up Robert, glad you figured it out. I will add this information to the documentation.

    cheers,
    Matthias


Log in to reply