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 = []
The meat of the copyParams code looks like this:
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
In another module, when I've got the handle on one of these groups created with the insertGroupBelow, I get an exception when trying to access a parameter like:
Code:
'''Only executed when this part has been marked as being an inserted group'''
print part.anarkParent
I get an exception saying that the attribute does not exist.