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 22/03/2011 at 17:19, xxxxxxxx wrote:
[USERFORM][p]User Information:[/p]Cinema 4D Version: R12 Platform: Windows ; Language(s) : C++ ; [p]---------[/p][/USERFORM] Hi! I try to follow a link from a TargetExpression, but can't figure out how to do that ... I need to know on which linked object the target-camera looks op is the camera-object of type Ocamera BaseTag* tag = op- >GetTag(Ttargetexpression); **GeData p; bool ok = tag->GetParameter(1001, p, DESCFLAGS_GET_0); // ok == true LONG type = p.GetType(); // type == 133 ALIASLINK BaseLink* bl = p.GetBaseLink(); // bl != null ** BaseObject* target = (BaseObject * )bl; but this cast fails, you can't call target->GetName() : you get an ESP error and get wrong result for: Vector position = target- >GetAbsPos(); position is it I'm intrested in. I also tested: bl->GetLink, bl->ForceGetLink, but no luck as well Could you post a working code snippet please? Thanks a lot for assistance.
On 22/03/2011 at 21:19, xxxxxxxx wrote:
Well, a BaseLink is not a BaseObject derivative. It is a class which stores a link to a BaseObject or other type derived from BaseList2D. You need to call target = static_cast<BaseObject*>(bl->GetLink(doc));. Then it will work if the link is set.
On 23/03/2011 at 06:24, xxxxxxxx wrote:
Howdy,
I'd do it something like this:
BaseDocument *doc = GetActiveDocument(); // needed if doc isn't passed to function BaseTag *tag = op->GetTag(Ttargetexpression); if(tag) { BaseContainer *tData = tag->GetDataInstance(); if(tData) { BaseObject *target = tData->GetObjectLink(1001,doc); if(target) { String tName = target->GetName(); Vector position = target->GetAbsPos(); // ...the rest of your code for the target object } } }
Adios, Cactus Dan
On 23/03/2011 at 14:44, xxxxxxxx wrote:
Hi all! Thanks a lot for your suggestions! I tried your both methods and they won't work for me. Is there a difference if I execute this from an export-filter plugin. My intetion is to develop an special export-filter. Compilation is done with C++ and VisulaStudio 2010. Traversion of the object tree and write transformed data to output-file is no problem. Only getting the information for the linked object is the problem. I have written some lines of COFFEE to achieve this and it is no problem to get the desired data. Have I missed some preconditions? Many thanks in advance.
On 24/03/2011 at 07:48, xxxxxxxx wrote:
You'll probably need to post some example code of what you're trying to do, to get better suggestions.
If you add print statements to the code I posted in "else" statements like this:
BaseTag *tag = op->GetTag(Ttargetexpression); if(tag) { // ..... rest of code } else GePrint("tag pointer is NULL");
... then you can see if the pointers are NULL, which could be one reason the code isn't working for you.
On 24/03/2011 at 15:01, xxxxxxxx wrote:
Howdy, ok, I have tracked the problem down to: doc- >Polygonize(); If I omit **doc- >Polygonize(); **than it works like expected! Thanks for your example! A search in the forum resulted in: **Topic: Instances dropped on Document::Polygonize **https://plugincafe.maxon.net/topic/3495/2913_instances-dropped-on-documentpolygonize So I think it is the same cause of my problems. I will try the suggested solution and polygonize on an individual basis. Thanks a lot for your assistance! Bye! framer