Hi @ferdinand,
Apologies for the lack of context earlier. I didn’t mean that it returns null, but rather that it returns an object inside a null container. When I try to modify the scale of the resulting object, this behavior persists. I’ve noticed a similar pattern when working with Python generators.
import c4d
from c4d import utils
def Cube():
obj = c4d.PolygonObject(8, 6)
obj.SetPoint(0, c4d.Vector(-100.0,-100.0,-100.0))
obj.SetPoint(1, c4d.Vector(-100.0,100.0,-100.0))
obj.SetPoint(2, c4d.Vector(100.0,-100.0,-100.0))
obj.SetPoint(3, c4d.Vector(100.0,100.0,-100.0))
obj.SetPoint(4, c4d.Vector(100.0,-100.0,100.0))
obj.SetPoint(5, c4d.Vector(100.0,100.0,100.0))
obj.SetPoint(6, c4d.Vector(-100.0,-100.0,100.0))
obj.SetPoint(7, c4d.Vector(-100.0,100.0,100.0))
polygon1 = c4d.CPolygon( 3,2,0,1)#front
polygon2 = c4d.CPolygon( 5,4,2,3)#left
polygon3 = c4d.CPolygon( 7,6,4,5)#back
polygon4 = c4d.CPolygon( 1,0,6,7)#right
polygon5 = c4d.CPolygon( 2,4,6,0)#down
polygon6 = c4d.CPolygon( 5,3,1,7)#up
obj.SetPolygon(0, polygon1)
obj.SetPolygon(1, polygon2)
obj.SetPolygon(2, polygon3)
obj.SetPolygon(3, polygon4)
obj.SetPolygon(4, polygon5)
obj.SetPolygon(5, polygon6)
polygon_count = obj.GetPolygonCount()
uvw_tag = obj.MakeVariableTag(c4d.Tuvw,polygon_count)
for i in range(uvw_tag.GetDataCount()):
uvwdict = uvw_tag.GetSlow(i)
p1 = c4d.Vector(1,0,0)
p2 = c4d.Vector(1,1,0)
p3 = c4d.Vector(0,1,0)
p4 = c4d.Vector(0,0,0)
uvw_tag.SetSlow(i, p1, p2, p3, p4)
obj.SetPhong(True, 1, utils.Rad(40.0))
obj.Message(c4d.MSG_UPDATE)
return obj
def main():
obj = Cube()
scale = 2
obj[c4d.ID_BASEOBJECT_REL_SCALE,c4d.VECTOR_X] = scale
obj[c4d.ID_BASEOBJECT_REL_SCALE,c4d.VECTOR_Y] = scale
obj[c4d.ID_BASEOBJECT_REL_SCALE,c4d.VECTOR_Z] = scale
return obj
I’d like to understand why this behavior occurs, and— as I mentioned earlier— if there's a way to define custom behavior for CTSO within a plugin. Once again, sorry for the confusion caused by my previous message.
Just to clarify, modifying the polygon's scale by adjusting its vertices is not an option, since I want the polygon to be generated with those specific attributes already modified.
Thanks for your support,
James H.