<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: run a function ignored by Undo Queue in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10025322#M4825</link>
    <description>&lt;P&gt;Thanks for your input.&amp;nbsp; I'm still trying to find a solution, but the problem might not be what I think it is.&amp;nbsp; Sill investigating...&lt;/P&gt;</description>
    <pubDate>Sat, 23 Jan 2021 19:55:37 GMT</pubDate>
    <dc:creator>bmagner888</dc:creator>
    <dc:date>2021-01-23T19:55:37Z</dc:date>
    <item>
      <title>run a function ignored by Undo Queue</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10008234#M4822</link>
      <description>&lt;P&gt;So i'm building a custom HUD and querying all sorts of camera data that gets updated every frame.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Each hud element has it's own hud command, such as getTilt() which queries the active camera's rotateX value.&lt;BR /&gt;Obviously this needs to execute at every frame.&amp;nbsp; When you change frames it enters all of the hud commands into the undo&amp;nbsp; queue, so the user has to undo twenty times just to undo an actual user action, or even just go back to the previous frame.&lt;BR /&gt;&lt;BR /&gt;If I could, I would combine all the hud element commands into one single function&lt;BR /&gt;stateWithoutFlush=False&lt;BR /&gt;run all hud element commands&lt;BR /&gt;stateWithoutFlush=True&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But the headsUpDisplay() command seems to be designed such that each element has its own command, and will auto run at every time change.&lt;BR /&gt;&lt;BR /&gt;I've tried nesting the stateWithoutFlush commands inside the hud element commands, but the queue doesn't turn back on, and because it's nested, the encapsulating function still enters the queue.&lt;BR /&gt;&lt;BR /&gt;So how do i execute a function that the undo queue will ignore?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any assistance.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2021 20:11:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10008234#M4822</guid>
      <dc:creator>bmagner888</dc:creator>
      <dc:date>2021-01-17T20:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: run a function ignored by Undo Queue</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10008788#M4823</link>
      <description>&lt;P&gt;Based on my very limited knowledge, if you want to achieve your goal, you need to write a new plugin using API.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 03:07:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10008788#M4823</guid>
      <dc:creator>g2m.agent</dc:creator>
      <dc:date>2021-01-18T03:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: run a function ignored by Undo Queue</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10015234#M4824</link>
      <description>&lt;P&gt;I tried reregistering a HUD in a timeChanged event callback, but it didn't add anything to the undo queue.&amp;nbsp; Can you show your code?&amp;nbsp; This is what I tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gist.github.com/zewt/575bf7f013a75ffa90fcae1a74e777ae" target="_blank"&gt;https://gist.github.com/zewt/575bf7f013a75ffa90fcae1a74e777ae&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure you're not changing the selection, since that does create an undo entry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;stateWithoutFlush should work, but it's usually only used when actually making changes to the scene that shouldn't be undoable.&amp;nbsp; If you do use stateWithoutFlush, make sure it always restores correctly even on error, or else it'll end up turning off the user's undo completely, which is a really common problem with undo.&amp;nbsp; I use this helper to be sure:&amp;nbsp;&lt;A href="https://github.com/zewt/zMayaTools/blob/master/scripts/zMayaTools/maya_helpers.py#L566" target="_blank"&gt;https://github.com/zewt/zMayaTools/blob/master/scripts/zMayaTools/maya_helpers.py#L566&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 08:10:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10015234#M4824</guid>
      <dc:creator>zewt</dc:creator>
      <dc:date>2021-01-20T08:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: run a function ignored by Undo Queue</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10025322#M4825</link>
      <description>&lt;P&gt;Thanks for your input.&amp;nbsp; I'm still trying to find a solution, but the problem might not be what I think it is.&amp;nbsp; Sill investigating...&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 19:55:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10025322#M4825</guid>
      <dc:creator>bmagner888</dc:creator>
      <dc:date>2021-01-23T19:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: run a function ignored by Undo Queue</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10027533#M4826</link>
      <description>&lt;P&gt;There is one such command that will probably do what you wanted&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/CommandsPython/undoInfo.html" target="_blank"&gt;https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/CommandsPython/undoInfo.html&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;cmds.undoInfo( openChunk=True )&lt;BR /&gt;# ...&lt;BR /&gt;cmds.undoInfo( closeChunk=True )&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jan 2021 03:11:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10027533#M4826</guid>
      <dc:creator>olarn</dc:creator>
      <dc:date>2021-01-25T03:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: run a function ignored by Undo Queue</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10027635#M4827</link>
      <description>&lt;P&gt;That groups commands into a single undo action.&amp;nbsp; The stateWithoutFlush he's using is used to run commands outside of the undo queue, which should work for what he's doing (not sure why it isn't).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 04:56:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/run-a-function-ignored-by-undo-queue/m-p/10027635#M4827</guid>
      <dc:creator>zewt</dc:creator>
      <dc:date>2021-01-25T04:56:10Z</dc:date>
    </item>
  </channel>
</rss>

