.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_introductory/viz_gltf_animated.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end <sphx_glr_download_auto_examples_01_introductory_viz_gltf_animated.py>` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_introductory_viz_gltf_animated.py: ======================= Visualizing a glTF file ======================= In this tutorial, we will show how to display a simple animated glTF in a scene. .. GENERATED FROM PYTHON SOURCE LINES 8-11 .. code-block:: Python import fury .. GENERATED FROM PYTHON SOURCE LINES 12-13 Create a scene. .. GENERATED FROM PYTHON SOURCE LINES 13-22 .. code-block:: Python scene = fury.window.Scene() showm = fury.window.ShowManager( scene=scene, size=(900, 768), reset_camera=False, order_transparent=True ) showm.initialize() .. GENERATED FROM PYTHON SOURCE LINES 23-24 Retrieving the gltf model. .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: Python fury.data.fetch_gltf(name="InterpolationTest", mode="glTF") filename = fury.data.read_viz_gltf("InterpolationTest") .. GENERATED FROM PYTHON SOURCE LINES 28-30 Initialize the glTF object and get actors using `actors` method. Get the main_timeline (which contains multiple Timeline objects). .. GENERATED FROM PYTHON SOURCE LINES 30-34 .. code-block:: Python gltf_obj = fury.gltf.glTF(filename) timeline = gltf_obj.main_animation() .. GENERATED FROM PYTHON SOURCE LINES 35-36 Add the timeline to the scene (No need to add actors separately). .. GENERATED FROM PYTHON SOURCE LINES 36-39 .. code-block:: Python scene.add(timeline) .. GENERATED FROM PYTHON SOURCE LINES 40-41 define a timer_callback that updates the timeline. .. GENERATED FROM PYTHON SOURCE LINES 41-56 .. code-block:: Python interactive = False def timer_callback(_obj, _event): timeline.update_animation() showm.render() showm.add_timer_callback(True, 10, timer_callback) if interactive: showm.start() fury.window.record(scene=scene, out_path="viz_gltf_animated.png", size=(900, 768)) .. image-sg:: /auto_examples/01_introductory/images/sphx_glr_viz_gltf_animated_001.png :alt: viz gltf animated :srcset: /auto_examples/01_introductory/images/sphx_glr_viz_gltf_animated_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.168 seconds) .. _sphx_glr_download_auto_examples_01_introductory_viz_gltf_animated.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_gltf_animated.ipynb <viz_gltf_animated.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_gltf_animated.py <viz_gltf_animated.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_