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).
On 21/05/2018 at 08:08, xxxxxxxx wrote:
User Information: Cinema 4D Version: 18+ Platform: Windows ; Mac ; Language(s) : C++ ;
--------- Hi,
I want to assign a vertex color tag to a vertex map shader.
Here is the code I am using:
// allocate the Vertex Map shader AutoAlloc<BaseShader> vertexMapShader(Xvertexmap); if (!vertexMapShader) return false; // retrieve the BaseContainer of the Vertex Map shader BaseContainer* vertexMapShaderBC = vertexMapShader->GetDataInstance(); if (!vertexMapShaderBC) return false; // The Vertex Color tag is vctag GeData gd; vertexMapShaderBC->GetParameter(GV_VERTEXCOLORMAP_INPUT_TAG, gd); // ---->this is where the crash happens BaseLink *myLink = gd.GetBaseLink(); myLink->SetLink(vctag);
Any idea why it does not work?
On 22/05/2018 at 05:32, xxxxxxxx wrote:
Hi Salozo,
First of all, I'm not sure to understand, from where you get the ID GV_VERTEXCOLORMAP_INPUT_TAG, to know an ID you can simply drag and drop the parameter in the console. Another thing is actually you should use Set/GetParameter in the C4DAtom(the shader in your case) itself and not on the BaseCcontainer. In other hands here an example how to set up a link.
// allocate the Vertex Map shader AutoAlloc<BaseShader> vertexMapShader(Xvertexmap); if (!vertexMapShader) return false; // allocate the Vertex Map AutoAlloc<BaseTag> vertexMap(Tvertexcolor); if (!vertexMap) return false; // allocate the Vertex Map AutoAlloc<BaseLink> link; if (!link) return false; link->SetLink(vertexMap.Release()); // I use release, since vertexMap is an AutoAlloc object, so you need to release it in order to let the ownership of the vertexMap I created to c4d. vertexMapShader->SetParameter(SLA_DIRTY_VMAP_OBJECT, GeData(link), DESCFLAGS_SET_0);
Hope it helps, if you have any question please do not hesitate!
Cheers, Maxime
On 22/05/2018 at 07:59, xxxxxxxx wrote:
Thank you for your help Maxime. It works as it should now.