def test_adding_texture_style_if_not_available(self, ifc, style): ifc.get_entity("obj").should_be_called().will_return("element") style.can_support_rendering_style( "obj").should_be_called().will_return(False) style.get_surface_shading_style("obj").should_be_called().will_return( "style") style.get_surface_shading_attributes( "obj").should_be_called().will_return("attributes") ifc.run("style.edit_surface_style", style="style", attributes="attributes").should_be_called() style.get_surface_texture_style("obj").should_be_called().will_return( None) style.can_support_texture_style("obj").should_be_called().will_return( True) style.get_surface_textures("obj").should_be_called().will_return( "textures") ifc.run( "style.add_surface_textures", textures="textures").should_be_called().will_return("ifc_textures") ifc.run( "style.add_surface_style", style="element", ifc_class="IfcSurfaceStyleWithTextures", attributes={ "Textures": "ifc_textures" }, ).should_be_called() subject.update_style_colours(ifc, style, obj="obj")
def test_updating_rendering_style_if_available(self, ifc, style): ifc.get_entity("obj").should_be_called().will_return("element") style.can_support_rendering_style( "obj").should_be_called().will_return(True) style.get_surface_rendering_style( "obj").should_be_called().will_return("style") style.get_surface_rendering_attributes( "obj").should_be_called().will_return("attributes") ifc.run("style.edit_surface_style", style="style", attributes="attributes").should_be_called() style.get_surface_texture_style("obj").should_be_called().will_return( None) style.can_support_texture_style("obj").should_be_called().will_return( False) subject.update_style_colours(ifc, style, obj="obj")
def _execute(self, context): core.update_style_colours(tool.Ifc, tool.Style, obj=context.active_object.active_material)