mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-21 04:32:23 +00:00
UV coordinates for triangulated face sets are now saved in IFC.
This commit is contained in:
@@ -45,6 +45,7 @@ class TestAddRepresentation:
|
||||
geometry.get_total_representation_items("obj").should_be_called().will_return(1)
|
||||
geometry.should_force_faceted_brep().should_be_called().will_return(False)
|
||||
geometry.should_force_triangulation().should_be_called().will_return(True)
|
||||
geometry.should_generate_uvs("obj").should_be_called().will_return(True)
|
||||
ifc.run(
|
||||
"geometry.add_representation",
|
||||
context="context",
|
||||
@@ -54,6 +55,7 @@ class TestAddRepresentation:
|
||||
total_items=1,
|
||||
should_force_faceted_brep=False,
|
||||
should_force_triangulation=True,
|
||||
should_generate_uvs=True,
|
||||
ifc_representation_class="ifc_representation_class",
|
||||
profile_set_usage="profile_set_usage",
|
||||
).should_be_called().will_return("representation")
|
||||
@@ -109,6 +111,7 @@ class TestAddRepresentation:
|
||||
geometry.get_total_representation_items("obj").should_be_called().will_return(1)
|
||||
geometry.should_force_faceted_brep().should_be_called().will_return(False)
|
||||
geometry.should_force_triangulation().should_be_called().will_return(True)
|
||||
geometry.should_generate_uvs("obj").should_be_called().will_return(True)
|
||||
ifc.run(
|
||||
"geometry.add_representation",
|
||||
context="context",
|
||||
@@ -118,6 +121,7 @@ class TestAddRepresentation:
|
||||
total_items=1,
|
||||
should_force_faceted_brep=False,
|
||||
should_force_triangulation=True,
|
||||
should_generate_uvs=True,
|
||||
ifc_representation_class="ifc_representation_class",
|
||||
profile_set_usage="profile_set_usage",
|
||||
).should_be_called().will_return("representation")
|
||||
|
||||
@@ -462,6 +462,33 @@ class TestShouldForceTriangulation(NewFile):
|
||||
assert subject.should_force_triangulation() is result
|
||||
|
||||
|
||||
class TestShouldGenerateUVs(NewFile):
|
||||
def test_needs_mesh_data(self):
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
assert subject.should_generate_uvs(obj) is False
|
||||
|
||||
def test_needs_nodes(self):
|
||||
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
|
||||
material = bpy.data.materials.new("Material")
|
||||
obj.data.materials.append(material)
|
||||
material.use_nodes = False
|
||||
assert subject.should_generate_uvs(obj) is False
|
||||
|
||||
def test_needs_texture_coordinates_with_a_uv_output(self):
|
||||
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
|
||||
material = bpy.data.materials.new("Material")
|
||||
obj.data.materials.append(material)
|
||||
material.use_nodes = True
|
||||
|
||||
bsdf = material.node_tree.nodes["Principled BSDF"]
|
||||
node = material.node_tree.nodes.new(type="ShaderNodeTexImage")
|
||||
material.node_tree.links.new(bsdf.inputs["Base Color"], node.outputs["Color"])
|
||||
|
||||
coords = material.node_tree.nodes.new(type="ShaderNodeTexCoord")
|
||||
material.node_tree.links.new(node.inputs["Vector"], coords.outputs["UV"])
|
||||
assert subject.should_generate_uvs(obj) is True
|
||||
|
||||
|
||||
class TestShouldUsePresentationStyleAssignment(NewFile):
|
||||
def test_run(self):
|
||||
result = bpy.context.scene.BIMGeometryProperties.should_use_presentation_style_assignment
|
||||
|
||||
Reference in New Issue
Block a user