Hi,
@Cairyn
Actually your answer was correct. For an ObjectData
plugin you need to set the flags OBJECT_GENERATOR
and OBJECT_ISSPLINE
upon registration, to tell Cinema that is should poll GetContour
and not GetVirtualObjects
for building the cache of the object.
@topic
As pointed out, this a shortcoming of the Python Generator Object, which is basically treated like a GetVirtualObjects
method. However, if implementing a whole plugin seems out of the question, you could use a Python Scripting Tag, ignore are all warnings and fiddle with the cache of the Python Generator Object, extract whatever spline data is in there and link it to your wrap deformer. Below you will find a simple example for how you would do that.
The Python Scripting Tag:
""" Put this into a Python Scripting Tag.
The Python Scripting Tag needs to be attached to the Spline Wrap Deformer,
which is meant to be driven by a Python Generator Object. The script
requires the tag to have a BaseLink as its first user data element, linking
to the Python Generator Object.
Note:
This is not by any means an intended use of the Cinema API. The major
problem is that messing with the cache of the generator by
linking it back into the document is a big No-No. Although I think you
are here on the safe side, it might cause Cinema 4D to crash or worse -
silently corrupt the document. THIS IS A HACK - you have been warend.
Also might casue little kittens to be very sad.
"""
import c4d
def main():
"""
"""
# The Python scripting tag needs a BaseLink element linking to the
# Python generator object as its first user data element.
source = op[c4d.ID_USERDATA, 1]
deformer = op.GetObject()
# Sort out some invalid inputs
if not isinstance(source, c4d.BaseObject):
return
if not isinstance(deformer, c4d.C4DAtom):
return
if not deformer.CheckType(c4d.Owrap):
return
# Get the cache of the Python generator node, prefering the deformed
# cache over the static cache.
cache = source.GetDeformCache() or source.GetCache()
# Set the cache as the MGSPLINEWRAPDEFORMER_SPLINE attribute of the
# wrap deformer, given that there is a cache.
if cache:
deformer[c4d.MGSPLINEWRAPDEFORMER_SPLINE] = cache
The Python Generator object I did use:
import c4d
def main():
return c4d.BaseObject(c4d.Osplinecircle)
Cheers,
zipit