Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. ello
    3. Posts
    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups

    Posts made by ello

    RE: debugging question

    finally i found it 🙂 in the init function i used SetFloat... and that caused the problem when trying GetVector

    this part is solved, thanks for pointing me towards the right direction

    posted in Cinema 4D SDK •
    RE: debugging question

    thank you both for getting back. i'll double check again if the ID has been used before. however i am totally lost with this upgrading. since the plugin worked flawless in previous versions and after getting it to compile with r20 it crashes so often.

    posted in Cinema 4D SDK •
    RE: NewMem question

    thank you. i got this working. maybe there are even other places in my code where i can use this knowledge 🙂

    posted in Cinema 4D SDK •
    RE: debugging question

    @r_gigante said in debugging question:

    what does it mean when the debugger holds at a line like that,
    Vector rndoffset = bc->GetVector(RNDOFFSET);
    with a message "CINEMA 4D.exe hat einen Haltepunkt ausgelöst."

    it simply means that the bc pointer is likely to be invalid.

    according to this problem, the pointer must be valid, i am checking it like

    	if (!bc) return nullptr;
    

    and if i run the plugin without debugging that one works. additional information, the line before that one throwing the exeption is:

    	Float lightSpeedFactor = bc->GetFloat(LIGHTSPEEDFACTOR);
    

    so, if bc wasn't valid, that one should give the same exception, right?
    so far, i replaced it by

    	Vector rndoffset = Vector(0);// bc->GetVector(RNDOFFSET);
    

    and the whole plugin works. this is really strange

    posted in Cinema 4D SDK •
    RE: debugging question

    thank you Riccardo, i must admit that i just followed the adjustments needed to make it compile under r20. the code worked like that in previous versions and the plugin itself is quite old so i didn't question the code itself.

    maybe it is time to do so and walk thru every line

    posted in Cinema 4D SDK •
    RE: About plugin ids

    is it possible to change the listed name somehow? i accidentally typed a wrong number in the label

    posted in Cinema 4D SDK •
    RE: styleguide warnings

    thank you.

    posted in Cinema 4D SDK •
    line limit for function??

    as i am currently walking thru the millions of warnings i get, what shall i think of such a warning?

    The function GetDDescription has 803 lines, this exceeds the limit of 500 lines.

    edit: this now appears for a bunch of functions i use in the plugin. does it mean the compiler isn't checking the rest of the lines? isn't it set a bit to low?

    posted in Cinema 4D SDK •
    RE: styleguide warnings

    is there a way to apply the style guide automatically in VS2015?

    posted in Cinema 4D SDK •
    RE: debugging question

    what does it mean when the debugger holds at a line like that,

    Vector rndoffset = bc->GetVector(RNDOFFSET);
    

    with a message "CINEMA 4D.exe hat einen Haltepunkt ausgelöst."

    posted in Cinema 4D SDK •
    RE: since i am not able to compile things for r20 on my computer here is the source...

    hm, in the sdk help it is mentioned under "api change list in r20"... scrolling down to lib_description.h

    i installed VS2015 just for seeing if it works better with c4d. however, in 2017 i had a nice built output where i could sort errors and warnings. this isn't there in the 2015 version, or do i need to toggle it somewhere. cannot find

    nevermind, found it 🙂

    posted in Cinema 4D SDK •
    RE: styleguide warnings

    thank you. seems not working in VS2017 but i found an option for the warning level in the properties

    posted in Cinema 4D SDK •
    RE: NewMem question

    and btw, it seems to be a general problem with all parts of the plugin, cinema is not crashing with most of them, but the debugger halts everytime

    posted in Cinema 4D SDK •
    RE: NewMem question

    @s_bach thank you very much for pointing me to that. however, i tried adopting that to a function retrieveing the vertex normals and now i don't know how to properly return those normals.

    Vector *GetVertexNormals(PolygonObject *pObj)
    {
    	Int32 numVerts = pObj->GetPointCount();
    	Int32 numPolys = pObj->GetPolygonCount();
    	const Vector *pVerts = pObj->GetPointR();
    	const CPolygon *pPolys = pObj->GetPolygonR();
    
    	// initialize neighbor class... this is used to compute m_SrcvNorms
    	Neighbor neighbor;
    	if( !neighbor.Init(numVerts, pPolys, numPolys, NULL) )
    		return NULL;
    
    	//** those two lines worked in the old version **//
    	//Vector *pNormals = (Vector *)NewMemClear(UChar,numVerts * sizeof(Vector));
    	//if( !pNormals )     return NULL;
    
    	//** these are my adoption to basearray **//
    	maxon::BaseArray<Vector> pNormals;
    	if(pNormals.GetCount()<=0) return NULL;
    
    	// Determine a Normal for each vertex of mesh
    	Int32 i, j, faceCnt, *pFaces = NULL;
    	Vector vNorm;
    	for(i=0; i<numVerts; i++)
    	{
    		vNorm = Vector();          // (re)intitialize 
    		neighbor.GetPointPolys(i, &pFaces, &faceCnt);
    		if( faceCnt )
    		{
    			for(j=0; j<faceCnt; j++)
    			{
    				Vector n = CalcFaceNormal(pVerts, pPolys[pFaces[j]]);
    				vNorm += !n;
    			}
    			vNorm /= faceCnt;          // average the normal(s)
    			pNormals[i] = !vNorm;     // normalize and store
    		}
    		else
    			pNormals[i] = Vector(0.0,1.0,0.0);     // default case = Up for any stray verts
    	}
    	return pNormals;
    }
    
    posted in Cinema 4D SDK •
    RE: Description... missing member "ID"

    @s_bach thank you. i still am on my road... at least it solves the compiler error. i get quite some crashes after updating. guess this will take some time

    posted in Cinema 4D SDK •
    RE: debugging question

    thanks for looking into it

    BaseObject *wobbler::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
    {	  
    	BaseDocument* doc = op->GetDocument();
    	BaseContainer* bc = op->GetDataInstance();
    	ModelingCommandData cd;
    	Bool dirty;
    	Vector *pNormals = NULL;
    	Vector polyNormal = (Vector)0;
    	const CPolygon* pol = NULL;
    	Vector tempVec = (Vector)0;
    
    	Float time = doc->GetTime().GetFrame(doc->GetFps());
    	if ((speed).GetLength()!=0)
    		bc->SetFloat(ZEIT,time);
    	Vector *padr;
    
    	Float arr[12];
    	InitFbm(arr,10,0.1,0.5);
    
    	BaseObject* main = NULL;
    	BaseObject* group = NULL;
    	PolygonObject* clone = NULL;
    	BaseObject* child = NULL;
    
    	BaseContainer cbc;
    
    	if (smooth)
    	{
    		main = BaseObject::Alloc(Osds);
    		main->SetParameter(SDSOBJECT_SUBEDITOR_CM,GeData(subdive),DESCFLAGS_SET::NONE);
    		main->SetParameter(SDSOBJECT_SUBRAY_CM,GeData(subdivr),DESCFLAGS_SET::NONE);
    		group = BaseObject::Alloc(Onull);
    		if (!group) goto Error;
    		group->InsertUnderLast(main);
    	}
    	else
    	{
    		main = BaseObject::Alloc(Onull);
    	}
    	if (!main) goto Error;
    	child = op->GetDown();
    	if (!child) goto Error;
    
    	op->NewDependenceList();
    	while(child)
    	{
    		op->AddDependence(hh,child);
    		child = child->GetNext();
    	}
    
    	dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS::MATRIX|DIRTYFLAGS::DATA|DIRTYFLAGS::CHILDREN);
    	dirty = dirty || !op->CompareDependenceList();
    
    	if (!dirty) 
    	{
    		blDelete(main);		
    		op->TouchDependenceList();		
    		return op->GetCache(hh);
    	}
    	if (checkEllo()) GePrint("Rebuilding wobbler..."_s);
    	child = op->GetDown();
    
    	while(child)
    	{
    		clone = static_cast<PolygonObject*>(op->GetAndCheckHierarchyClone(hh,child,HIERARCHYCLONEFLAGS::ASPOLY,&dirty,0,false));
    		if (clone)
    		{
    			if (clone->GetType()==Opolygon)
    			{		
    				cd.doc = doc;
    				cd.op = clone;
    				cbc.SetBool(MDATA_SUBDIVIDE_HYPER, true);
    				cbc.SetFloat(MDATA_SUBDIVIDE_ANGLE, 90);
    				cbc.SetInt32(MDATA_SUBDIVIDE_SUB, sub);
    				cd.bc = &cbc;
    				if(SendModelingCommand(MCOMMAND_SUBDIVIDE, cd))
    				{
    					pNormals = GetVertexNormals(clone);
    					padr = clone->GetPointW();
    					pol = clone->GetPolygonR();
    					for (int i=0;i<clone->GetPointCount();i++)
    					{
    						//polyNormal = normalRotation(padr[i], pNormals[i], 0,0,padr,pol,i,false);
    						tempVec = padr[i];
    						Float rmf1 = RidgedMultifractal(arr, Vector(seed + 1) + padr[i]*factor.x + time*speed + op->GetRelPos()*bypos.x, 20, 0, 1)*strength.x;
    						Float rmf2 = RidgedMultifractal(arr, Vector(seed + 2) + padr[i]*factor.y + time*speed + op->GetRelPos()*bypos.y, 20, 0, 1)*strength.y;
    						Float rmf3 = RidgedMultifractal(arr, Vector(seed + 3) + padr[i]*factor.z + time*speed + op->GetRelPos()*bypos.z, 20, 0, 1)*strength.z;
    						tempVec += Vector(rmf1,rmf2,rmf3);
    
    						tempVec += pNormals[i] * Turbulence(Vector(factor.x * (seed + tempVec.x*normalScale)) + time*speed,20,0)*normalStrength;
    						tempVec += pNormals[i] * Turbulence(Vector(factor.y * (seed + tempVec.y*normalScale)) + time*speed,20,0)*normalStrength;
    						tempVec += pNormals[i] * Turbulence(Vector(factor.z * (seed + tempVec.z*normalScale)) + time*speed,20,0)*normalStrength;
    
    						padr[i]=tempVec;
    					}
    					if (pNormals) DeleteMem(pNormals);
    				} 
    				if (smooth)
    					clone->InsertUnderLast(group);
    				else
    					clone->InsertUnderLast(main);
    			}
    			else
    			{
    				blDelete(clone);
    			}
    		}
    		child = child->GetNext();
    	}
    	op->NewDependenceList();
    	child = op->GetDown();
    	while(child)
    	{
    		op->AddDependence(hh,child);
    		child = child->GetNext();
    	}
    
    	if (op != nullptr)
    	{
    		op->TouchDependenceList();
    	}
    	return main;
    
    Error:
    	if (group) blDelete(group);
    	if (main) blDelete(main);
    	return NULL;
    }
    

    edit: still happens

    posted in Cinema 4D SDK •
    RE: debugging question

    hm, it leads me to a line:

    	op->TouchDependenceList();
    ->	return main;
    

    what api changes could i refer to? since the plugin worked well before adopting to r20.

    posted in Cinema 4D SDK •
    debugging question

    what does it tell me when debugging halts at the following code, what should be my steps to find the evildoer:

    void BaseObject::TouchDependenceList(void)
    {
    	C4DOS.Bo->TouchDependenceList(this);
    }
    
    Bool VPBuffer::GetLine(Int32 x, Int32 y, Int32 cnt, void* data, Int32 bitdepth, Bool dithering) const
    {
    	return C4DOS.Sh->VPGetLine(this, x, y, cnt, data, bitdepth, dithering);
    }
    

    Ausnahme ausgelöst bei 0x00007FFF3413A051 (c4dplugin.xdl64) in CINEMA 4D.exe: 0xC0000005: Zugriffsverletzung beim Schreiben an Position 0x0000000000000000.

    posted in Cinema 4D SDK •
    RE: since i am not able to compile things for r20 on my computer here is the source...

    maybe someone can point me towards how i debug with visual studio 2017?
    because i get lot's of crashes 🙂 what else to expect

    ok, found this: https://developers.maxon.net/?p=1560

    edit: visual studio now throws this at me

    application_Intel_64bit.pdb not loaded

    the only search result leads me here: http://www.plugincafe.com/forum/forum_posts.asp?TID=10601&KW=R16+memory+leaks&PID=41955 but i dont understand how the information i find there helps me

    posted in Cinema 4D SDK •
    RE: Description... missing member "ID"

    @rsodre so it is wrong way? my code seems to compile now

    posted in Cinema 4D SDK •