mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix pset template UI bug where changing to another prop didn't cancel editing older props. Also add support for blank or falsey enums (e.g. a real of 0.0).
This commit is contained in:
@@ -240,6 +240,7 @@ class AddPropTemplate(bpy.types.Operator, Operator):
|
||||
IfcStore.pset_template_file,
|
||||
**{"pset_template": IfcStore.pset_template_file.by_id(pset_template_id)}
|
||||
)
|
||||
bpy.ops.bim.disable_editing_prop_template()
|
||||
|
||||
|
||||
class RemovePropTemplate(bpy.types.Operator, Operator):
|
||||
@@ -294,7 +295,7 @@ class EditPropTemplate(bpy.types.Operator, Operator):
|
||||
"IFCPROPERTYENUMERATION",
|
||||
Name=prop.name,
|
||||
EnumerationValues=tuple(
|
||||
self.file.create_entity(prop.primary_measure_type, ev[data_type]) for ev in prop.enum_values
|
||||
self.file.create_entity(prop.primary_measure_type, getattr(ev, data_type)) for ev in prop.enum_values
|
||||
),
|
||||
)
|
||||
return prop_enum
|
||||
|
||||
@@ -56,7 +56,7 @@ Scenario: Remove prop template
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And I press "bim.add_prop_template"
|
||||
And the variable "prop_template" is "2"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.remove_prop_template(prop_template={prop_template})"
|
||||
Then nothing happens
|
||||
|
||||
@@ -64,7 +64,7 @@ Scenario: Enable editing prop template
|
||||
Given an empty IFC project
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And the variable "prop_template" is "2"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||
Then nothing happens
|
||||
|
||||
@@ -72,16 +72,51 @@ Scenario: Edit prop template
|
||||
Given an empty IFC project
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And the variable "prop_template" is "2"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||
And I press "bim.edit_prop_template"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Edit prop template - enumeration property
|
||||
Given an empty IFC project
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||
And I set "scene.BIMPsetTemplateProperties.active_prop_template.template_type" to "P_ENUMERATEDVALUE"
|
||||
And I press "bim.edit_prop_template"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Add prop enum
|
||||
Given an empty IFC project
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And I press "bim.add_prop_template"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||
And I set "scene.BIMPsetTemplateProperties.active_prop_template.template_type" to "P_ENUMERATEDVALUE"
|
||||
And I press "bim.add_prop_enum"
|
||||
And I press "bim.edit_prop_template"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Delete prop enum
|
||||
Given an empty IFC project
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And I press "bim.add_prop_template"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||
And I set "scene.BIMPsetTemplateProperties.active_prop_template.template_type" to "P_ENUMERATEDVALUE"
|
||||
And I press "bim.add_prop_enum"
|
||||
And I press "bim.delete_prop_enum(index=0)"
|
||||
And I press "bim.edit_prop_template"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Disable editing prop template
|
||||
Given an empty IFC project
|
||||
When I load a new pset template file
|
||||
And I press "bim.add_pset_template"
|
||||
And the variable "prop_template" is "2"
|
||||
And the variable "prop_template" is "{pset_ifc}.by_type('IfcSimplePropertyTemplate')[-1].id()"
|
||||
And I press "bim.enable_editing_prop_template(prop_template={prop_template})"
|
||||
And I press "bim.disable_editing_prop_template"
|
||||
Then nothing happens
|
||||
|
||||
@@ -29,7 +29,7 @@ from mathutils import Vector
|
||||
|
||||
scenarios("feature")
|
||||
|
||||
variables = {"cwd": os.getcwd(), "ifc": "IfcStore.get_file()"}
|
||||
variables = {"cwd": os.getcwd(), "ifc": "IfcStore.get_file()", "pset_ifc": "IfcStore.pset_template_file"}
|
||||
|
||||
# Monkey-patch webbrowser opening since we want to test headlessly
|
||||
webbrowser.open = lambda x: True
|
||||
|
||||
Reference in New Issue
Block a user