It would only be computed outputMatrix is pulled, so a first step is
testing that.

cmds.setAttr(yourNode + ".PoseFile", "changed.txt", type="string")#
Compute not called yet..
cmds.getAttr(yourNode + ".outputMatrix")# Compute called

If that doesn’t happen, it’s possible strings aren’t part of normal
evaluation. Try making the attribute a setInternalValue instead. It’ll
notify you whenever the value changes, which is probably what you want
anyway, since it can only ever be updated manually by the user or Python
(rather than a connection). If that doesn’t work, then another option is to
implement MNodeMessage::addNodeDirtyPlugCallback to check for it yourself.

On Sun, 23 May 2021 at 01:04, Todd Widup <todd.wi...@gmail.com> wrote:

> hey  quick follow up on this...finally got a bit of time to start on this
> more...but getting an odd issue...or it could be a normal thing.
>
> code for adding :
>
> poseFilePath = tAttr.create("PoseFile", "psf", MFnData::kString);
> tAttr.setUsedAsFilename(true);
> tAttr.setStorable(true);
> tAttr.setKeyable(false);
> addAttribute(poseFilePath);
> attributeAffects(poseFilePath, outputMatrix);
>
>
> in my compute :
>
> if (plug != outputMatrix)
> {
> if (plug == poseFilePath)
> {
> fileUpdate = false;
> MStreamUtils::stdOutStream() << "update " << std::endl;
> }
> return MS::kUnknownParameter;
> }
>
>
>
> if (fileUpdate == false)
> {
> MPlug filePath(myNode, poseFilePath);
> char file = filePath.asChar();
> MStreamUtils::stdOutStream() << "bob " << std::endl;
> MStreamUtils::stdOutStream() << file << std::endl;
>
> fileUpdate = true;
> }
>
>
> So the issue :  when I set the file, it doesnt run the compute at all.  it
> will only run compute when one of the other attrs is changed.  What
> should I do to get it to run when the file is updated or set?
>
> On Tue, May 18, 2021 at 12:29 PM Justin Israel <justinisr...@gmail.com>
> wrote:
>
>>
>>
>> On Wed, May 19, 2021 at 7:21 AM Marcus Ottosson <konstrukt...@gmail.com>
>> wrote:
>>
>>> pybind11 is great, but it is increeeedibly slow to compile. Like 20
>>> seconds for a handful of bound methods. It’s insane.
>>>
>>> That aside, I’ve got a recent project that might make a good example of
>>> what it is and how it can be used to re-create the Maya Python API.
>>>
>>>    - https://github.com/mottosso/cmdc
>>>
>>>
>> Nice one! Well, slow compile time is probably better than carrying around
>> a boost dependency and dealing with symbol conflicts :-)
>>
>>
>>>
>>>
>>>
>>> On Tue, 18 May 2021 at 19:53, Alok Gandhi <alok.gandhi2...@gmail.com>
>>> wrote:
>>>
>>>> Thanks Justin! pybind definitely seems interesting.
>>>>
>>>> And yes, Cython is definitely great. I have used it in production
>>>> previously for some generic algorithms implementations where performance
>>>> was needed in python centric api interface. And it is super easy to write
>>>> too.
>>>>
>>>> On Tue, May 18, 2021, 23:58 Justin Israel <justinisr...@gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Wed, May 19, 2021 at 6:10 AM Alok Gandhi <alok.gandhi2...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> As a side note, for generic use (outside of maya) you can use boost
>>>>>> python to call python from C++ and vice versa:
>>>>>>
>>>>>> https://www.boost.org/doc/libs/1_63_0/libs/python/doc/html/tutorial/index.html
>>>>>>
>>>>>
>>>>> Boost is a super heavy dependency. These days pybind11 might be a
>>>>> better choice if your project is C++ centric:
>>>>> https://github.com/pybind/pybind11
>>>>>
>>>>> It's header-only so you don't have to worry about boost version
>>>>> conflicts.
>>>>>
>>>>> And if you have a python-centric project, cython is pretty good for
>>>>> being able to call into C++. It also produces a library that has no 
>>>>> runtime
>>>>> link dependency to anything since it transpiles to C and only links 
>>>>> against
>>>>> Python.
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, May 18, 2021, 23:30 Todd Widup <todd.wi...@gmail.com> wrote:
>>>>>>
>>>>>>> Thanks Marcus,
>>>>>>> the txt file will be just a bunch of values and matrices ... it
>>>>>>> might be binary it might be ascii..not 100% yet, depends how big the 
>>>>>>> files
>>>>>>> get..... was leaning towards JSon for easy of use/setup
>>>>>>> the python Q was purely curiosity
>>>>>>>
>>>>>>> On Tue, May 18, 2021 at 9:50 AM Marcus Ottosson <
>>>>>>> konstrukt...@gmail.com> wrote:
>>>>>>>
>>>>>>>> what would I use to allow the plugin to read an external user
>>>>>>>> specified file, either a txt or json?
>>>>>>>>
>>>>>>>> You could make a string attribute on the node, and set 
>>>>>>>> MFnAttribute::isUsedAsFilename
>>>>>>>> = true
>>>>>>>> <https://help.autodesk.com/view/MAYAUL/2020/ENU/?guid=__cpp_ref_class_m_fn_attribute_html#a47fb4f02f1619e47363c39c9794d8191>,
>>>>>>>> which will let users browse for a file.
>>>>>>>>
>>>>>>>> Once you’ve got access to a path from C++, have a look at RapidJSON
>>>>>>>> <https://rapidjson.org/> or nlohmann/json
>>>>>>>> <https://github.com/nlohmann/json> for a fast or convenient
>>>>>>>> option, in that order. They’re both header-only and work just fine with
>>>>>>>> something like Maya. You’ll likely get more options from others, 
>>>>>>>> because
>>>>>>>> there are just so many options here. If you drill down into more 
>>>>>>>> specifics
>>>>>>>> about your requirements, e.g. should it be human-readable? Does it 
>>>>>>>> need to
>>>>>>>> be JSON? Does it need to be small? Network friendly? Is the data large,
>>>>>>>> like a pointcache or small like a set of attributes? Will you be
>>>>>>>> serialising data? Would you need something that can be deserialised 
>>>>>>>> into
>>>>>>>> the same data structure? Etc.
>>>>>>>>
>>>>>>>> is there a way to have a C++ plugin run python at all?
>>>>>>>>
>>>>>>>> Yes, you can either call on Maya’s Python from C++ via 
>>>>>>>> MGlobal::executePythonCommand("print('hello
>>>>>>>> world!')");
>>>>>>>> <https://help.autodesk.com/view/MAYAUL/2020/ENU/?guid=__cpp_ref_class_m_global_html#af47e37db0e53940620c6cd1f1111e41d>
>>>>>>>> or you can embed another Python yourself and call that. The latter 
>>>>>>>> would
>>>>>>>> have the benefit of not polluting the global Python namespace and 
>>>>>>>> memory,
>>>>>>>> and is something you could use to spin up multiple Python interpreters 
>>>>>>>> in
>>>>>>>> parallel if your code is performance sensitive (though I’d question why
>>>>>>>> you’d turn to Python in that case).
>>>>>>>>
>>>>>>>> On Tue, 18 May 2021 at 16:34, Todd Widup <todd.wi...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> me writing maya plugins has been limited to mostly utility nodes
>>>>>>>>> and an occasionally deformer.  I am working on something a bit bigger 
>>>>>>>>> and
>>>>>>>>> what would I use to allow the plugin to read an external user 
>>>>>>>>> specified
>>>>>>>>> file, either a txt or json?  also, been wondering, is there a way to 
>>>>>>>>> have a
>>>>>>>>> C++ plugin run python at all?
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Todd Widup
>>>>>>>>> Creature TD / Technical Artist
>>>>>>>>> todd.wi...@gmail.com
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> 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/CABBPk35P29DnsEqw3Chjv%2Biy0GuHkRFDOaf-jJx_o5moTA1e%2Bg%40mail.gmail.com
>>>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CABBPk35P29DnsEqw3Chjv%2Biy0GuHkRFDOaf-jJx_o5moTA1e%2Bg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>>>> .
>>>>>>>>>
>>>>>>>> --
>>>>>>>> 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/CAFRtmOC8cVw97ZeVtLanizhcdCzSwjbr5OY_%2BCDd0UJ-5iipdQ%40mail.gmail.com
>>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC8cVw97ZeVtLanizhcdCzSwjbr5OY_%2BCDd0UJ-5iipdQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Todd Widup
>>>>>>> Creature TD / Technical Artist
>>>>>>> todd.wi...@gmail.com
>>>>>>>
>>>>>>> --
>>>>>>> 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/CABBPk34qLGDCYOqxnck7y-o1LYaZRaSa%3D1OB4CdE%2BZXuqE3aRg%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CABBPk34qLGDCYOqxnck7y-o1LYaZRaSa%3D1OB4CdE%2BZXuqE3aRg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> 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/CAPaTLMQ7LY0OBFdE8t%2BJAs4z5VizR-X-ZHMCY5HgDaS0%3DDCjkg%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMQ7LY0OBFdE8t%2BJAs4z5VizR-X-ZHMCY5HgDaS0%3DDCjkg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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/CAPGFgA1sZj%2BYZ9VxCo66u5sUOrndB4BQSKh-h-YEOWLTWLd%3DuA%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1sZj%2BYZ9VxCo66u5sUOrndB4BQSKh-h-YEOWLTWLd%3DuA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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/CAPaTLMQfvbc0AG%3D6hCLAU%3DyhTsOm2mQuC7vufgif9NFWzfa-uQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMQfvbc0AG%3D6hCLAU%3DyhTsOm2mQuC7vufgif9NFWzfa-uQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAFRtmOBs2U%3D_dEcPa%2BgxdV_gYLr6wL%3Dgs3kfXm1xpY%3DGNFYVgQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBs2U%3D_dEcPa%2BgxdV_gYLr6wL%3Dgs3kfXm1xpY%3DGNFYVgQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAPGFgA1S1XFqRin%3D-zzgtZ6dMvcQcaU1WrF-8EVvb8kGDEqedQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1S1XFqRin%3D-zzgtZ6dMvcQcaU1WrF-8EVvb8kGDEqedQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Todd Widup
> Creature TD / Technical Artist
> todd.wi...@gmail.com
>
> --
> 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/CABBPk363E1xp0vcgBwMJ5x%2Bgd5YpGhTj_z2MDyPQE0XF35yDdw%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CABBPk363E1xp0vcgBwMJ5x%2Bgd5YpGhTj_z2MDyPQE0XF35yDdw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFRtmOAB7eYGyr67ymJNAUiFxKNBWJ7cf0kY8nXTUgdsJimUSQ%40mail.gmail.com.

Reply via email to