Update problems

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

On 14/04/2008 at 05:32, xxxxxxxx wrote:

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

---------
Hi, I have a few problems with Cinema updating some events.

- Button update: I've got a button which adds an additional entry in my tag's GUI. The first time it is pushed a new entry appears, but when further pushing it nothing happens, unless I click the tag icon again. Apparently the GetDDescription method does not get called. How do I solve this? Am I allowed to call GetDDescription by myself? And what do I have to place in for LONG &flags;?

- Time update: I have a for-call and in each transition the current time is set one frame forward which works correctly. But my objects' positions do not get updated for each frame:

for (long i = 0; i<frames; i++){
     GePrint ("for");
     time = BaseTime (i, docFps);
     PosOrigin = origin->GetPos();
     PosTarget = target->GetPos();
...
}

Moreover they always have the coordinates of the last frame, even if I don't include the last frame in the for-call.

Any ideas?

Thanks

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

On 14/04/2008 at 08:23, xxxxxxxx wrote:

Ok, second problem solved. Thx to

time = BaseTime (i, docFps);
     doc->SetTime (time);
     doc->AnimateDocument (NULL, FALSE, TRUE);
     EventAdd();

But I still need a solution for the first problem... So what do I have to insert as the third parameter "LONG &flags;" in GetDDescription?

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

On 15/04/2008 at 02:40, xxxxxxxx wrote:

I am not sure why it is not working for you without having a look at your source. Here a working example, it's a tag where you can add BOOL description elements with a button.

> \> ///////////////////////////////////////////////////////////// \> // CINEMA 4D SDK                                           // \> ///////////////////////////////////////////////////////////// \> // (c) 1989-2004 MAXON Computer GmbH, all rights reserved // \> ///////////////////////////////////////////////////////////// \> \> // "look at editor camera" expression example \> \> #include "c4d.h" \> #include "c4d_symbols.h" \> #include "tlookatcameraexp.h" \> \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_LOOKATCAMERATAG     1001165     //plugin ID \> #define ID_SUBCONTAINER 1022484     //sub-container ID \> \> enum //sub-container element IDs \> { \>      LOOKATCAMERAEXP_DESCCOUNT = 2000,     //ID for number of added description elements \>      LOOKATCAMERAEXP_DESCOFFSET \> }; \> \> class LookAtCamera : public TagData \> { \>      public: \>           virtual Bool Init(GeListNode \*node); \> \>           virtual LONG Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags); \>           virtual Bool GetDDescription(GeListNode \*node, Description \*description,LONG &flags;); \>           virtual Bool Message(GeListNode \*node, LONG type, void \*data); \> \>           static NodeData \*Alloc(void) { return gNew LookAtCamera; } \> }; \> \> Bool LookAtCamera::Init(GeListNode \*node) \> { \>      BaseTag     \*tag = (BaseTag\* )node; \>      BaseContainer \*data = tag->GetDataInstance(); \> \>      BaseContainer subbc; \>      subbc.SetLong(LOOKATCAMERAEXP_DESCCOUNT, 0); \>       \>      data->SetContainer(ID_SUBCONTAINER, subbc); \> \>      return TRUE; \> } \> \> \> Bool LookAtCamera::GetDDescription(GeListNode \*node, Description \*description,LONG &flags;) \> { \>      if (!description->LoadDescription(ID_LOOKATCAMERATAG)) return FALSE; \> \>      BaseTag     \*tag = (BaseTag\* )node; \>      BaseContainer \*data = tag->GetDataInstance(); \> \>      BaseContainer subbc = data->GetContainer(ID_SUBCONTAINER); \>       \>      LONG desccnt = subbc.GetLong(LOOKATCAMERAEXP_DESCCOUNT); \>      LONG i = 0; \> \>      for(i=0; i<desccnt; i++) \>      { \>           BaseContainer bc = GetCustomDataTypeDefault(DTYPE_BOOL); \> \>           bc.SetString(DESC_NAME,"Switch"); \>           bc.SetString(DESC_SHORT_NAME,"Switch"); \> \>           bc.SetLong(DESC_ANIMATE,DESC_ANIMATE_ON); \>           bc.SetBool(DESC_REMOVEABLE,FALSE); \>           if (!description->SetParameter(DescLevel(LOOKATCAMERAEXP_DESCOFFSET+i,DTYPE_BOOL,0),bc,DescLevel(ID_TAGPROPERTIES))) return FALSE; \>      } \> \>      flags |= DESCFLAGS_DESC_LOADED; \> \>      return TRUE; \> } \> \> Bool LookAtCamera::Message(GeListNode \*node, LONG type, void \*data) \> { \>      switch (type) \>      { \>           case MSG_DESCRIPTION_COMMAND: \>           { \>                DescriptionCommand \*dc = (DescriptionCommand\* ) data; \>                if (dc->id[0].id==ADD_BOOL) \>                { \>                     BaseTag \*tag = (BaseTag\* )node; \>                     BaseContainer \*data = tag->GetDataInstance(); \> \>                     BaseContainer subbc = data->GetContainer(ID_SUBCONTAINER); \>                     LONG desccnt = subbc.GetLong(LOOKATCAMERAEXP_DESCCOUNT)+1; \>                     subbc.SetLong(LOOKATCAMERAEXP_DESCCOUNT, desccnt); \>                     data->SetContainer(ID_SUBCONTAINER, subbc); \>                } \>           } \>      } \> \>      return TRUE; \> } \> \> LONG LookAtCamera::Execute(PluginTag \*tag, BaseDocument \*doc, BaseObject \*op, BaseThread \*bt, LONG priority, LONG flags) \> { \>      return EXECUTION_RESULT_OK; \> } \> \> Bool RegisterLookAtCamera(void) \> { \>      // decide by name if the plugin shall be registered - just for user convenience \>      String name=GeLoadString(IDS_LOOKATCAMERA); if (!name.Content()) return TRUE; \>      return RegisterTagPlugin(ID_LOOKATCAMERATAG,name,TAG_VISIBLE,LookAtCamera::Alloc,"Tlookatcameraexp","lookatcamera.tif",0); \> } \>

> \> CONTAINER Tlookatcameraexp \> { \>      NAME Tlookatcameraexp; \>      INCLUDE Texpression; \> \>      GROUP ID_TAGPROPERTIES \>      { \>           BUTTON ADD_BOOL { } \>      } \> } \>

> \> #ifndef \_Tlookatcameraexp_H\_ \> #define \_Tlookatcameraexp_H\_ \> \> enum \> { \>      ADD_BOOL                         = 1000, \> }; \> \> #endif \>

> \> STRINGTABLE Tlookatcameraexp \> { \>      Tlookatcameraexp               "Look At Camera Expression"; \>       \>      ADD_BOOL                         "Add Switch"; \> } \>

cheers,
Matthias

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

On 15/04/2008 at 04:57, xxxxxxxx wrote:

Thx very much. I didn't realise you have to change a description element to call GetDDescription. So I used a class variable as a counter so it didn't work.

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

On 15/04/2008 at 06:05, xxxxxxxx wrote:

The counter is not a description element. I just stored it in the object's container's sub-container to have it automatically saved with the scene. otherwise I would have to use Write/Read() functions.

cheers,
Matthias