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 14/03/2010 at 06:50, xxxxxxxx wrote:
User Information: Cinema 4D Version: r11 Platform: Language(s) :
--------- Hi, i am using this to access a user defined object:
cloneOfBase = op->GetAndCheckHierarchyClone(hh,baseMesh,HCLONE_ASPOLY,&dirty,NULL,FALSE); if (!cloneOfBase) goto Error;
and this to get its points and polygons:
padr = ToPoint(cloneOfBase)->GetPointR(); pol = ToPoly(cloneOfBase)->GetPolygonR(); count = ToPoint(cloneOfBase)->GetPointCount();
everything works fine, but as soon as i use this line (while 0<i<count) it crashes for certain objects (e.g. Ooiltank, Ofractal,Odisc), Oplane, Ocube, Opyramid and nearly all others work :
Vector mPoint = (padr[pol[i].a] + padr[pol[i].b] + padr[pol[i].c] + padr[pol[i].d])/(3 + (pol[i].c == pol[i].d));
can anyone tell me why?? thank you very much!
cheers, Ello
On 14/03/2010 at 12:40, xxxxxxxx wrote:
what do you have for "Error:"? what is there?
you say
if (!cloneOfBase) goto Error;
what comes after "Error" ?
On 14/03/2010 at 14:01, xxxxxxxx wrote:
nothing special, just this to free neccessary stuff and return nothing:
Error: blDelete(main); return NULL; }
i found that i exceeded the maximum entries, after fixing that it works. only thing i still dont understand is why it worked for some objects and others not
On 15/03/2010 at 14:59, xxxxxxxx wrote:
Hi there,
so, the issue is again fighting back in other dimensions. in the editor everything looks like it should (clones are placed properly), until i try to render it. than it crashes (sometimes with an general message, sometimes it hangs like i have to use the taskmanager to quit cinema)..
any ideas where to search for the bug??
cheers, ello
On 15/03/2010 at 15:01, xxxxxxxx wrote:
Have you tried placing some GePrint() 's in there to see where it makes it to. This will help you figure out which code is causing the crash.
~Shawn
On 15/03/2010 at 15:06, xxxxxxxx wrote:
also, be sure to check all of your pointers.. for example, if you have.....
BaseObject * op = BaseObject::Alloc(Osphere);
make sure you have
if (!op) return False; or something like it.
On 16/03/2010 at 00:40, xxxxxxxx wrote:
ye, i'll try the thing with GePrint.. used it before. Sometimes i just dont see the wood because of the trees
pointers are all checked. the strange thing is that it just happens when rendering. the object itself works and i can convert (using c) and this works too... only rendering crashes...
btw, how can i know in an object plugin if the render has been called??
On 16/03/2010 at 00:53, xxxxxxxx wrote:
Originally posted by xxxxxxxx btw, how can i know in an object plugin if the render has been called??
Originally posted by xxxxxxxx
In GetVirtualObjects() check the HierarchyHelp's GetVFlags() method.
cheers, Matthias
On 16/03/2010 at 02:12, xxxxxxxx wrote:
ok, i managed to find what is causing the crash now.. Here is the relevant code:
PolygonObject* baseMesh = static_cast<PolygonObject*>(bc->GetLink(BASEMESH,doc)); if (!baseMesh) goto Error; ... op->NewDependenceList(); op->AddDependence(hh,baseMesh); // <--- this is causing the crash
On 16/03/2010 at 02:35, xxxxxxxx wrote:
can someone point me on how exactly i can check if GetVFlags() contains VFLAG_INTERNALRENDERER or VFLAG_EXTERNALRENDERER ?? it returns 18(if rendered in editor) and 20 (if rendered in the image manager) but if i try this:
if((hh->GetVFlags()!=18)&&(hh->GetVFlags()!=20))op->AddDependence(hh,baseMesh);
it still crashes... if i comment that line out, it doesnt crash anymore, but i need that line for performance reasons
thanks and cheers, ello
On 16/03/2010 at 03:03, xxxxxxxx wrote:
GetVFlags() returns a bit mask. You have to mask the bits you want to check (single & and single | operator).
if (GetVFlags() & VFLAG_INTERNALRENDERER) { //editor rendering } else if (GetVFlags() & VFLAG_EXTERNALRENDERER) { //external rendering }
On 16/03/2010 at 03:07, xxxxxxxx wrote:
thank you! than it must be something other.. if i use the following line and render in the editor, it crashes:
if (!(hh->GetVFlags() & VFLAG_INTERNALRENDERER))op->AddDependence(hh,baseMesh);
if i comment the whole thing out, it renders with no problem.
any ideas what could cause this strange behaviout? why does commenting works, but disabling when rendering doesnt??
On 16/03/2010 at 03:38, xxxxxxxx wrote:
and to make it even more strange, rendering in into the image manager works, but rendering in the editor doesnt work:
Bool editing = TRUE; if (hh->GetVFlags() & VFLAG_INTERNALRENDERER) editing = FALSE; if (hh->GetVFlags() & VFLAG_EXTERNALRENDERER) editing = FALSE; if (editing) op->AddDependence(hh,baseMesh); else GePrint("rendering...");
any ideas?
On 16/03/2010 at 03:56, xxxxxxxx wrote:
Can you post a simplified version of your GetVirtualObjects() method that shows the problem?
On 16/03/2010 at 04:27, xxxxxxxx wrote:
ok, here it is.. hope it makes sense.
BaseObject *cloneOnMesh::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh) { editing = TRUE; if (hh->GetVFlags() & VFLAG_INTERNALRENDERER) { //GePrint ("rendering in editor"); editing = FALSE; } if (hh->GetVFlags() & VFLAG_EXTERNALRENDERER) { //GePrint ("rendering in manager"); editing = FALSE; } Bool facing = FALSE; BaseObject* child = NULL; Bool autoCalculate = FALSE; BaseObject* cloneOfBase = NULL; BaseObject* baseMesh = NULL; const Vector* padr; const CPolygon* pol; LONG numberofclones; LONG maxcount; BaseDocument* doc = op->GetDocument(); BaseContainer *bc=op->GetDataInstance(); BaseObject* targetHelper = NULL; Bool dirty; BaseObject *main = BaseObject::Alloc(Onull); main->SetName(pluginName); if (!main) goto Error; //object which should be faced by clones targetHelper = static_cast<PolygonObject*>(bc->GetLink(FACING,doc)); if (targetHelper) facing = TRUE; //find object to be cloned child = op->GetDown(); if(!child) goto Error; //objects to place clones along baseMesh = static_cast<PolygonObject*>(bc->GetLink(BASEMESH,doc)); if (!baseMesh) goto Error; if (editing) { // start new list op->NewDependenceList(); op->AddDependence(hh, child); op->AddDependence(hh,baseMesh); if (facing) op->AddDependence(hh, targetHelper); dirty = op->CheckCache(hh) || op->IsDirty((autoCalculate*DIRTY_MATRIX)|DIRTY_DATA|DIRTY_CHILDREN); dirty = dirty || !op->CompareDependenceList(); //return cache if (!dirty) { blDelete(main); op->TouchDependenceList(); return op->GetCache(hh); } } cloneOfBase = op->GetAndCheckHierarchyClone(hh,baseMesh,HCLONE_ASPOLY,&dirty,NULL,FALSE); if (!cloneOfBase) goto Error; padr = ToPoint(cloneOfBase)->GetPointR(); pol = ToPoly(cloneOfBase)->GetPolygonR(); numberofclones = maxcount = ToPoly(cloneOfBase)->GetPolygonCount(); maxcount = ToPoly(cloneOfBase)->GetPolygonCount(); for (int i=0;i<numberofclones;i++) { // ... create clones and modify them } if (cloneOfBase) blDelete(cloneOfBase); if (editing) { //if i dont do the following things the caching doesnt work //actually i dont understand why i need to do this again op->NewDependenceList(); op->AddDependence(hh, child); op->AddDependence(hh,baseMesh); if (facing) op->AddDependence(hh, targetHelper); op->TouchDependenceList(); } return main; Error: blDelete(main); return NULL; }
edit: i updated the code and with using the GetVFlags, it works now, so i guess it must be something other in my code where i am creating the clones (i'll double check the whole stuff again)... nevertheless if there is something generally wrong with how i use the dependeceList, it'd be great if someone can point me to it.