Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/10/2009 at 12:49, xxxxxxxx wrote:
User Information: Cinema 4D Version: r11 Platform: Windows ; Language(s) : C++ ;
--------- Hi there,
i am struggling with the following code. I found that old thread by kuroyume and updated my code accordingly, but the link field still stays empty.
anyone?
thanks for any help. cheers, ello
first:
> `
\> BaseTag *tempTag = clone->MakeTag(Ttargetexpression); \> tempTag->GetDataInstance()->SetLink(TARGETEXPRESSIONTAG_LINK,target); \>
`
second: > `
\> BaseTag *tempTag = clone->MakeTag(Ttargetexpression); \> AutoAlloc<BaseLink> link; \> link->SetLink(target); \> tempTag->SetParameter(DescID(TARGETEXPRESSIONTAG_LINK), GeData(link), NULL); \>
On 08/10/2009 at 13:48, xxxxxxxx wrote:
First try is correct. You need to send after: tempTag->Message(MSG_UPDATE);
And, of course, the 'target' MUST be in a document. You can't set links to things not inserted into a document.
On 08/10/2009 at 13:57, xxxxxxxx wrote:
hm, that doesnt change anything. the "target" is created by the plugin earlier. maybe thats the problem?
\> \> BaseObject* target = NULL; \> target = BaseObject::Alloc(Onull); \> target->SetPos(targetHelper->GetPos()); \> target->GetDataInstance()->SetLong(NULLOBJECT_DISPLAY,NULLOBJECT_DISPLAY_POINT); \> target->GetDataInstance()->SetLong(NULLOBJECT_RADIUS,20); \> target->InsertUnderLast(main); \>
anything else could be responsible??
On 08/10/2009 at 16:45, xxxxxxxx wrote:
I still can't recreate your problem. This code was substituted quickly into one of my existing Command plugins and works:
> BaseObject\* target = BaseObject::Alloc(Onull); \> if (!target) return FALSE; \> doc->InsertObject(target, NULL, NULL, FALSE); \> target->SetPos(Vector(100.0f)); \> BaseContainer\* bc = target->GetDataInstance(); \> bc->SetLong(NULLOBJECT_DISPLAY, NULLOBJECT_DISPLAY_POINT); \> bc->SetReal(NULLOBJECT_RADIUS, 20.0f); \> //target->InsertUnderLast(main); \> BaseObject\* source = BaseObject::Alloc(Ocube); \> if (!source) return FALSE; \> doc->InsertObject(source, NULL, NULL, FALSE); \> BaseTag\* tempTag = source->MakeTag(Ttargetexpression); \> if (!tempTag) return FALSE; \> tempTag->GetDataInstance()->SetLink(TARGETEXPRESSIONTAG_LINK,target); \> EventAdd(); \>
BaseObject\* target = BaseObject::Alloc(Onull); \> if (!target) return FALSE; \> doc->InsertObject(target, NULL, NULL, FALSE); \> target->SetPos(Vector(100.0f)); \> BaseContainer\* bc = target->GetDataInstance(); \> bc->SetLong(NULLOBJECT_DISPLAY, NULLOBJECT_DISPLAY_POINT); \> bc->SetReal(NULLOBJECT_RADIUS, 20.0f); \> //target->InsertUnderLast(main); \> BaseObject\* source = BaseObject::Alloc(Ocube); \> if (!source) return FALSE; \> doc->InsertObject(source, NULL, NULL, FALSE); \> BaseTag\* tempTag = source->MakeTag(Ttargetexpression); \> if (!tempTag) return FALSE; \> tempTag->GetDataInstance()->SetLink(TARGETEXPRESSIONTAG_LINK,target); \> EventAdd(); \>
Note that NULLOBJECT_RADIUS is a Real not a Long value. Also note EventAdd().
On 09/10/2009 at 02:22, xxxxxxxx wrote:
thanks robert,
very strange.. maybe its really because i am using it in a ObjectPlugin?? Are there any restrictions?
i'll try to find whats the reason for this..
edit: i just recognized that "target" is deleted when i convert the pluginobject ("c")
its visible as long the plugin object exists, so maybe its somehow lost.. investigating it...
On 09/10/2009 at 02:43, xxxxxxxx wrote:
ok, i got it partially working by placing the tag creating snippet after inserting the clone into the plugin...
\> \> clone->InsertUnderLast(main); \> BaseTag *tempTag = clone->MakeTag(Ttargetexpression); \> if (!tempTag) goto Error; \> tempTag->GetDataInstance()->SetLink(TARGETEXPRESSIONTAG_LINK,(BaseList2D* )target); \>
now its working when the object is converted, but not when the pluginobject is still there... any ideas??
On 09/10/2009 at 05:35, xxxxxxxx wrote:
The problem is you are working on a virtual object which is not yet in the document. Expressions will not work.
cheers, Matthias
On 09/10/2009 at 06:02, xxxxxxxx wrote:
I had a sneaking suspicion that GetVirtualObjects() might be involved here. Since it is not 'directly' added to the document that makes sense. Matthias, would it still work if the target object were a real document object?
On 09/10/2009 at 06:11, xxxxxxxx wrote:
Quote: Originally posted by kuroyume0161 on 09 October 2009 > > * * * > > Matthias, would it still work if the target object were a real document object? > > > * * *
It doesn't seem to work.
On 09/10/2009 at 11:14, xxxxxxxx wrote:
yes, i already had a real object in the scene to retrieve its position and use it in my plugin.
how can i accomplish such a thing?? i know, i could calculate the facing of the objects myself, but i really like to use a tag thats already there, since this would work even if the object is converted. anything possible??
cheers, ello
On 09/10/2009 at 12:38, xxxxxxxx wrote:
ok, i solved this by calculating the facing manually in the plugin and after converting the tags are used...
thanks for all yoour inputs