Simple question, I’ve looked through many resources and haven’t found much regarding the vector_uchar type, especially as it pertains to this, when deleting vertex data:
set_subdata(int a, int b, vector_uchar const &data)
In python, the last argument would just be an empty byte-string, but in C++ it’s specified as a vector of unsigned chars. Trying to use vector functions like push_back yields errors too:
error C2663: 'std::vector<unsigned char,pallocator_array<unsigned char>>::push_back': 2 overloads have no legal conversion for 'this' pointer
So how would one use the vector_uchar type, to achieve the same effect an empty byte-string does in Python, i.e. delete vertex data for instance? What would I pass in as the third argument in C++?
Thanks for pointing that out, but the issue is, set_data modifies the entire raw data array, whereas set_subdata modifies only a part of the raw data array, which is what I need. When I tried passing in a char type, unsigned char type, or string type to set_subdata like this:
This results in a type-conversion error all the time:
error C2664: 'void GeomVertexArrayDataHandle::set_subdata(std::size_t,std::size_t,const vector_uchar &)': cannot convert argument 3 from 'std::string' to 'const vector_uchar &'
error C2664: 'void GeomVertexArrayDataHandle::set_subdata(std::size_t,std::size_t,const vector_uchar &)': cannot convert argument 3 from 'char' to 'const vector_uchar &'
error C2664: 'void GeomVertexArrayDataHandle::set_subdata(std::size_t,std::size_t,const vector_uchar &)': cannot convert argument 3 from 'unsigned char' to 'const vector_uchar &'
It’s adamant about argument 3 being const vector_uchar & type and not anything else, but I can’t find any documentation on how to add elements to it, or how to initialize it as an empty string. Thoughts?
They have the same type. In the case of set_data() there is no range, in set_subdata() you specify the range of data to replace. But they have the same data type.
Yes, I need to use set_subdata() precisely because it replaces a range of data, not the entire data. I need to only replace part of the data, not all of it, which is why I can only use set_subdata().
As for the type, like I said, passing in string, char or unsigned char just gives me the type-conversion error I highlighted. The data type they reference is const vector_uchar &, but how is it used? This works, but how would I give an empty value to v_string?: