<?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 get some attributes in the fbx file through python in FBX Forum</title>
    <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11816104#M176</link>
    <description>&lt;P&gt;My python is rusty but I'll take a shot at it. I have not tested this, its meant to get you started.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;import fbx&lt;/P&gt;&lt;P&gt;# Create an FBX manager and scene&lt;BR /&gt;manager = fbx.FbxManager.Create()&lt;BR /&gt;scene = fbx.FbxScene.Create(manager, "")&lt;/P&gt;&lt;P&gt;# Import the FBX file&lt;BR /&gt;importer = fbx.FbxImporter.Create(manager, "")&lt;BR /&gt;importer.Initialize("your_fbx_file_path")&lt;BR /&gt;importer.Import(scene)&lt;/P&gt;&lt;P&gt;# Get the file name&lt;BR /&gt;file_name = importer.GetFileName()&lt;/P&gt;&lt;P&gt;# Get the time length of the animation&lt;BR /&gt;animation_length = scene.GetSrcObjectCount(fbx.FbxCriteria.ObjectType(fbx.FbxAnimStack.ClassId))&lt;BR /&gt;if animation_length &amp;gt; 0:&lt;BR /&gt;animation_length = scene.GetSrcObject(fbx.FbxCriteria.ObjectType(fbx.FbxAnimStack.ClassId), 0).LocalTimeSpan.GetDuration().Get()&lt;/P&gt;&lt;P&gt;# Get the number of bones named "Hips"&lt;BR /&gt;bone_count = 0&lt;BR /&gt;root_node = scene.GetRootNode()&lt;BR /&gt;if root_node:&lt;BR /&gt;for i in range(root_node.GetChildCount()):&lt;BR /&gt;child_node = root_node.GetChild(i)&lt;BR /&gt;if child_node.GetNodeAttribute() and child_node.GetNodeAttribute().GetAttributeType() == fbx.FbxNodeAttribute.eSkeleton:&lt;BR /&gt;if child_node.GetName() == "Hips":&lt;BR /&gt;bone_count += 1&lt;/P&gt;&lt;P&gt;# Clean up&lt;BR /&gt;importer.Destroy()&lt;BR /&gt;scene.Destroy()&lt;BR /&gt;manager.Destroy()&lt;/P&gt;&lt;P&gt;# Print the results&lt;BR /&gt;print("File name:", file_name)&lt;BR /&gt;print("Animation length:", animation_length)&lt;BR /&gt;print("Number of bones named 'Hips':", bone_count)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I imagine you'd need to replace "your_fbx_file_path" with the file path of your FBX file. &lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Mar 2023 16:58:33 GMT</pubDate>
    <dc:creator>RyanCameron</dc:creator>
    <dc:date>2023-03-12T16:58:33Z</dc:date>
    <item>
      <title>How to get some attributes in the fbx file through python</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11812712#M175</link>
      <description>&lt;P&gt;How to get some attributes in the fbx file through python&lt;BR /&gt;Hi, I want to get some attributes of my fbx file through python&lt;BR /&gt;1. Get the file name of the fbx file&lt;BR /&gt;2. Time length of obtaining animation data in fbx&lt;BR /&gt;3. Get the number of bones named "Hips" in fbx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 13:56:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11812712#M175</guid>
      <dc:creator>410299258</dc:creator>
      <dc:date>2023-03-10T13:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get some attributes in the fbx file through python</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11816104#M176</link>
      <description>&lt;P&gt;My python is rusty but I'll take a shot at it. I have not tested this, its meant to get you started.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;import fbx&lt;/P&gt;&lt;P&gt;# Create an FBX manager and scene&lt;BR /&gt;manager = fbx.FbxManager.Create()&lt;BR /&gt;scene = fbx.FbxScene.Create(manager, "")&lt;/P&gt;&lt;P&gt;# Import the FBX file&lt;BR /&gt;importer = fbx.FbxImporter.Create(manager, "")&lt;BR /&gt;importer.Initialize("your_fbx_file_path")&lt;BR /&gt;importer.Import(scene)&lt;/P&gt;&lt;P&gt;# Get the file name&lt;BR /&gt;file_name = importer.GetFileName()&lt;/P&gt;&lt;P&gt;# Get the time length of the animation&lt;BR /&gt;animation_length = scene.GetSrcObjectCount(fbx.FbxCriteria.ObjectType(fbx.FbxAnimStack.ClassId))&lt;BR /&gt;if animation_length &amp;gt; 0:&lt;BR /&gt;animation_length = scene.GetSrcObject(fbx.FbxCriteria.ObjectType(fbx.FbxAnimStack.ClassId), 0).LocalTimeSpan.GetDuration().Get()&lt;/P&gt;&lt;P&gt;# Get the number of bones named "Hips"&lt;BR /&gt;bone_count = 0&lt;BR /&gt;root_node = scene.GetRootNode()&lt;BR /&gt;if root_node:&lt;BR /&gt;for i in range(root_node.GetChildCount()):&lt;BR /&gt;child_node = root_node.GetChild(i)&lt;BR /&gt;if child_node.GetNodeAttribute() and child_node.GetNodeAttribute().GetAttributeType() == fbx.FbxNodeAttribute.eSkeleton:&lt;BR /&gt;if child_node.GetName() == "Hips":&lt;BR /&gt;bone_count += 1&lt;/P&gt;&lt;P&gt;# Clean up&lt;BR /&gt;importer.Destroy()&lt;BR /&gt;scene.Destroy()&lt;BR /&gt;manager.Destroy()&lt;/P&gt;&lt;P&gt;# Print the results&lt;BR /&gt;print("File name:", file_name)&lt;BR /&gt;print("Animation length:", animation_length)&lt;BR /&gt;print("Number of bones named 'Hips':", bone_count)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I imagine you'd need to replace "your_fbx_file_path" with the file path of your FBX file. &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2023 16:58:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11816104#M176</guid>
      <dc:creator>RyanCameron</dc:creator>
      <dc:date>2023-03-12T16:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get some attributes in the fbx file through python</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11817456#M177</link>
      <description>This error is encountered when obtaining the time length&lt;BR /&gt;&lt;BR /&gt;animation_length = scene.GetSrcObject(fbx.FbxCriteria.ObjectType(fbx.FbxAnimStack.ClassId), 0).LocalTimeSpan.GetDuration().Get()&lt;BR /&gt;AttributeError: 'FbxAnimStack' object has no attribute 'LocalTimeSpan'</description>
      <pubDate>Mon, 13 Mar 2023 11:39:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11817456#M177</guid>
      <dc:creator>410299258</dc:creator>
      <dc:date>2023-03-13T11:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get some attributes in the fbx file through python</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11817642#M178</link>
      <description>&lt;P&gt;I need this&lt;/P&gt;&lt;P&gt;time length = （get end - get start）/get fps&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="2023-03-13_204203.jpg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1188000iA1E216B7FACB1A6E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2023-03-13_204203.jpg" alt="2023-03-13_204203.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 12:48:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11817642#M178</guid>
      <dc:creator>410299258</dc:creator>
      <dc:date>2023-03-13T12:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get some attributes in the fbx file through python</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11819337#M179</link>
      <description>Where does your api information come from。I also want to check</description>
      <pubDate>Tue, 14 Mar 2023 03:15:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11819337#M179</guid>
      <dc:creator>741041743</dc:creator>
      <dc:date>2023-03-14T03:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get some attributes in the fbx file through python</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11819357#M180</link>
      <description>&lt;P&gt;I tried to modify this, but the value I got was not what I wanted&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-03-14_111938.jpg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1188319i27031CA38890F90A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2023-03-14_111938.jpg" alt="2023-03-14_111938.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 03:21:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/how-to-get-some-attributes-in-the-fbx-file-through-python/m-p/11819357#M180</guid>
      <dc:creator>410299258</dc:creator>
      <dc:date>2023-03-14T03:21:53Z</dc:date>
    </item>
  </channel>
</rss>

