mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Generated construction visibility now works in renders, not just viewport view.
This commit is contained in:
@@ -1804,10 +1804,14 @@ class VisualiseWorkScheduleDateRange(bpy.types.Operator):
|
||||
|
||||
def animate_creation(self, obj, product_frame):
|
||||
obj.hide_viewport = True
|
||||
obj.hide_render = True
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=self.start_frame)
|
||||
obj.keyframe_insert(data_path="hide_render", frame=self.start_frame)
|
||||
obj.hide_viewport = False
|
||||
obj.hide_render = False
|
||||
obj.color = (0.0, 1.0, 0.0, 1)
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=product_frame["STARTED"])
|
||||
obj.keyframe_insert(data_path="hide_render", frame=product_frame["STARTED"])
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["STARTED"])
|
||||
obj.color = (1.0, 1.0, 1.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["COMPLETED"])
|
||||
@@ -1840,10 +1844,14 @@ class VisualiseWorkScheduleDateRange(bpy.types.Operator):
|
||||
|
||||
def animate_movement_to(self, obj, product_frame):
|
||||
obj.hide_viewport = True
|
||||
obj.hide_render = True
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=self.start_frame)
|
||||
obj.keyframe_insert(data_path="hide_render", frame=self.start_frame)
|
||||
obj.hide_viewport = False
|
||||
obj.hide_render = False
|
||||
obj.color = (1.0, 1.0, 0.0, 1)
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=product_frame["STARTED"])
|
||||
obj.keyframe_insert(data_path="hide_render", frame=product_frame["STARTED"])
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["STARTED"])
|
||||
obj.color = (1.0, 1.0, 1.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["COMPLETED"])
|
||||
@@ -1851,24 +1859,36 @@ class VisualiseWorkScheduleDateRange(bpy.types.Operator):
|
||||
def animate_movement_from(self, obj, product_frame):
|
||||
obj.color = (1.0, 1.0, 1.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=self.start_frame)
|
||||
obj.hide_viewport = False
|
||||
obj.hide_render = False
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["STARTED"] - 1)
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=product_frame["STARTED"] - 1)
|
||||
obj.keyframe_insert(data_path="hide_render", frame=product_frame["STARTED"] - 1)
|
||||
obj.color = (1.0, 0.5, 0.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["STARTED"])
|
||||
obj.hide_viewport = True
|
||||
obj.hide_render = True
|
||||
obj.color = (0.0, 0.0, 0.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["COMPLETED"])
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=product_frame["COMPLETED"])
|
||||
obj.keyframe_insert(data_path="hide_render", frame=product_frame["COMPLETED"])
|
||||
|
||||
def animate_consumption(self, obj, product_frame):
|
||||
obj.color = (1.0, 1.0, 1.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=self.start_frame)
|
||||
obj.hide_viewport = False
|
||||
obj.hide_render = False
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["STARTED"] - 1)
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=product_frame["STARTED"] - 1)
|
||||
obj.keyframe_insert(data_path="hide_render", frame=product_frame["STARTED"] - 1)
|
||||
obj.color = (0.0, 1.0, 1.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["STARTED"])
|
||||
obj.hide_viewport = True
|
||||
obj.hide_render = True
|
||||
obj.color = (0.0, 0.0, 0.0, 1)
|
||||
obj.keyframe_insert(data_path="color", frame=product_frame["COMPLETED"])
|
||||
obj.keyframe_insert(data_path="hide_viewport", frame=product_frame["COMPLETED"])
|
||||
obj.keyframe_insert(data_path="hide_render", frame=product_frame["COMPLETED"])
|
||||
|
||||
def calculate_total_frames(self, context):
|
||||
if self.props.speed_types == "FRAME_SPEED":
|
||||
|
||||
@@ -124,6 +124,10 @@ def i_press_operator(operator):
|
||||
exec(f"bpy.ops.{operator}()")
|
||||
|
||||
|
||||
def i_rename_the_object_name1_to_name2(name1, name2):
|
||||
the_object_name_exists(name1).name = name2
|
||||
|
||||
|
||||
def the_object_name_exists(name):
|
||||
obj = bpy.data.objects.get(name)
|
||||
if not obj:
|
||||
@@ -284,6 +288,7 @@ definitions = {
|
||||
'"(.*)" is "(.*)"': prop_is_value,
|
||||
'I enable "(.*)"': i_enable_prop,
|
||||
'I press "(.*)"': i_press_operator,
|
||||
'I rename the object "(.*)" to "(.*)"': i_rename_the_object_name1_to_name2,
|
||||
'the object "(.*)" exists': the_object_name_exists,
|
||||
'the object "(.*)" does not exist': the_object_name_does_not_exist,
|
||||
'the object "(.*)" is an "(.*)"': the_object_name_is_an_ifc_class,
|
||||
|
||||
@@ -38,6 +38,42 @@ class TestVisualiseWorkScheduleDateRange(test.bim.bootstrap.NewFile):
|
||||
Then the object "Timeline" has a body of "2021-01-02"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_construction_of_a_wall(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I press "bim.add_work_schedule"
|
||||
And I press "bim.enable_editing_tasks(work_schedule=72)"
|
||||
And I press "bim.add_summary_task(work_schedule=72)"
|
||||
And I press "bim.enable_editing_task(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "CONSTRUCTION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/Cube" is selected
|
||||
And I press "bim.assign_product(task=76, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule=72)"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_demolition_of_a_wall(self):
|
||||
return """
|
||||
@@ -65,14 +101,137 @@ class TestVisualiseWorkScheduleDateRange(test.bim.bootstrap.NewFile):
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule=72)"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 0.0, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 0.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_operation_of_a_wall(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I press "bim.add_work_schedule"
|
||||
And I press "bim.enable_editing_tasks(work_schedule=72)"
|
||||
And I press "bim.add_summary_task(work_schedule=72)"
|
||||
And I press "bim.enable_editing_task(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "OPERATION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/Cube" is selected
|
||||
And I press "bim.assign_product(task=76, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule=72)"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 1.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_movement_of_a_wall(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I press "bim.add_work_schedule"
|
||||
And I press "bim.enable_editing_tasks(work_schedule=72)"
|
||||
And I press "bim.add_summary_task(work_schedule=72)"
|
||||
And I press "bim.enable_editing_task(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "MOVE"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
And I rename the object "Cube" to "ToObject"
|
||||
And the object "ToObject" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/ToObject" is selected
|
||||
And I press "bim.assign_product(task=76, relating_product='')"
|
||||
When I add a cube
|
||||
And I rename the object "Cube" to "FromObject"
|
||||
And the object "FromObject" is selected
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/FromObject" is selected
|
||||
And I press "bim.assign_process(task=76, related_object_type="PRODUCT", related_object='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule=72)"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "True"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[1.0, 0.5, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_consumption_of_a_wall(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I press "bim.add_work_schedule"
|
||||
And I press "bim.enable_editing_tasks(work_schedule=72)"
|
||||
And I press "bim.add_summary_task(work_schedule=72)"
|
||||
And I press "bim.enable_editing_task_time(task=76)"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/Cube" is selected
|
||||
And I press "bim.assign_process(task=76, related_object_type="PRODUCT", related_object='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule=72)"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user