+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.tools;\r
-\r
-import java.util.ArrayList;\r
-\r
-import com.jme.scene.Node;\r
-import com.jme.scene.Spatial;\r
-\r
-public class ScenegraphLockTraverser {\r
- Node root;\r
- boolean lock;\r
- public ScenegraphLockTraverser(Node root, boolean lock) {\r
- this.root = root;\r
- this.lock = lock;\r
- lock(root);\r
- }\r
- \r
- private void lock(Spatial spatial) {\r
- if (lock)\r
- spatial.lock();\r
- else\r
- spatial.unlock();\r
- if (spatial instanceof Node) {\r
- Node node = (Node)spatial;\r
- ArrayList<Spatial> children = node.getChildren();\r
- for (Spatial s : children) {\r
- s.lock();\r
- lock(s);\r
- }\r
- }\r
- \r
- }\r
-}\r