Filling vertex_color for SceneHook
rui_mac last edited by rui_mac
cds.vertex_color = GeAllocTypeNC(SVector,pcnt);
Doesn't seems to be valid anymore for R20, I was trying to use:
Vector32* color_lst = NewMemClear(Vector32, pcnt);
But I'm getting and error:
No viable conversion from 'maxon::ResultPtr<Vector32>' (aka 'maxon::ResultMemT<maxon::Vec3<float, 1> *>') to 'Vector32 *' (aka 'Vec3<float, 1> *')
So, how can we fill the vertex_color list, now?
You are already on the right track using
NewMem(), now in R20, there's an additional change, which bites you here: The error handling.
This indeed is quite an important topic and (of course no bragging involved at all) a really nice feature in the new MAXON API. But it's also the one thing that causes most needed changes for R20. The point is, here at MAXON we do not take error checking lightly. Actually quite the opposite, we enforce error handling where ever we can and our internal developers have no chance to get away without.
So, before I provide the solution, here the recommendation to take the time to read the manuals about the Error System.
Additionally I recommend the manuals about classic API Entity Creation and Destruction and its MAXON API sibling about Memory Allocation. The additional means you get provided with in the new MAXON API can really make your life easier.
I apologize for writing so much before coming to your actual issue.
In the end
NewMemClear()now returns an Error Result, which basically encapsulates the actual return value and needs to be evaluated in order to get the actual return value. No worries, this is done in a highly optimized form, so it should not impede your code's performance in any way.
If you take a look at our SDK examples, you will find quite a few places, where error handling in conjunction with
NewMemis demonstrated in various ways.