redpawfx
I've created  a c++ api  emitter node   inheriting from   the  mpxEmitterNode.

It does not have need for all the bells and whistles  in the  channel box that a normal  emitter comes with,
so I am attempting to hide them  in the api  during the post constructor  like so..

MFnDependencyNode  ssource(thisMObject);
MPlug srcPlug = ssource.findPlug("emitterType");
MFnAttribute emTyp = srcPlug.attribute();
emTyp.setKeyable(false);

etc, etc....

it works, but the problem is that as soon as I register this plugin  it  affects  EVERY emitter type in maya.
So from that point forward  all the attributes are hidden even if I make a default particle emitter or  a  fluid emitter, etc..  

This doesen't  make a whole lot of sense to me..  anybody got any ideas?

have I found  another weird  bug here? or am I just doing something the wrong way?

thanks in advance.

-johnc
Reply 0 0
pshipkov
This rings a bell.
Somebody posted here an issue with one of the SOuP nodes that was doing exactly the same - basically influencing all other nodes derived from the same class. I just cannot find the topic right now.
Can you paste your ::initialize() method ?
Reply 0 0
redpawfx
It doesent seem to be anything in the initalize, as I just  commented the whole contents of it  out except for the return MS::kSuccess  at the end and it still does it ..

post constructor wise, I'm doing this..
MObject tmo = thisMObject();
setSourceDefaultAttributes(tmo);
and that function is
setSourceDefaultAttributes(MObject tmo)
{
MFnDependencyNode ssource(tmo);
MPlug srcPlug = ssource.findPlug("emitterType");
MFnAttribute emTyp =srcPlug.attribute();
emTyp.setKeyable(false);
}

and even with just one of these in there  not  the 20+ that I want to do,
it still cuts out that attribute for all the emitter nodes in maya.


Reply 0 0
redpawfx
just found the  thread you were referring to I think... 
http://soup-dev.websitetoolbox.com/post?id=5142942

all it says is you fixed the bug..  not quite the same thing tho, but sounds  vaguely like it might be the same type of thing going on .. can you recall what you did to fix that one on your end?


Reply 0 0
pshipkov
Crap, i should be more descriptive. I think this is the same bug.
Let me check the code, let's see if i left a trace there that will be helpful to you.
Reply 0 0
redpawfx
thanks so much peter :-)
-johnc

Reply 0 0
pshipkov
I am looking at the code and cannot remember what the problem was. Will need to check previous versions of the code to tell what it was.
Btw, i am looking at your code and i wouldn't do it that way. I mean the the proxy wrapper for dynamic fields provide you an object to the fieldType attribute, so you can just operate on it without the need to obtain it through MFnDependencyNode.
Reply 0 0
redpawfx
I think you meant  emitterType not field type? :-)

I actually had  been using all the m* attributes  that I could,  at one point, but there were a few that I couldn't  control that way so I  switched them all over to this MFnDependency style so that  the code was all the same.  maybe I should  try that first.. I don't remember off the top of my head which attributes  were left behind.  I'll give that a go and see if it still affects the other  emitter nodes or not. 

Let me know what else you find out  when you have time.
I appreciate it :-)

thanks

-johnc


Reply 0 0
redpawfx
hmmm,  I don't think i can use the "m" variables in a  separate function in another file like I'm trying to do.  I've actually got 3 separate emitter nodes that I want to do the same thing to, and instead of putting the  whole giant list of things I want to delete into each one,  I'd like to manage them in one place / function outside of the  node  file.

hmmmm...

maybe I'm not accessing them correctly?  I am getting the compiling error, can't find 
mEmitterType  etc.. 

I tried

MFnAttribute ownerPos = MPlug(tmo, mOwnerPosData).attribute();
ownerPos.setKeyable(false);

which previously worked when it was in the  actual  emitter  file post constructor

any luck on your end figuring out what fixed your version of this problem? 


cheers!
-johnc



Reply 0 0
ntashev
..this ones is obsolete...


<< aut inveniam viam aut faciam >>
Reply 0 0
ntashev
I'm not sure if this can help, but may ring some bell. I had the same situation altough in python nodes - if you define your attribute MObjects in the class itself and not in the __init__() function they seem to somehow get 'shared' by all instances of the node:
# This one goes 'shared'
class Some_Node(om.MPxNode):
aAttr1 = om.MPointArray()
aAttr2 = om.MPointArray()
def __init__(self):
om.MPxNode.__init__(self)
# This one is fine
class Some_Node(om.MPxNode):
def __init__(self):
om.MPxNode.__init__(self)
self.aAttr1 = om.MPointArray()
self.aAttr2 = om.MPointArray()


EDIT: Actually it wasn't the MObjects, but some other variables used to store some data. the sample code above has been edited....

<< aut inveniam viam aut faciam >>
Reply 0 0
Reply