<?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: Querying value from node's port with Python in Bifrost Forum</title>
    <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9641443#M6409</link>
    <description>&lt;P&gt;I tried a couple things myself and was unsuccessful so I asked a dev familiar with the commands and he informed me that we can currently only set and get values from input ports. So perhaps there is some room for improvement here. I will look at drawing up an improvement request to explore such future functionality. Dev said a future improvement could be possible to query the watchpoint value from mel/python.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently the only way to get the values is to use a Watchpoint inside the graph.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jul 2020 17:19:53 GMT</pubDate>
    <dc:creator>syracoj</dc:creator>
    <dc:date>2020-07-17T17:19:53Z</dc:date>
    <item>
      <title>Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9640343#M6408</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a new graph, dragged a poly sphere's shape, and connected it to a new build_array node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm struggling to figure out how I can query any kind of data from the build_array node using Python. To be specific, let's say I want to find out the length of the build_array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried out this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmds.vnnNode("bifrostGraph1", "/build_array", queryPortDefaultValues="array")
# Error: RuntimeError: file &amp;lt;string&amp;gt; line 2: A port named array was not found on build_array # &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which surprised me, because yes, array is a port and it looks like it's the right internal name.&lt;/P&gt;&lt;P&gt;I also tried this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmds.vnnNode("bifrostGraph1", "/build_array", queryPortMetaDataValue=("array", "size"))
# Result: u'' # &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which returns an empty string. I know `size` exists, because I can see it in a watchpoint.&lt;/P&gt;&lt;P&gt;So how in the world can I query this? Am I approaching it the wrong way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advanced!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 03:18:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9640343#M6408</guid>
      <dc:creator>labbejason</dc:creator>
      <dc:date>2020-07-17T03:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9641443#M6409</link>
      <description>&lt;P&gt;I tried a couple things myself and was unsuccessful so I asked a dev familiar with the commands and he informed me that we can currently only set and get values from input ports. So perhaps there is some room for improvement here. I will look at drawing up an improvement request to explore such future functionality. Dev said a future improvement could be possible to query the watchpoint value from mel/python.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently the only way to get the values is to use a Watchpoint inside the graph.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 17:19:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9641443#M6409</guid>
      <dc:creator>syracoj</dc:creator>
      <dc:date>2020-07-17T17:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9642202#M6410</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1540556"&gt;@syracoj&lt;/a&gt; thanks for the reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did manage to get the value using the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmds.vnnWatchPoint("bifrostGraph1", "/output", "array", queryRecordedValues="size")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though it's a bit counter intuitive to achieve this as the output needs to already be connected just to make a new watchpoint. And you need to query the value from the output node, not the build_array (feels kind of weird, rather query directly from the build_array). Now that the watchpoint is no longer needed I must remove it to clean up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's also a major issue, and that is it throws an error if you try to create a watchpoint &lt;EM&gt;then&lt;/EM&gt; read the value right after:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmds.vnnWatchPoint("bifrostGraph1", "/output", "array", create=True)
cmds.vnnWatchPoint("bifrostGraph1", "/output", "array", queryRecordedValues="size")  # Errors here if both commands are executed.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But running both commands separately works as expected. So right now it seems like it's impossible to do this purely through script.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 08:30:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9642202#M6410</guid>
      <dc:creator>labbejason</dc:creator>
      <dc:date>2020-07-18T08:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9648023#M6411</link>
      <description>&lt;P&gt;Hi Jason,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason this isn't easily possible is because the Bifrost graph is a compiled graph - the graph with the nodes you see is kind of like C++ source code, and the only way to get the result from a node is to compile the code and run it. Watchpoints are kind of passive observers of the data flowing by - so they store some information about it, including array size among other things. (And adding a watchpoint does trigger a recompile).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As such, my recommendation would be to use regular data flow to get the values. You can programatically add a "array_size" node inside the graph, expose the result to Maya, and then use Maya's getAttr command. This will cause the graph to compile and run.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 23:32:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9648023#M6411</guid>
      <dc:creator>jonah.friedman</dc:creator>
      <dc:date>2020-07-21T23:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9653088#M6412</link>
      <description>&lt;P&gt;Thanks so much for the explanation! Exposing the value to be grabbed from Maya's end sounds like it should work ok. A little more extra overhead to setup and clean up afterwards, but that should be fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 07:54:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/9653088#M6412</guid>
      <dc:creator>labbejason</dc:creator>
      <dc:date>2020-07-24T07:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/11424540#M6413</link>
      <description>&lt;P&gt;Hi Jonah!&lt;BR /&gt;&lt;BR /&gt;Have there been any implementations or ways to get this data over the last couple years?&lt;BR /&gt;We are currently needing to find any bifrost graphs that are outputing specific data and hide them, or else Arnold will give warnings.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;For example, if you have a&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;render_archive_instance&lt;/LI-CODE&gt;&lt;P&gt;node connected to the graph's output node, and then click on render, it will error with this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;initializing 9 nodes ...
[bifrost] /bifrostGraph1/bifrostGraphShape1: input0_0_0_graph_outputs_0 object type is unknown
creating root object list ...&lt;/LI-CODE&gt;&lt;P&gt;Which can cause Arnold to time out, effectively failing the render.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 20:02:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/11424540#M6413</guid>
      <dc:creator>smiles3design</dc:creator>
      <dc:date>2022-09-15T20:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/11426415#M6414</link>
      <description>&lt;P&gt;Hi Shane,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It definitely shouldn't fail the render. What versions of Arnold (MtoA), Maya and Bifrost are you using?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 15:16:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/11426415#M6414</guid>
      <dc:creator>jonah.friedman</dc:creator>
      <dc:date>2022-09-16T15:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Querying value from node's port with Python</title>
      <link>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/11431874#M6415</link>
      <description>&lt;P&gt;Maya: 2019.3.1&lt;BR /&gt;Bifrost: 2.3.0.1&lt;BR /&gt;Arnold Core: 6.1.0.1&lt;BR /&gt;&lt;BR /&gt;We have had some strange issues with errors and Arnold when it comes to instancing and certain parameters or things aren't done correctly. This may be a user error more than the warning being thrown.&lt;BR /&gt;&lt;BR /&gt;Either way, being able to check if an output port that is of type `bifData` even contains any data or not, would be very helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 21:15:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/bifrost-forum/querying-value-from-node-s-port-with-python/m-p/11431874#M6415</guid>
      <dc:creator>smiles3design</dc:creator>
      <dc:date>2022-09-19T21:15:40Z</dc:date>
    </item>
  </channel>
</rss>

