<?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: How to Force relative path with python with setAttr in .filename ? in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458897#M1950</link>
    <description>&lt;P&gt;Ah ok. Afaik Renderman defines the relative project location as "&amp;lt;ws&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this command should do what you want:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmds.setAttr(diff + '.filename', '&amp;lt;ws&amp;gt;/sourceimages/image.png', type = 'string')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps!&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 17:42:31 GMT</pubDate>
    <dc:creator>Kahylan</dc:creator>
    <dc:date>2022-10-03T17:42:31Z</dc:date>
    <item>
      <title>How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11457291#M1947</link>
      <description>&lt;P&gt;Hi, I try to write relative path with&lt;EM&gt;&amp;nbsp;&lt;STRONG&gt;cmds.setAttr(diff + '.filename', './sourceimages/image.png', type = 'string')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But the string is always automatically replaced by the full path (E:// etc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea of whats wrong ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Oct 2022 22:09:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11457291#M1947</guid>
      <dc:creator>tomp.jar</dc:creator>
      <dc:date>2022-10-02T22:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458285#M1948</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What kind of node do you want to set this attr on?&lt;/P&gt;&lt;P&gt;It looks like you want to set a texture, but the nodes that use texture paths I know all use either ".imageTextureName" or ".imageName"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be helpful if I knew the exact node type you are talking about, so I can reproduce the issue.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 13:11:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458285#M1948</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-10-03T13:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458683#M1949</link>
      <description>&lt;P&gt;Hey thanks for the answer, the node is a PxrTexture; also I made an error in the command, it's&amp;nbsp;&lt;EM&gt;&amp;nbsp;&lt;STRONG&gt;cmds.setAttr(diff + '.filename', './sourceimages/'image.png', type = 'string')&amp;nbsp; were image.png is just a placeholder text for the real image name&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;I also tryed $PROJPATH/sourceimages ... but only the maya viewport understand this way of relative path but renderman give me the pink missing color error&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;thanks !&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 15:26:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458683#M1949</guid>
      <dc:creator>tomp.jar</dc:creator>
      <dc:date>2022-10-03T15:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458897#M1950</link>
      <description>&lt;P&gt;Ah ok. Afaik Renderman defines the relative project location as "&amp;lt;ws&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this command should do what you want:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cmds.setAttr(diff + '.filename', '&amp;lt;ws&amp;gt;/sourceimages/image.png', type = 'string')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 17:42:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458897#M1950</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-10-03T17:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458918#M1951</link>
      <description>&lt;P&gt;Thanks !&lt;/P&gt;&lt;P&gt;I tried but unfortunately, it auto replace also this with the full path as you can see &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tompjar_0-1664819738433.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1122933i43511846B31AE78A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tompjar_0-1664819738433.png" alt="tompjar_0-1664819738433.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 17:56:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458918#M1951</guid>
      <dc:creator>tomp.jar</dc:creator>
      <dc:date>2022-10-03T17:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458928#M1952</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tompjar_0-1664819944200.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1122934iDB05C14D6375FB23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tompjar_0-1664819944200.png" alt="tompjar_0-1664819944200.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the string that gets input in the filename&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 17:59:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11458928#M1952</guid>
      <dc:creator>tomp.jar</dc:creator>
      <dc:date>2022-10-03T17:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11459035#M1953</link>
      <description>&lt;P&gt;I see, sorry I wasn't at my workingmachine and couldn't try it out myself. Now I had the chance, but I didn't find a way to stop the PxrTexture from automatically changing the path from relative to absolute when setting the filepath, neither with python or by setting it by hand... However, I found a way to force renderman to keep the path relative.&lt;/P&gt;&lt;P&gt;I created a network node and added a string attribute to it, then I set the string to "&amp;lt;ws&amp;gt;/sourceimages/image.png" and connected it to the PxrTexture nodes filename attribute:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ntw = cmds.createNode("network")
cmds.addAttr(ntw, ln = "localString", dt = "string")
cmds.setAttr("{0}.localString".format(ntw), '&amp;lt;ws&amp;gt;/sourceimages/image.png', type = "string")


cmds.connectAttr("{0}.localString".format(ntw),'{0}.filename'.format(diff), f = True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not pretty, but it seems to work, since a normal string attribute doesn't know what a path is and has no ambitions to override any characters and the filename attribute gets automatically locked when there is a connection on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I also should mention, that I haven't used Renderman in quite some time and there probably is a better way of doing this that someone knows who uses it frequently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I hope it helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 18:58:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11459035#M1953</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-10-03T18:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Force relative path with python with setAttr in .filename ?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11459058#M1954</link>
      <description>Thanks you very much ! This will do the trick for sure ! If I somehow discover a way to force it directely in the pxrtexture I'll send an update here !&lt;BR /&gt;&lt;BR /&gt;Thanks you once again !</description>
      <pubDate>Mon, 03 Oct 2022 19:10:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/how-to-force-relative-path-with-python-with-setattr-in-filename/m-p/11459058#M1954</guid>
      <dc:creator>tomp.jar</dc:creator>
      <dc:date>2022-10-03T19:10:42Z</dc:date>
    </item>
  </channel>
</rss>

