Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getScene(){
- return new oScene();
- }
- function oScene(){
- }
- Object.defineProperty(oScene.prototype, 'nodes', {
- get : function(){
- var _nodes = node.subNodes("Top");
- for (var i in _nodes){
- _nodes[i] = new oNode(_nodes[i])
- }
- return _nodes
- }
- })
- oScene.prototype.$node = function(fullPath){
- return new oNode(fullPath)
- }
- oScene.prototype.getNodeByName = function(fullPath){
- return new oNode(fullPath)
- }
- function oNode(path){
- this.fullPath = path;
- }
- Object.defineProperty(oNode.prototype, 'name', {
- get : function(){
- return node.getName(this.fullPath)
- },
- set : function(newName){
- var _parent = node.parentNode(this.fullPath)
- var _node = node.rename(this.fullPath, newName)
- this.fullPath = _parent+'/'+newName;
- }
- })
- function run(){
- var scene = getScene();
- var nodes = scene.nodes;
- for (var i in nodes){
- MessageLog.trace(nodes[i].name)
- }
- var myNode = scene.$node("Top/Drawing")
- myNode.name = 'newName'
- MessageLog.trace(myNode.name)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement