From 4766ed21a68230c0c15265e5604a74f4d99e0f5d Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sat, 7 Dec 2013 13:48:55 +0100 Subject: [PATCH] Nasal: use new built-in props.Node.removeAllChildren() This require less interaction between Nasal and C++ and also does not need to create a list of removed children which was not used anyway. Now it require about 70% less time to execute. --- Nasal/props.nas | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Nasal/props.nas b/Nasal/props.nas index 4af9b363a..cdef43256 100644 --- a/Nasal/props.nas +++ b/Nasal/props.nas @@ -10,15 +10,16 @@ # available in C++; just use node.getNode(path).whatever() instead. # var Node = { - getNode : func wrap(_getNode(me._g, arg)), - getParent : func wrap(_getParent(me._g, arg)), - getChild : func wrap(_getChild(me._g, arg)), - getChildren : func wrap(_getChildren(me._g, arg)), - addChild : func wrap(_addChild(me._g, arg)), - addChildren : func wrap(_addChildren(me._g, arg)), - removeChild : func wrap(_removeChild(me._g, arg)), - removeChildren : func wrap(_removeChildren(me._g, arg)), - getAliasTarget : func wrap(_getAliasTarget(me._g, arg)), + getNode : func wrap(_getNode(me._g, arg)), + getParent : func wrap(_getParent(me._g, arg)), + getChild : func wrap(_getChild(me._g, arg)), + getChildren : func wrap(_getChildren(me._g, arg)), + addChild : func wrap(_addChild(me._g, arg)), + addChildren : func wrap(_addChildren(me._g, arg)), + removeChild : func wrap(_removeChild(me._g, arg)), + removeChildren : func wrap(_removeChildren(me._g, arg)), + removeAllChildren: func wrap(_removeAllChildren(me._g, arg)), + getAliasTarget : func wrap(_getAliasTarget(me._g, arg)), getName : func _getName(me._g, arg), getIndex : func _getIndex(me._g, arg), @@ -53,12 +54,6 @@ var Node = { if((var p = me.getParent()) == nil) return nil; p.removeChild(me.getName(), me.getIndex()); }, - - removeAllChildren : func { - foreach(var c; me.getChildren()) - me.removeChild(c.getName(), c.getIndex()); - return me; - }, }; ##