refactor copy() and duplicateObject() to work with duplicating tree nodes

git-svn-id: https://farcry.jira.com/svn/FC/trunk@12909 8f7d33b6-1012-0410-9a5a-bb7ecce9c363
fix small tree manipulation issues

git-svn-id: https://farcry.jira.com/svn/FC/trunk@12910 8f7d33b6-1012-0410-9a5a-bb7ecce9c363