I gotchu fam , here in the documentation it says :

“
A networked plug cannot be explicitly created. They are created when a 
connection is established for some attribute of the node. Since the allocation 
of networked plugs is managed exclusively by Maya, a plugin should never 
reference a networked plug after changes are made to the DG. Instead, use a 
non-networked version of the plug, or get a new reference to the networked plug.
“

BUT , here’s the catch :
“
MPlug & operator= 
(
const MPlug & 
other
)

Assignment operator. 
Copies one plug to another.
Networked plugs are not allowed to be duplicated so if the RHS is a networked 
plug then a non-networked version is returned. 
“
And turns out that the plug of MPxNode::setDependentsDirty(const MPlug&, ...) 
is networked.
Therefor when I use operator= I get a non-networked plug , so there’s no risks 
😊 
So I’m tempted to conclude that most people use Boolean flags instead of using 
the plug ,
because “ it has always been done that way”

Sent from Mail for Windows 10

From: Marcus Ottosson
Sent: Saturday, March 17, 2018 5:14 PM
To: [email protected]
Subject: Re: [Maya-Python] Why most people use boolean flags 
insteadofcatchingthe MPlug ?

I would’ve though that maybe there was a dark profound issue with doing it
In order of profoundness, from my limited understanding of MPlug (which may be 
wrong!) you should prefer boolean values over instances of objects due to:
1. Memory access violation
2. Performance
3. Communication
I only found one reference to why holding onto MObject is not ok, which may or 
may not apply to MPlug.
• 
https://forum.highend3d.com/t/using-mobjects-as-pointers-to-other-objects/39887/3
If I was you, I would just give it a go (and report back here with how it went) 
:)
​
-- 
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/CAFRtmOD9PAvxVdiq%3Dz2tDgTf90mxaRfT7MbpEqewFF_ockJe_g%40mail.gmail.com.
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/5aad563e.516b1c0a.506cc.7ece%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to