<?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: set attribute value in matrix type in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379994#M677</link>
    <description>&lt;P&gt;It should work the same way. I would recommend clicking on the link and reading about the compute function. Your question is really general, and you'll make more progress referring to the documentation and making an attempt on your own, and posting to the forum if that doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, small tip if you use the "&amp;lt;/&amp;gt;" when making a post that contains code it makes it more readable. Best of luck&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2023 21:20:49 GMT</pubDate>
    <dc:creator>jmreinhart</dc:creator>
    <dc:date>2023-11-15T21:20:49Z</dc:date>
    <item>
      <title>set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12374593#M669</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;Hello, How I can create a matrix for control position of an object and save it in&amp;nbsp; attributes?&lt;/DIV&gt;&lt;DIV&gt;I write this codes but it crashed. i have rotate and translate:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MPlug outMatrixAttrPlug(oThis, outMatrixAttr);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MDataHandle outMatrixHandle = outMatrixAttrPlug.asMDataHandle();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MTransformationMatrix m;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;double scale[3] = { 1,1,1 };&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;m.setScale(scale, MSpace::kTransform);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MEulerRotation rr(MVector(0,45,0), MEulerRotation::RotationOrder::kXYZ);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;m.rotateTo(rr);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MVector translate(0, 11, 0);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;m.setTranslation(translate, MSpace::kTransform);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;outMatrixHandle.setMMatrix(m.asMatrix());&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Nov 2023 18:48:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12374593#M669</guid>
      <dc:creator>egoldid1</dc:creator>
      <dc:date>2023-11-13T18:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12377025#M670</link>
      <description>&lt;P&gt;What's the context for this code? Is this code from the ::compute method of a custom node or something like that? If so you should be using the MDataBlock class to get your dataHandles.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 18:05:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12377025#M670</guid>
      <dc:creator>jmreinhart</dc:creator>
      <dc:date>2023-11-14T18:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12377550#M671</link>
      <description>&lt;P&gt;hi, yes I wrote it in&amp;nbsp;&lt;SPAN&gt;::compute method of a custom&amp;nbsp;node. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;at first I wrote below code:&lt;BR /&gt;outMatrixAttr= matAttr.create("outCCMatrix", "outCCMatrix", MFnMatrixAttribute::kFloat);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when I change&amp;nbsp;MFnMatrixAttribute::kFloat in to MFnMatrixAttribute::kDouble, it now does not crash.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;outMatrixAttr = matAttr.create("outCCMatrix", "outCCMatrix", MFnMatrixAttribute::kDouble);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but now in the outMatrixAttr attribute only saving zero values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 22:19:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12377550#M671</guid>
      <dc:creator>egoldid1</dc:creator>
      <dc:date>2023-11-14T22:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12377973#M672</link>
      <description>&lt;P&gt;Could you please share the full code?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 03:12:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12377973#M672</guid>
      <dc:creator>jmreinhart</dc:creator>
      <dc:date>2023-11-15T03:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12378926#M673</link>
      <description>&lt;P&gt;the full code is so long.&lt;/P&gt;&lt;P&gt;-------------&lt;/P&gt;&lt;P&gt;I wrote below code for create attribute:&lt;/P&gt;&lt;P&gt;#...&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;MFnMatrixAttribute matAttr;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;outMatrixAttr = matAttr.create("outCCMatrix", "outCCMatrix", MFnMatrixAttribute::kDouble);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;matAttr.setStorable(true);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;matAttr.setReadable(true);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;matAttr.setKeyable(true);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;matAttr.setWritable(false);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;matAttr.setHidden(false);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;stat = addAttribute(outMatrixAttr );&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if (!stat) { stat.perror("addAttribute"); return stat; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;-----------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and in the compute part I wrote below code:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;MPlug &lt;SPAN&gt;outMatrixAttr&lt;/SPAN&gt;Plug(oThis, &lt;SPAN&gt;outMatrixAttr&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MDataHandle outMatrixHandle = outMatrixAttrPlug.asMDataHandle();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MTransformationMatrix m;&lt;BR /&gt;double scale[3] = { 1.0,21.0,1.0 };&lt;BR /&gt;m.setScale(scale, MSpace::kTransform);&lt;BR /&gt;MEulerRotation rr(MVector(0.0, 20.0, 0.0), MEulerRotation::RotationOrder::kXYZ);&lt;BR /&gt;m.rotateTo(rr);&lt;BR /&gt;MVector translate(110.0, 11.0, 22.0);&lt;BR /&gt;m.setTranslation(translate, MSpace::kTransform);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;outMatrixHandle .setMMatrix(m.asMatrix());&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and result is zero value:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-11-15 171946.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1293236i68CF2EBF9A849AC3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-11-15 171946.png" alt="Screenshot 2023-11-15 171946.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not sure that I can &lt;SPAN&gt;share&lt;/SPAN&gt; full code. so much thanks.&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Nov 2023 13:54:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12378926#M673</guid>
      <dc:creator>egoldid1</dc:creator>
      <dc:date>2023-11-15T13:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379111#M674</link>
      <description>&lt;P&gt;I think that you might be misunderstanding how the compute function works. This is a good example to look at&amp;nbsp;&lt;A href="https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=Maya_SDK_Dependency_graph_plug_ins_Implementing_the_compute_method_html" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=Maya_SDK_Dependency_graph_plug_ins_Implementing_the_compute_method_html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The important bit is this. This is the usual way of getting the dataHandle for a plug during the compute method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;MDataHandle stateData = data.outputValue( state, &amp;amp;status );&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've never used&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="general"&gt;MPlug().asMDataHandle();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the documentation says:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Value of plug as an&amp;nbsp;&lt;/SPAN&gt;&lt;A title="Data handle for information contained in a data block. " href="https://help.autodesk.com/cloudhelp/2022/ENU/Maya-SDK/cpp_ref/class_m_data_handle.html" target="_blank" rel="noopener"&gt;MDataHandle&lt;/A&gt;&lt;SPAN&gt;. When done using the returned handle, the caller must destroy it using&amp;nbsp;&lt;/SPAN&gt;&lt;A title="This method destructs the data handle for this plug. " href="https://help.autodesk.com/cloudhelp/2022/ENU/Maya-SDK/cpp_ref/class_m_plug.html#a6aa7f128d0023ffd24e071b257bd0b7a" target="_blank" rel="noopener"&gt;MPlug::destructHandle()&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hopefully one of those two things will resolve your problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 14:52:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379111#M674</guid>
      <dc:creator>jmreinhart</dc:creator>
      <dc:date>2023-11-15T14:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379699#M675</link>
      <description>&lt;P&gt;thank you. I sued this code and it worked.&lt;/P&gt;&lt;P&gt;MDataHandle outMatrixHandle = data.outputValue(outMatrixAttr);&lt;BR /&gt;outMatrixHandle.setMMatrix(m.asMatrix());&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 19:03:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379699#M675</guid>
      <dc:creator>egoldid1</dc:creator>
      <dc:date>2023-11-15T19:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379964#M676</link>
      <description>&lt;P&gt;now if the outMatrixAttr be child of the outMatrixGRPAttr , how I can write values or how I can use data.outputValue()?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;outMatrixGRPAttr = compoundAttr.create("outMatrixGRP", "outMatrixGRP");&lt;BR /&gt;compoundAttr.setArray(true);&lt;BR /&gt;compoundAttr.setReadable(true);&lt;BR /&gt;compoundAttr.setWritable(false);&lt;BR /&gt;compoundAttr.setKeyable(true);&lt;BR /&gt;compoundAttr.setStorable(true);&lt;BR /&gt;compoundAttr.setHidden(false);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;outMatrixAttr= matAttr.create("outCCMatrix", "outCCMatrix", MFnMatrixAttribute::kDouble);&lt;BR /&gt;matAttr.setStorable(true);&lt;BR /&gt;matAttr.setReadable(true);&lt;BR /&gt;matAttr.setKeyable(true);&lt;BR /&gt;matAttr.setWritable(false);&lt;BR /&gt;matAttr.setHidden(false);&lt;BR /&gt;compoundAttr.addChild(outMatrixAttr);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;stat = addAttribute(outMatrixGRPAttr);&lt;BR /&gt;if (!stat) { stat.perror("addAttribute"); return stat; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 21:07:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379964#M676</guid>
      <dc:creator>egoldid1</dc:creator>
      <dc:date>2023-11-15T21:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: set attribute value in matrix type</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379994#M677</link>
      <description>&lt;P&gt;It should work the same way. I would recommend clicking on the link and reading about the compute function. Your question is really general, and you'll make more progress referring to the documentation and making an attempt on your own, and posting to the forum if that doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, small tip if you use the "&amp;lt;/&amp;gt;" when making a post that contains code it makes it more readable. Best of luck&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 21:20:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/set-attribute-value-in-matrix-type/m-p/12379994#M677</guid>
      <dc:creator>jmreinhart</dc:creator>
      <dc:date>2023-11-15T21:20:49Z</dc:date>
    </item>
  </channel>
</rss>

