Sorry I have confused you there. I'm not storing it in the constructor, 
specifically. 

I am storing it though. The reason is this plugin has a lot of history and 
as a result has dozens of seldom-used flags. I'm storing the MArgDatabase 
to avoid maintaining pages of repeated code that copies flags from the 
MArgDatabase object into bools in some custom object.

I'm using a pointer (std::unique_ptr) now so I can call the constructor the 
usual way. Seems to work fine.

I'm still not sure what I have misinterpreted about default copy assignment 
operator, eg here <https://en.wikipedia.org/wiki/Special_member_functions>. 
After reading that, I thought that it should be possible to copy one 
MArgDatabase to another.


On Friday, 3 March 2017 12:14:58 UTC+11, Justin Israel wrote:
>
> What kind of plugin is it and why do you want to store it in the 
> constructor? Is there a reason to not use it when you actually need to 
> process the args?
>
>
> On Fri, Mar 3, 2017 at 12:16 PM Michael Boon <[email protected] 
> <javascript:>> wrote:
>
>> By "doesn't work" I mean it doesn't populate inputArgs with the supplied 
>> flags. syntax() gets called, and the plugin will reject bad flags, but any 
>> subsequent isFlagSet call I do returns false.
>>
>>
>> On Friday, 3 March 2017 10:13:44 UTC+11, Michael Boon wrote:
>>>
>>> Hey, I'm trying to process arguments in a C++ plugin. I'm a Python guy, 
>>> not C++, so little things like constructors trip me up a lot.
>>>
>>> If I do it like this:
>>> MArgDatabase inputArgs(syntax(), argList);
>>>
>>> it works fine.
>>>
>>> But I want inputArgs to be a member variable, so it's already been 
>>> constructed. I thought I would be able to copy it like this:
>>>
>>> inputArgs = MArgDatabase(syntax(), args);
>>>
>>>
>>> but that doesn't work. Can anyone explain why? I thought C++ classes 
>>> automatically got copy assignment operators.
>>>
>>> And what's the right way to populate an MArgDatabase that already 
>>> exists? Or should I use a pointer (with the added complexity and memory 
>>> management that I'm also not used to).
>>>
>>> Thanks!
>>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/6aa917a3-89e7-4adc-aa4a-d8e62e8b0d0d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/6aa917a3-89e7-4adc-aa4a-d8e62e8b0d0d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4fa58fe1-8e1b-41d6-926b-ddfac27a9bfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to