Le lundi 18 mars 2019 17:27:16 UTC-4, Justin Israel a écrit :
> MVectorArray in python is a SWIG object wrapping the C++ type. I am not sure 
> of a way to pass a pointer to the C++ MVectorArray and 'wrap' it in Python. 
> But that would be the lowest overhead if it were possible since you wouldn't 
> need to copy. 
> The hacky workaround is to serialize it to something like 
> /dev/shm/myvector.json and let python deserialize it. That incurs the cost of 
> having to encode/decode, but avoids the huge literal string call (I am not 
> sure of the cost differences here). 
> 
> 
> I'm probably missing some other option to solve this.
> 
> 
> On Tue, Mar 19, 2019 at 6:26 AM <pety20...@gmail.com> wrote:
> hi, how i can read or how i can access to MVectorArray of C++ code by python 
> code?
> 
> right now, i convert C++ MVectorArray to String and run it by 
> executePythonCommand() func
> 
> 
> 
> ( MGlobal::executePythonCommand(c++MVectorArrayToString); )
> 
> 
> 
> but,i Want a faster way...
> 
> 
> 
> i think, convert C++ MVectorArray to String, is not good way!(in big arrays)
> 
> 
> 
> -- 
> 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to python_inside_maya+unsubscr...@googlegroups.com.
> 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/python_inside_maya/58b6b569-f8cf-418c-828b-7c6c1577c61c%40googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.

If this array is the result of another function called in cpp, maybe you can 
access it with ctypes and get the result in python.
If you want to get your cpp variable content on the fly, then I'd go for 
Justin's solution (but first I'd try to double check there is no better 
structure for what I want to achieve)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c39ad963-8195-4956-b46b-f80e5bff3cfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to