mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
BBIM 4D: Auto-refresh task re-ordering
This commit is contained in:
@@ -20,6 +20,8 @@ import bpy
|
|||||||
import isodate
|
import isodate
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
import ifcopenshell.util.attribute
|
import ifcopenshell.util.attribute
|
||||||
|
import blenderbim.tool as tool
|
||||||
|
import blenderbim.core.sequence as core
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.module.sequence.data import SequenceData
|
from blenderbim.bim.module.sequence.data import SequenceData
|
||||||
import blenderbim.bim.module.pset.data
|
import blenderbim.bim.module.pset.data
|
||||||
@@ -37,7 +39,6 @@ from bpy.props import (
|
|||||||
CollectionProperty,
|
CollectionProperty,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
taskcolumns_enum = []
|
taskcolumns_enum = []
|
||||||
tasktimecolumns_enum = []
|
tasktimecolumns_enum = []
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ def updateTaskName(self, context):
|
|||||||
props = context.scene.BIMWorkScheduleProperties
|
props = context.scene.BIMWorkScheduleProperties
|
||||||
if not props.is_task_update_enabled or self.name == "Unnamed":
|
if not props.is_task_update_enabled or self.name == "Unnamed":
|
||||||
return
|
return
|
||||||
self.file = IfcStore.get_file()
|
self.file = tool.Ifc.get()
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"sequence.edit_task",
|
"sequence.edit_task",
|
||||||
self.file,
|
self.file,
|
||||||
@@ -124,7 +125,7 @@ def updateTaskIdentification(self, context):
|
|||||||
props = context.scene.BIMWorkScheduleProperties
|
props = context.scene.BIMWorkScheduleProperties
|
||||||
if not props.is_task_update_enabled or self.identification == "XXX":
|
if not props.is_task_update_enabled or self.identification == "XXX":
|
||||||
return
|
return
|
||||||
self.file = IfcStore.get_file()
|
self.file = tool.Ifc.get()
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"sequence.edit_task",
|
"sequence.edit_task",
|
||||||
self.file,
|
self.file,
|
||||||
@@ -160,7 +161,7 @@ def updateTaskTimeDateTime(self, context, startfinish):
|
|||||||
if startfinish_value == "-":
|
if startfinish_value == "-":
|
||||||
return
|
return
|
||||||
|
|
||||||
self.file = IfcStore.get_file()
|
self.file = tool.Ifc.get()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
startfinish_datetime = parser.isoparse(startfinish_value)
|
startfinish_datetime = parser.isoparse(startfinish_value)
|
||||||
@@ -208,7 +209,7 @@ def updateTaskDuration(self, context):
|
|||||||
self.duration = "-"
|
self.duration = "-"
|
||||||
return
|
return
|
||||||
|
|
||||||
self.file = IfcStore.get_file()
|
self.file = tool.Ifc.get()
|
||||||
task = self.file.by_id(self.ifc_definition_id)
|
task = self.file.by_id(self.ifc_definition_id)
|
||||||
if task.TaskTime:
|
if task.TaskTime:
|
||||||
task_time = task.TaskTime
|
task_time = task.TaskTime
|
||||||
@@ -283,6 +284,9 @@ def update_color_progress(self, context):
|
|||||||
color[1] = color_progress.g
|
color[1] = color_progress.g
|
||||||
color[2] = color_progress.b
|
color[2] = color_progress.b
|
||||||
|
|
||||||
|
def update_sort_reversed(self, context):
|
||||||
|
if context.scene.BIMWorkScheduleProperties.active_work_schedule_id:
|
||||||
|
core.create_task_tree(tool.Sequence, work_schedule=tool.Ifc.get().by_id(context.scene.BIMWorkScheduleProperties.active_work_schedule_id))
|
||||||
|
|
||||||
class Task(PropertyGroup):
|
class Task(PropertyGroup):
|
||||||
name: StringProperty(name="Name", update=updateTaskName)
|
name: StringProperty(name="Name", update=updateTaskName)
|
||||||
@@ -360,7 +364,7 @@ class BIMWorkScheduleProperties(PropertyGroup):
|
|||||||
columns: CollectionProperty(name="Columns", type=Attribute)
|
columns: CollectionProperty(name="Columns", type=Attribute)
|
||||||
active_column_index: IntProperty(name="Active Column Index")
|
active_column_index: IntProperty(name="Active Column Index")
|
||||||
sort_column: StringProperty(name="Sort Column")
|
sort_column: StringProperty(name="Sort Column")
|
||||||
is_sort_reversed: BoolProperty(name="Is Sort Reversed")
|
is_sort_reversed: BoolProperty(name="Is Sort Reversed", update=update_sort_reversed)
|
||||||
column_types: EnumProperty(
|
column_types: EnumProperty(
|
||||||
items=[
|
items=[
|
||||||
("IfcTask", "IfcTask", ""),
|
("IfcTask", "IfcTask", ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user