THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/07/2011 at 05:24, xxxxxxxx wrote:
i've sort of worked it out in a tag instead. if you create spline, add the tag to it, then link to a mesh in the tag, the tag will modify the spline so it goes through all the vertices of the mesh. gives exactly the same result as the tracer with deforms and sweepnurbs.
one problem is that the spline disapears in the viewport sometimes.
Osfspaghetti.res:
#############################################
CONTAINER Osfspaghetti
{
NAME Osfspaghetti;
INCLUDE Obase;
GROUP ID_OBJECTPROPERTIES
{
LINK PYMESHLINK_MESH { ACCEPT {Opolygon;} }
}
}
#############################################
Osfspaghetti.h:
#############################################
#ifndef _Osfspaghetti_H_
#define _Osfspaghetti_H_
enum
{
PYMESHLINK_MESH = 10000
};
#endif
#############################################
Osfspaghetti.str:
#############################################
STRINGTABLE Osfspaghetti
{
Osfspaghetti "Spaghetti";
PYMESHLINK_MESH "Object";
}
#############################################
SF-spaghetti.pyp
#############################################
import c4d
import math
import sys
import os
from c4d import plugins, utils, bitmaps
PLUGIN_ID = 1000001
class spaghettiData(plugins.TagData) :
def Execute(self, tag, doc, op, bt, priority, flags) :
if op.GetTypeName() != "Spline":
return c4d.EXECUTIONRESULT_OK
else:
bc = tag.GetDataInstance()
mesh = bc.GetLink(c4d.PYMESHLINK_MESH)
if not mesh:
return c4d.EXECUTIONRESULT_OK
pCount = mesh.GetPointCount()
if mesh.GetDeformCache() is None:
points = mesh.GetAllPoints()
else:
points = mesh.GetDeformCache().GetAllPoints()
if pCount != op.GetPointCount() :
op.ResizeObject(pCount)
MG = mesh.GetMg()
op.SetMg(MG)
op[c4d.SPLINEOBJECT_CLOSED] = True
for i,p in enumerate(points) :
op.SetPoint(i, p)
op.Message(c4d.MSG_UPDATE)
return c4d.EXECUTIONRESULT_OK
if __name__ == "__main__":
path, file = os.path.split(__file__)
bmp = bitmaps.BaseBitmap()
bmp.InitWith(os.path.join(path, "res", "spaghetti.tif"))
plugins.RegisterTagPlugin(id=PLUGIN_ID, str="SF-spaghetti",
g=spaghettiData,
description="Osfspaghetti", icon=bmp,
info=c4d.TAG_VISIBLE|c4d.TAG_EXPRESSION)
#############################################