Did you create a function like the GetPlugData function in the example? That
function allows you to trigger compute when you want because it actually
pulls data from a specific plug, and in so doing, forces a dependency.

On Tue, Feb 2, 2010 at 8:29 PM, Ling <[email protected]> wrote:

> Thanks a lot guys for the response.
>
> @ Ren Zhi:
>
> I tried these lines, put them into the draw() function, and it seems
> not working.
>
> @ Adan:
> below are the code for defining the attrs:
>
> // define the float attr:
>        aLingChange = numAttr.create( "lingChangeA", "lca",
> MFnNumericData::kFloat, 0.0, &stat );
>        CHECK_MSTATUS( numAttr.setStorable(false) );
>        CHECK_MSTATUS( numAttr.setKeyable(false) );
>        CHECK_MSTATUS( numAttr.setHidden(true) );
>        CHECK_MSTATUS( addAttribute( aLingChange ) );
>
> //define the mstring attr:
>        //custom attr aCropWith from Ling
>        aCropWith = strAttr.create( MString("cropWithSelection"), MString
> ("cws"), MFnData::kString, aCropWith, &stat );
>        CHECK_MSTATUS( strAttr.setStorable(true) );
>        CHECK_MSTATUS( strAttr.setKeyable(false) );
>        CHECK_MSTATUS( strAttr.setConnectable(true) );
>        CHECK_MSTATUS( addAttribute( aCropWith ) );
>
> // define the mmatrix attr
>        aBBoxMatrix = matrixAttr.create( "extractBoxMatrix", "ebm",
> MFnMatrixAttribute::kFloat, &stat );
>        CHECK_MSTATUS( numAttr.setStorable(true) );
>        CHECK_MSTATUS( numAttr.setKeyable(true) );
>        CHECK_MSTATUS( numAttr.setConnectable(true) );
>        CHECK_MSTATUS( numAttr.setHidden(true) );
>        CHECK_MSTATUS( addAttribute( aBBoxMatrix ) );
>
> and I set the affecting relations on the first post..
>
>
> @ Judah:
>
> Hi Judah: thanks a lot for your suggestions,
>
> In my compute() function, if I ask the node to do something simple,
>
> it's working fine, but if I change the code to  :
>
>
> if(plug == aLingChange):
> {
>  then do something
> }
> it won't work... the compute() function still runs, but just skip the
> codes inside the curly brackets,
>
> because the aLingChange is not been affected..
>
> weird
>
>
> @ Viktoras:
>
> Thanks for your suggestions, he docs is talking about dynamic
> attributes affecting dynamic/static attrs
>
> The concept of it seems gonna fix my problem, but I tried with this
> setDependentsDirty() function, and it doesn't work as well.
>
> My question is, after defining the function, should I use it
> somewhere, or it will run automatically?
>
>
>
>
>
>
> On Feb 2, 12:02 pm, viktoras <[email protected]> wrote:
> > what maya is saying you is that both attributeAffects associations
> > failed. while this compiled
> > fine, it's not behaving like code tells node to.
> > try setting dirty flag manually, see MPxNode:: setDependentsDirty
> > documentation for details.
> >
> > On 2010.02.02 17:35, Ling wrote:
> >
> >
> >
> > > Hi guys:
> >
> > >    sorry for post this again, but I desparately needing for help.
> >
> > > my problem is I created three attribute in my custom locator node,
> > > a MString attribute, a MMatrixAttribute,
> > > and they are affecting a float attribute.
> >
> > > basically like this:
> > > CHECK_MSTATUS( attributeAffects( MStringAttr,     floatAttr ) );
> > > CHECK_MSTATUS( attributeAffects( MMatrixAttr,     floatAttr ) );
> >
> > > the node compiles fine, but when changing the Matrix and String
> > > attribute,
> > > the float attribute doesnt response, which means the node won't
> > > re-"compute"..
> >
> > > also i got some error message like:
> > > attributeAffects( MString,     floatAttr )
> > > (kInvalidParameter): Object is incompatible with this method
> >
> > > attributeAffects( MMatrixAttr,     floatAttr )
> > > (kInvalidParameter): Object is incompatible with this method
> >
> > > and if I set only the MString attribute affecting the float attribute,
> > > the error becomes:
> > > attributeAffects( MString,     floatAttr )
> > > (kInvalidParameter): Object is incompatible with this method
> >
> > > Really appreciate your helps
> >
> > > -ling
> >
> > --
> > Viktorashttp://www.neglostyti.com
>
> --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to