mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +00:00
remove bim.unlink_material #4843
This commit is contained in:
@@ -58,7 +58,6 @@ classes = (
|
|||||||
operator.SelectByMaterial,
|
operator.SelectByMaterial,
|
||||||
operator.UnassignMaterial,
|
operator.UnassignMaterial,
|
||||||
operator.UnassignMaterialStyle,
|
operator.UnassignMaterialStyle,
|
||||||
operator.UnlinkMaterial,
|
|
||||||
prop.Material,
|
prop.Material,
|
||||||
prop.BIMMaterialProperties,
|
prop.BIMMaterialProperties,
|
||||||
prop.BIMObjectMaterialProperties,
|
prop.BIMObjectMaterialProperties,
|
||||||
|
|||||||
@@ -198,16 +198,6 @@ class RemoveMaterialSet(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
core.remove_material_set(tool.Ifc, tool.Material, material=tool.Ifc.get().by_id(self.material))
|
core.remove_material_set(tool.Ifc, tool.Material, material=tool.Ifc.get().by_id(self.material))
|
||||||
|
|
||||||
|
|
||||||
class UnlinkMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
|
||||||
bl_idname = "bim.unlink_material"
|
|
||||||
bl_label = "Unlink Material"
|
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
|
||||||
material: bpy.props.IntProperty(name="Material ID")
|
|
||||||
|
|
||||||
def _execute(self, context):
|
|
||||||
core.unlink_material(tool.Ifc, obj=tool.Ifc.get_object(tool.Ifc.get().by_id(self.material)))
|
|
||||||
|
|
||||||
|
|
||||||
class AssignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
class AssignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.assign_material"
|
bl_idname = "bim.assign_material"
|
||||||
bl_label = "Assign Material"
|
bl_label = "Assign Material"
|
||||||
|
|||||||
@@ -69,8 +69,6 @@ class BIM_PT_materials(Panel):
|
|||||||
op.material = material.ifc_definition_id
|
op.material = material.ifc_definition_id
|
||||||
op = row.operator("bim.enable_editing_material_style", text="", icon="SHADING_RENDERED")
|
op = row.operator("bim.enable_editing_material_style", text="", icon="SHADING_RENDERED")
|
||||||
op.material = material.ifc_definition_id
|
op.material = material.ifc_definition_id
|
||||||
op = row.operator("bim.unlink_material", icon="UNLINKED", text="")
|
|
||||||
op.material = material.ifc_definition_id
|
|
||||||
row.operator("bim.remove_material", text="", icon="X").material = material.ifc_definition_id
|
row.operator("bim.remove_material", text="", icon="X").material = material.ifc_definition_id
|
||||||
|
|
||||||
self.draw_editing_ui()
|
self.draw_editing_ui()
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ if TYPE_CHECKING:
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
|
|
||||||
|
|
||||||
def unlink_material(ifc: tool.Ifc, obj: bpy.types.Material) -> None:
|
|
||||||
ifc.unlink(obj=obj)
|
|
||||||
|
|
||||||
|
|
||||||
def add_material(
|
def add_material(
|
||||||
ifc: tool.Ifc,
|
ifc: tool.Ifc,
|
||||||
material: tool.Material,
|
material: tool.Material,
|
||||||
|
|||||||
@@ -59,15 +59,6 @@ Scenario: Remove material set
|
|||||||
When I press "bim.remove_material_set(material={material})"
|
When I press "bim.remove_material_set(material={material})"
|
||||||
Then nothing happens
|
Then nothing happens
|
||||||
|
|
||||||
Scenario: Unlink material
|
|
||||||
Given an empty IFC project
|
|
||||||
And I add a cube
|
|
||||||
And the object "Cube" is selected
|
|
||||||
And I add a material
|
|
||||||
And I press "bim.add_material(obj='Material')"
|
|
||||||
When I press "bim.unlink_material"
|
|
||||||
Then the material "Material" is not an IFC material
|
|
||||||
|
|
||||||
Scenario: Assign material - single material
|
Scenario: Assign material - single material
|
||||||
Given an empty IFC project
|
Given an empty IFC project
|
||||||
And I add a cube
|
And I add a cube
|
||||||
|
|||||||
@@ -20,12 +20,6 @@ import blenderbim.core.material as subject
|
|||||||
from test.core.bootstrap import ifc, material, style, spatial
|
from test.core.bootstrap import ifc, material, style, spatial
|
||||||
|
|
||||||
|
|
||||||
class TestUnlinkMaterial:
|
|
||||||
def test_run(self, ifc):
|
|
||||||
ifc.unlink(obj="obj").should_be_called()
|
|
||||||
subject.unlink_material(ifc, obj="obj")
|
|
||||||
|
|
||||||
|
|
||||||
class TestAddMaterial:
|
class TestAddMaterial:
|
||||||
def test_add_a_default_material(self, ifc, material, style):
|
def test_add_a_default_material(self, ifc, material, style):
|
||||||
material.add_default_material_object("name").should_be_called().will_return("obj")
|
material.add_default_material_object("name").should_be_called().will_return("obj")
|
||||||
|
|||||||
Reference in New Issue
Block a user