mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
test for tool.Blender.copy_node_graph #3876
This commit is contained in:
@@ -38,7 +38,7 @@ VIEWPORT_ATTRIBUTES = [
|
||||
]
|
||||
|
||||
|
||||
class Blender:
|
||||
class Blender(blenderbim.core.tool.Blender):
|
||||
OBJECT_TYPES_THAT_SUPPORT_EDIT_MODE = ("MESH", "CURVE", "SURFACE", "META", "FONT", "LATTICE", "ARMATURE")
|
||||
OBJECT_TYPES_THAT_SUPPORT_EDIT_GPENCIL_MODE = ("GPENCIL",)
|
||||
|
||||
|
||||
@@ -15,3 +15,32 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
from test.bim.bootstrap import NewFile
|
||||
from blenderbim.tool.blender import Blender as subject
|
||||
|
||||
|
||||
class TestImplementsTool(NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.Blender)
|
||||
|
||||
|
||||
class TestCopyNodeGraph(NewFile):
|
||||
def test_run(self):
|
||||
material_to = bpy.data.materials.new("material_to")
|
||||
material_to.use_nodes = True
|
||||
material_to_nodes = material_to.node_tree.nodes
|
||||
assert len(material_to_nodes) == 2
|
||||
for node in material_to_nodes:
|
||||
material_to_nodes.remove(node)
|
||||
assert len(material_to_nodes) == 0
|
||||
|
||||
material_from = bpy.data.materials.new("material_from")
|
||||
material_from.use_nodes = True
|
||||
|
||||
subject.copy_node_graph(material_to, material_from)
|
||||
assert len(material_to_nodes) == 2
|
||||
|
||||
Reference in New Issue
Block a user