THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/04/2012 at 10:46, xxxxxxxx wrote:
YES YES! I'm so happy that this is solved, thanks a lot.
I've posted the important parts of one plugin I'm working with.
It needs to get dirty info from objects in a In/Excl List so I
simply could loop them and check the sum against the stored dirty sum.
Then to bypass the potential problems using GetActiveDocument() (for not active document)
I simply treat the current frame as a dirty (Long) value and include it in
the dirty sum!
Could not be happier!
Cheers
Lennart
"""
splineGLIDE
Copyright: tcastudios 2012
Written for CINEMA 4D R13.+
Modified Date: 2012xxxx
"""
import c4d
import os
import webbrowser as w
from c4d import plugins, utils as u, bitmaps, Vector as v, documents
from c4d.utils import SplineHelp, SplineLengthData
PLUGIN_ID = 1028358 # PLUGIN ID registered by tcastudios. IF YOU MAKE ANY EDITS YOU MUST GET A NEW PLUGIN ID FROM plugincafe.com!!
DIRTYSUM = 1027373 # Unique ID from plugincafe.com registered by tcastudios.com (PCLUSTER_MEMO)
class sGLIDE(plugins.ObjectData) :
"""splineGLIDE Generator"""
def Init(self, sglide) :
data = sglide.GetDataInstance()
data.SetReal(c4d.SG_MIX,1.0) # Mix Float
data.Set etc……
return True
def CheckDirty(self,op,doc) :
obc = op.GetDataInstance()
dirtysumbc = obc.GetContainer(DIRTYSUM)
dlist = obc.GetData(c4d.SG_SOURCES) #InExclude List objects to get dirty from
lcount = dlist.GetObjectCount()
checksum = doc.GetTime().GetFrame(doc.GetFps()) # Use frame as a dirty integer (Long)
for d in xrange(lcount) :
checksum += dlist.ObjectFromIndex(None ,d ).GetDirty(c4d.DIRTY_DATA|c4d.DIRTY_MATRIX |c4d.DIRTY_CHILDREN|c4d.DIRTY_CACHE|c4d.DIRTY_SELECT)
if (checksum != dirtysumbc.GetLLong(0)) :
dirtysumbc.SetLLong(0,checksum)
obc.SetData(DIRTYSUM,dirtysumbc) # Store new checksum into Container
def Construct(self,sglide) :
sbc = sglide.GetDataInstance()
myfader = sbc.GetReal(c4d.SG_MIX)
myetc = sbc.Get etc etc
myspline =
myspline = c4d.BaseObject(c4d.Ospline)
# code that do things with spline from In/Excl List objects
return myspline
def GetContour(self, sglide, doc, lod, bt) :
return self.Construct(sglide)
if __name__ == "__main__":
path, file = os.path.split(__file__)
bmp = bitmaps.BaseBitmap()
bmp.InitWith(os.path.join(path, "res", "splineGLIDE.tif"))
splineGLIDELoaded = plugins.RegisterObjectPlugin(id=PLUGIN_ID,
str="splineGLIDE",
g=sGLIDE,
description="splineGLIDE",
icon=bmp,
info=c4d.OBJECT_GENERATOR | c4d.OBJECT_ISSPLINE )
if splineGLIDELoaded:
print 'splineGLIDE v1 Loaded'
edit: Don't need to set checksum again for the op.