This commit is contained in:
Andrej730
2024-05-10 11:21:53 +05:00
parent e7eb00eaa3
commit c50d1ea2fe
105 changed files with 502 additions and 251 deletions
@@ -15,18 +15,29 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import ifcopenshell
import ifcopenshell.api
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
import bpy
def add_surface_textures(file, material=None, uv_maps=None, textures=None) -> None:
def add_surface_textures(
file: ifcopenshell.entity_instance,
material: Optional[bpy.types.Material] = None,
textures: Optional[list[dict]] = None,
uv_maps: Optional[list[ifcopenshell.entity_instance]] = None,
) -> list[ifcopenshell.entity_instance]:
"""Add surface texture based on a Blender material definition or texture data.
Either `material` or `textures` should be provided.
:param material: The Blender material definition with a node tree that
is compatible with glTF. See one of the valid combinations here:
https://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html
:type material: bpy.types.Material
:type material: bpy.types.Material, optional
:param uv_maps: A list of IfcIndexedTextureMap for any
IfcTessellatedFaceSets that the representation has, obtained from
the HasTextures attribute.
@@ -44,7 +55,7 @@ def add_surface_textures(file, material=None, uv_maps=None, textures=None) -> No
based on geometry);
* `Camera` - IfcTextureCoordinateGenerator with mode COORD_EYE (autogenerated UV
based on camera position)
:type textures: list[dict]
:type textures: list[dict], optional
:return: A list of IfcImageTexture
:rtype: list[ifcopenshell.entity_instance]
"""