I have a objectdata plugin with a cube and a bevel object as children.
I put the bevel as a child under the cube and csto it to one object that is returned by GetVirtualObjects().
But the result is not a nice bevel. It looks as if there are 2 bevels done on the cube.
Here the code that registers the objectdata plugin.
pluginstr = "MultiBevel v01"
okyn = plugins.RegisterObjectPlugin(id=PLUGIN_ID_MULTIBEVEL, str=pluginstr,
g=MULTIBEVEL,
description="multibevel", icon=icon,
info=c4d.OBJECT_GENERATOR | c4d.OBJECT_INPUT)
And here GetVirtualObjects()
def GetVirtualObjects(self, op, hierarchyhelp):
doc = op.GetDocument()
if op.GetDown() is None or op.GetDown().GetNext() is None:
#print "Less than 2 objects detected. Return Null."
return c4d.BaseObject(c4d.Onull)
res = op.GetAndCheckHierarchyClone(hierarchyhelp, op.GetDown(), c4d.HIERARCHYCLONEFLAGS_ASPOLY, True)
if res['dirty'] == False:
return res['clone']
objA = res['clone'].GetDown()
objBevel = op.GetDown().GetNext().GetClone() #get Bevel object. Not returned by GetAndCheckHierarchyClone (only polygon objects)
objBevel.InsertUnder(objA)
objList = c4d.utils.SendModelingCommand(
command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,
list = [objA],
mode = c4d.MODELINGCOMMANDMODE_ALL,
doc = doc,
flags = c4d.MDATA_CURRENTSTATETOOBJECT_INHERITANCE)
if objList == False:
print "Error Current State to object!"
return None
beveledObject = objList[0]
return beveledObject