WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-05-2012, 02:12 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The node.copy command will pass all extra keyword arguments to the class __init__ method. You can override the copy method in your class and have it pass all the required arguments as keyword arguments to the underlying node.copy method. Example:
Code:
import viz
viz.go()

class MyNode(viz.VizNode):

	def __init__(self, model, parameter):

		if isinstance(model,basestring):
			base = viz.add(model)
			viz.VizNode.__init__(self, base.id)

		elif isinstance(model, viz.VizNode):
			viz.VizNode.__init__(self, model.id)

		elif isinstance(model, int):
			viz.VizNode.__init__(self, model)

		self._parameter = parameter

	def copy(self, parameter):
		return viz.VizNode.copy(self,parameter=parameter)

node = MyNode('gallery.osgb',0)
nodeCopy = node.copy(1)
Does this work for you scenario?
Reply With Quote
 

Tags
inheritance, viznode


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:37 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC