From e1b8de8512da1d43896886f18a43b2140e1dfbcc Mon Sep 17 00:00:00 2001 From: Tom Rothamel Date: Sat, 15 Feb 2025 23:14:02 -0500 Subject: [PATCH] assimp: Rename AssimpModel to GLTF model. Assimp was contributing a lot of to the size of Ren'Py, so put it on a diet and removed all the formats except for GLTF). This would also let us switch toanother GLTF parser in the future. --- renpy/defaultstore.py | 3 +-- renpy/gl2/assimp.pyx | 18 +++++------------- sphinx/source/model.rst | 4 ++-- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/renpy/defaultstore.py b/renpy/defaultstore.py index 3fa3bc5f6..7c75fd00e 100644 --- a/renpy/defaultstore.py +++ b/renpy/defaultstore.py @@ -186,8 +186,7 @@ Matrix = renpy.display.matrix.Matrix # @UndefinedVariable Live2D = renpy.gl2.live2d.Live2D Model = renpy.display.model.Model - -AssimpModel = renpy.gl2.assimp.AssimpModel +GLTFModel = renpy.gl2.assimp.GLTFModel # Currying things. Alpha = renpy.curry.curry(renpy.display.layout.Alpha) diff --git a/renpy/gl2/assimp.pyx b/renpy/gl2/assimp.pyx index 3488cd12c..7b5894855 100644 --- a/renpy/gl2/assimp.pyx +++ b/renpy/gl2/assimp.pyx @@ -442,14 +442,14 @@ loader = Loader() loader_lock = threading.Lock() "The lock used to protect the loader." -class AssimpModel(renpy.display.displayable.Displayable): +class GLTFModel(renpy.display.displayable.Displayable): """ :doc: assimp - A displayable that displays a 3D Model loaded using the - `Open Asset Importer (assimp) library `_. + A displayable that loads a 3D Model in the GLTF format. This format is supported by many 3D tools. Ren'Py + uses the `Open Asset Importer (assimp) library `_ to load GLTF models. - For the purposes of Ren'Py's 2D layout system, an AssimpModel has zero width and height. By default, the model + For the purposes of Ren'Py's 2D layout system, a GLTFModel has zero width and height. By default, the model is loaded at the size found in the file that contains it. If required, the `zoom` may be used to scale it. When multiple models are in use, the ``gl_depth True`` property should be supplied to the camera, so that @@ -457,15 +457,7 @@ class AssimpModel(renpy.display.displayable.Displayable): important to use models simple enough to be completely rendered. `filename` - The filename of the model to display. The following formats are supported: - - 3D, 3DS, 3MF, AC, AC3D, ACC, AMJ, ASE, ASK, B3D, BVH, CSM, COB, DAE/Collada, DXF, ENFF, FBX, - glTF 1.0 + GLB, glTF 2.0, HMB, IFC-STEP, IQM, IRR / IRRMESH, LWO, LWS, LXO, M3D, MD2, MD5, - MDC, MDL, MESH / MESH.XML, MOT, MS3D, NDO, NFF, OBJ, OFF, OGEX, PLY, PMX, PRJ, Q3O, Q3S, RAW, SCN, - SIB, SMD, STP, STL, TER, UC, VTA, X, X3D, XGL, ZGL - - Many of these formats are obsolete or special-purpose. glTF 2.0 is the best-tested format for Ren'Py - use, though it requires a custom shader for best results. + The filename of the model to display. `textures` A list of textures to load. These textures will be loaded into texture slots - the first will be tex0, the diff --git a/sphinx/source/model.rst b/sphinx/source/model.rst index 3f602f5e5..e09bdd8e7 100644 --- a/sphinx/source/model.rst +++ b/sphinx/source/model.rst @@ -556,10 +556,10 @@ can be supplied the property method. and `gl_texture_wrap_tex3` the fourth. While only these four are avalable through Transforms, it's possibe to supply "texture_wrap_tex4" or "texture_wrap_myuniform" to Render.add_property. -AssimpModel Displayable +GLTFModel Displayable ----------------------- -The AssimpModel displayble allow you to load 3D models in over 40 file formats. This is what you should use +The GLTFModel displayble allow you to load 3D models in the GLTF file format. This is what you should use if you have a 3D model you created in another program and want to display in Ren'Py. .. include:: inc/assimp