Inserting a custom tag & more

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

On 13/04/2008 at 15:32, xxxxxxxx wrote:

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

---------
Hi,

I want to make a command plugin that does the following things.

1. Insert two objects into the scene
I already managed to do this. No problem.

2. Attach a tag to one of the objects
How do I do this? The tag I want to attach is an Expression Tag plugin that I made myself.

3. Link the 2nd object in a link field in the 1st object
The first object (it's a Generator Object plugin that I made myself) has some link fields in its description. I want to link the 2nd object in one of these link fields. How do I do that?

Once again, thanks in advance!

Greetings,
Jack

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

On 13/04/2008 at 20:20, xxxxxxxx wrote:

2. Create the tag using BaseObject::MakeTag([insert PluginID here]). If you want to create undos as well, do it this way:

BaseTag* tag = PluginTag::Alloc([insert PluginID here]);
if (!tag) // error;
baseObject->InsertTag(tag);
baseDocument->AddUndo(UNDO_NEW, tag);

3. Get the first object's BaseContainer and set the link:

BaseContainer* bc = obj->GetDataInstance().
if (bc) bc->SetLink([LINK_ID], secobj);

Replace [LINK_ID] with the LINK id from the object's res description file.

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

On 14/04/2008 at 00:04, xxxxxxxx wrote:

Way cool, thank you very much!

Just one additional question:
Can I also create an UNDO for the complete action (create object + create object + create tag + link object)?

Best regards,
Jack

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

On 14/04/2008 at 00:53, xxxxxxxx wrote:

Btw. you can use MakeTag() to attach tags to objects.

> \> doc->StartUndo(); \> \> BaseTag \*tag = NULL; \> tag = op->MakeTag(PLUGIN_ID); \> if(!tag) return FALSE; \> \> doc->AddUndo(UNDO_NEW, tag); \> \> doc->AddUndo(UNDO_CHANGE, tag); \> \> BaseContainer \*bc = tag->GetDataInstance(); \> bc->SetLink(LINK_ID, op2); \> \> doc->EndUndo(); \>

cheers,
Matthias

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

On 14/04/2008 at 01:24, xxxxxxxx wrote:

Perfect. That makes it even easier.

Thanks!

Greetings,
Jack