Resolve #1836. Scaling in Blender is now auto resolved when representations are updated.

This commit is contained in:
Dion Moult
2021-11-08 20:57:57 +11:00
parent 9076043a5c
commit 7ccb6ee110
4 changed files with 56 additions and 5 deletions
+24 -2
View File
@@ -86,7 +86,7 @@ def i_add_an_empty():
@given("I add a sun")
@when("I add an sun")
def i_add_an_empty():
def i_add_a_sun():
bpy.ops.object.light_add(type="SUN")
@@ -143,10 +143,16 @@ def the_object_name_is_selected(name):
@given(parsers.parse('the object "{name}" is moved to "{location}"'))
@when(parsers.parse('the object "{name}" is moved to "{location}"'))
def the_object_name_is_selected(name, location):
def the_object_name_is_moved_to_location(name, location):
the_object_name_exists(name).location += Vector([float(co) for co in location.split(",")])
@given(parsers.parse('the object "{name}" is scaled to "{scale}"'))
@when(parsers.parse('the object "{name}" is scaled to "{scale}"'))
def the_object_name_is_scaled_to_scale(name, scale):
the_object_name_exists(name).scale *= float(scale)
@given(parsers.parse('the object "{name}" is placed in the collection "{collection}"'))
@when(parsers.parse('the object "{name}" is placed in the collection "{collection}"'))
def the_object_name_is_placed_in_the_collection_collection(name, collection):
@@ -449,6 +455,22 @@ def the_object_name_is_at_location(name, location):
).length < 0.1, f"Object is at {obj_location}"
@then(parsers.parse('the object "{name}" has no scale'))
def the_object_name_has_no_scale(name):
assert the_object_name_exists(name).scale == Vector(
(
1.0,
1.0,
1.0,
)
)
@then(parsers.parse('the object "{name}" dimensions are "{dimensions}"'))
def the_object_name_dimensions_are_dimensions(name, dimensions):
assert list(the_object_name_exists(name).dimensions) == [float(co) for co in dimensions.split(",")]
@then(parsers.parse('the object "{name}" bottom left corner is at "{location}"'))
def the_object_name_is_at_location(name, location):
obj_corner = Vector(the_object_name_exists(name).bound_box[0])