![]() |
|
#1
|
|||
|
|||
To clarify, I have a node n:
sub_n = n.insertGroupBelow(<nodename>) So when I want to add an attribute to sub_n like: sub_n.parentNode = n I cannot access that parentNode attribute.
__________________
![]() |
#2
|
|||
|
|||
It's still not clear what the problem is. Are you getting a Python exception when trying to set an attribute? If so, what is the error? Can you post some sample code that reproduces the error?
The following code works correctly for me: Code:
model = viz.addChild('gallery.osgb') group = model.insertGroupBelow('gallery') group.myattribute = 'some value' print group.myattribute |
#3
|
|||
|
|||
Definitely. Sorry for lack of information.
The problem seems to be that when I call insertGroupBelow on a node, that group replaces the node. So here is what I'm doing: Code:
sub_instance = p.insertGroupBelow(subnode) sub_instance.parentNode = p.instanceName ''' this copies defined properties from the parent node to the sub node ''' CADParser.copyParams(p, sub_instance) sub_instance.inCollide = [] Code:
def copyParams(src,dst): dst.instanceNumber = src.instanceNumber dst.instanceName = src.instanceName dst.partNumber = src.partNumber dst.anarkParent = src src.anarkGroup = True dst.anarkGroup = True param_list = ["anarkFreeMovement" , "anarkTrans" , "anarkRotate" , "anarkRehomePos" , "anarkRehomeOri" , "anarkDependency" , "anarkColor" , "anarkAlpha" , "anarkBackface" , "anarkShader" , "anarkDescription" , "anarkImage" , "anarkModule" , "anarkLocal" , "anarkTool" , "layerSpacing" , "anarkRequires" , "anarkModRotate" , "anarkRev" ] for param in param_list: if hasattr(src, param): exec("dst." + param + " = src." + param) else: try: exec("del dst." + param) except: pass if hasattr(dst, "anarkColor"): src.color(dst.anarkColor) if hasattr(dst, "anarkShader"): if dst.anarkShader == "smoothmetal": reflect = viz.add('image2.jpg') dst.texture(reflect,'',1) dst.appearance(viz.TEXGEN,'',1) if hasattr(dst, "anarkRotate"): src.rotatingParent = dst Code:
'''Only executed when this part has been marked as being an inserted group''' print part.anarkParent
__________________
![]() |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Haptic touch texture coordinates | yth | Vizard | 0 | 06-02-2012 03:40 AM |
How do coordinates in IS900 thransform into coordinates in vizard's world | jacky | Vizard | 1 | 08-11-2011 10:44 AM |
child-objects in VRML-file all have the same coordinates | Sven | Vizard | 4 | 06-09-2010 02:07 AM |
viz.vertex coordinates | lilio | Vizard | 6 | 05-16-2009 04:36 PM |
Object rotating around world axis, not own axis | tacbob | Vizard | 1 | 02-15-2007 09:12 AM |