mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
maintain tasks bar visual property state when tasks properties are reloaded
This commit is contained in:
@@ -347,6 +347,14 @@ def updateAssignedResourceUsage(self, context):
|
|||||||
blenderbim.bim.module.pset.data.refresh()
|
blenderbim.bim.module.pset.data.refresh()
|
||||||
|
|
||||||
|
|
||||||
|
def update_task_bar_list(self, context):
|
||||||
|
if not context.scene.BIMWorkScheduleProperties.is_task_update_enabled:
|
||||||
|
return
|
||||||
|
if self.has_bar_visual:
|
||||||
|
tool.Sequence.add_task_bar(self.ifc_definition_id)
|
||||||
|
else:
|
||||||
|
tool.Sequence.remove_task_bar(self.ifc_definition_id)
|
||||||
|
|
||||||
class Task(PropertyGroup):
|
class Task(PropertyGroup):
|
||||||
name: StringProperty(name="Name", update=updateTaskName)
|
name: StringProperty(name="Name", update=updateTaskName)
|
||||||
identification: StringProperty(name="Identification", update=updateTaskIdentification)
|
identification: StringProperty(name="Identification", update=updateTaskIdentification)
|
||||||
@@ -354,7 +362,7 @@ class Task(PropertyGroup):
|
|||||||
has_children: BoolProperty(name="Has Children")
|
has_children: BoolProperty(name="Has Children")
|
||||||
is_selected: BoolProperty(name="Is Selected")
|
is_selected: BoolProperty(name="Is Selected")
|
||||||
is_expanded: BoolProperty(name="Is Expanded")
|
is_expanded: BoolProperty(name="Is Expanded")
|
||||||
has_bar_visual: BoolProperty(name="Show Task Bar Animation", default=False)
|
has_bar_visual: BoolProperty(name="Show Task Bar Animation", default=False, update=update_task_bar_list)
|
||||||
level_index: IntProperty(name="Level Index")
|
level_index: IntProperty(name="Level Index")
|
||||||
duration: StringProperty(name="Duration", update=updateTaskDuration)
|
duration: StringProperty(name="Duration", update=updateTaskDuration)
|
||||||
start: StringProperty(name="Start", update=updateTaskTimeStart)
|
start: StringProperty(name="Start", update=updateTaskTimeStart)
|
||||||
@@ -456,6 +464,7 @@ class BIMWorkScheduleProperties(PropertyGroup):
|
|||||||
active_task_time_id: IntProperty(name="Active Task Time Id")
|
active_task_time_id: IntProperty(name="Active Task Time Id")
|
||||||
task_time_attributes: CollectionProperty(name="Task Time Attributes", type=Attribute)
|
task_time_attributes: CollectionProperty(name="Task Time Attributes", type=Attribute)
|
||||||
contracted_tasks: StringProperty(name="Contracted Task Items", default="[]")
|
contracted_tasks: StringProperty(name="Contracted Task Items", default="[]")
|
||||||
|
task_bars: StringProperty(name="Checked Task Items", default="[]")
|
||||||
is_task_update_enabled: BoolProperty(name="Is Task Update Enabled", default=True)
|
is_task_update_enabled: BoolProperty(name="Is Task Update Enabled", default=True)
|
||||||
editing_sequence_type: StringProperty(name="Editing Sequence Type")
|
editing_sequence_type: StringProperty(name="Editing Sequence Type")
|
||||||
active_sequence_id: IntProperty(name="Active Sequence Id")
|
active_sequence_id: IntProperty(name="Active Sequence Id")
|
||||||
|
|||||||
@@ -191,12 +191,14 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
|
|
||||||
props = bpy.context.scene.BIMWorkScheduleProperties
|
props = bpy.context.scene.BIMWorkScheduleProperties
|
||||||
task_props = bpy.context.scene.BIMTaskTreeProperties
|
task_props = bpy.context.scene.BIMTaskTreeProperties
|
||||||
|
tasks_with_visual_bar = cls.get_task_bar_list()
|
||||||
props.is_task_update_enabled = False
|
props.is_task_update_enabled = False
|
||||||
|
|
||||||
for item in task_props.tasks:
|
for item in task_props.tasks:
|
||||||
task = tool.Ifc.get().by_id(item.ifc_definition_id)
|
task = tool.Ifc.get().by_id(item.ifc_definition_id)
|
||||||
item.name = task.Name or "Unnamed"
|
item.name = task.Name or "Unnamed"
|
||||||
item.identification = task.Identification or "XXX"
|
item.identification = task.Identification or "XXX"
|
||||||
|
item.has_bar_visual = item.ifc_definition_id in tasks_with_visual_bar
|
||||||
if props.highlighted_task_id:
|
if props.highlighted_task_id:
|
||||||
item.is_predecessor = props.highlighted_task_id in [
|
item.is_predecessor = props.highlighted_task_id in [
|
||||||
rel.RelatedProcess.id() for rel in task.IsPredecessorTo
|
rel.RelatedProcess.id() for rel in task.IsPredecessorTo
|
||||||
@@ -796,10 +798,9 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_animation_bar_tasks(cls):
|
def get_animation_bar_tasks(cls):
|
||||||
return [
|
return [
|
||||||
tool.Ifc.get().by_id(item.ifc_definition_id)
|
tool.Ifc.get().by_id(task_id)
|
||||||
for item in bpy.context.scene.BIMTaskTreeProperties.tasks
|
for task_id in cls.get_task_bar_list()
|
||||||
if item.has_bar_visual
|
]
|
||||||
] or []
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_bars(cls, tasks):
|
def create_bars(cls, tasks):
|
||||||
@@ -1289,6 +1290,12 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
obj.hide_viewport = False
|
obj.hide_viewport = False
|
||||||
obj.hide_render = False
|
obj.hide_render = False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def hide_object(cls, obj):
|
||||||
|
if obj.visible_get():
|
||||||
|
obj.hide_viewport = True
|
||||||
|
obj.hide_render = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_objects_animation(cls, include_blender_objects=True):
|
def clear_objects_animation(cls, include_blender_objects=True):
|
||||||
for obj in bpy.data.objects:
|
for obj in bpy.data.objects:
|
||||||
@@ -1676,3 +1683,20 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
if task.TaskTime and task.TaskTime.ScheduleDuration:
|
if task.TaskTime and task.TaskTime.ScheduleDuration:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_task_bar_list(cls):
|
||||||
|
return json.loads(bpy.context.scene.BIMWorkScheduleProperties.task_bars)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def add_task_bar(cls, task_id):
|
||||||
|
task_bars = cls.get_task_bar_list()
|
||||||
|
task_bars.append(task_id)
|
||||||
|
bpy.context.scene.BIMWorkScheduleProperties.task_bars = json.dumps(task_bars)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def remove_task_bar(cls, task_id):
|
||||||
|
task_bars = cls.get_task_bar_list()
|
||||||
|
if task_id in task_bars:
|
||||||
|
task_bars.remove(task_id)
|
||||||
|
bpy.context.scene.BIMWorkScheduleProperties.task_bars = json.dumps(task_bars)
|
||||||
Reference in New Issue
Block a user