WIP port owner history setting to partial editing. See #1222.

This commit is contained in:
Dion Moult
2021-01-09 12:00:22 +11:00
parent 06e1ee7825
commit 8ef752f173
6 changed files with 54 additions and 42 deletions
@@ -253,7 +253,6 @@ if bpy is not None:
ui.BIM_PT_search,
ui.BIM_PT_ifccsv,
ui.BIM_PT_ifcclash,
ui.BIM_PT_owner,
ui.BIM_PT_qa,
ui.BIM_PT_library,
ui.BIM_PT_gis,
@@ -24,6 +24,7 @@ classes = (
operator.RemoveAddress,
ui.BIM_PT_people,
ui.BIM_PT_organisations,
ui.BIM_PT_owner,
)
@@ -3,4 +3,4 @@ class Usecase:
self.file = file
def execute(self):
self.file.createIfcOrganization("APTR", "Apeture Science")
self.file.createIfcOrganization("APTR", "Aperture Science")
@@ -197,3 +197,35 @@ class BIM_PT_organisations(Panel):
row.operator("bim.enable_editing_organisation", icon="GREASEPENCIL", text="").organisation_id = organisation_id
if not organisation["is_engaged"]:
row.operator("bim.remove_organisation", icon="X", text="").organisation_id = organisation_id
class BIM_PT_owner(Panel):
bl_label = "IFC Owner History"
bl_idname = "BIM_PT_owner"
bl_options = {"DEFAULT_CLOSED"}
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
@classmethod
def poll(cls, context):
return IfcStore.get_file()
def draw(self, context):
if not Data.is_loaded:
Data.load()
self.layout.use_property_split = True
props = context.scene.BIMProperties
if not Data.people:
self.layout.label(text="No people found.")
else:
row = self.layout.row()
row.prop(props, "user_person")
if not Data.organisations:
self.layout.label(text="No organisations found.")
else:
row = self.layout.row()
row.prop(props, "user_organisation")
+20 -12
View File
@@ -47,8 +47,6 @@ materialtypes_enum = []
contexts_enum = []
subcontexts_enum = []
target_views_enum = []
persons_enum = []
organisations_enum = []
sheets_enum = []
vector_styles_enum = []
@@ -298,17 +296,27 @@ def getProfileDef(self, context):
def getPersons(self, context):
global persons_enum
persons_enum.clear()
persons_enum.extend([(p.name, p.name, "") for p in bpy.context.scene.BIMProperties.people])
return persons_enum
from blenderbim.bim.module.owner.data import Data
if not Data.is_loaded:
Data.load()
results = []
for ifc_id, person in Data.people.items():
if "Id" in person:
identifier = person["Id"] or ""
else:
identifier = person["Identifier"] or ""
results.append((str(ifc_id), identifier, ""))
return results
def getOrganisations(self, context):
global organisations_enum
organisations_enum.clear()
organisations_enum.extend([(o.name, o.name, "") for o in bpy.context.scene.BIMProperties.organisations])
return organisations_enum
from blenderbim.bim.module.owner.data import Data
if not Data.is_loaded:
Data.load()
results = []
for ifc_id, organisation in Data.organisations.items():
results.append((str(ifc_id), organisation["Name"], ""))
return results
def getIfcPatchRecipes(self, context):
@@ -1282,8 +1290,6 @@ class BIMProperties(PropertyGroup):
import_should_offset_model: BoolProperty(name="Import and Offset Model", default=False)
import_model_offset_coordinates: StringProperty(name="Model Offset Coordinates", default="0,0,0")
qa_reject_element_reason: StringProperty(name="Element Rejection Reason")
people: CollectionProperty(name="People", type=Person)
organisations: CollectionProperty(name="Organisations", type=Organisation)
person: PointerProperty(type=Person)
active_person_id: IntProperty(name="Active Person Id")
@@ -1293,6 +1299,8 @@ class BIMProperties(PropertyGroup):
active_role_id: IntProperty(name="Active Role Id")
address: PointerProperty(type=Address)
active_address_id: IntProperty(name="Active Address Id")
user_person: EnumProperty(items=getPersons, name="Person")
user_organisation: EnumProperty(items=getOrganisations, name="Organisation")
has_georeferencing: BoolProperty(name="Has Georeferencing", default=False)
has_library: BoolProperty(name="Has Project Library", default=False)
-28
View File
@@ -1030,34 +1030,6 @@ class BIM_PT_text(Panel):
row.prop(variable, "prop_key")
class BIM_PT_owner(Panel):
bl_label = "IFC Owner History"
bl_idname = "BIM_PT_owner"
bl_options = {"DEFAULT_CLOSED"}
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
scene = context.scene
props = scene.BIMProperties
if not props.person:
layout.label(text="No people found.")
else:
row = layout.row()
row.prop(props, "person")
if not props.organisation:
layout.label(text="No organisations found.")
else:
row = layout.row()
row.prop(props, "organisation")
class BIM_PT_bim(Panel):
bl_label = "Building Information Modeling"
bl_idname = "BIM_PT_bim"