On 24/01/2013 at 04:40, xxxxxxxx wrote:
Maybe this does not make any sense, I don't know:)
I have an objectPlugin and I create a sphere object in GetVirtualObject. Also I have sliders (in res file) that control the radius of that sphere. Here's a code:
RADIUS = 1002
class MYPLUGIN(c4d.plugins.ObjectData) :
def __init__(self) :
self.SetOptimizeCache(True)
def Init(self, op) :
self.InitAttr(op, float, [RADIUS])
op[RADIUS] = 1.2
return True
def GetVirtualObjects(self, op, hierarchyhelp) :
doc = c4d.documents.GetActiveDocument()
myData = op.GetDataInstance()
scale = myData.GetReal(RADIUS)
baseNull = c4d.BaseObject(c4d.Onull)
sphere = c4d.BaseObject(c4d.Osphere)
sphere.InsertUnder(baseNull)
sphere.SetPhong(True, 1, utils.Rad(80.0))
sphere[c4d.PRIM_SPHERE_RAD] = scale*100
print "Virtual END"
return baseNull
Each time I change RADIUS, the GetVirtualObjects regenerates sphere object and sets that new radius value.
Is there a way to AVOID all those repetitive task in GVO such as create null, create sphere, insert it into project etc BUT only affect/change the radius of the sphere with the sliders?
I will have bunch of objects in GVO, so if I change one small slider value, all virtual objects are "regenerated" - I hope you understand what I am saying:)
I am new to python and coding in general. Sorry:)