How can I rotate just the selected polygons (or points) of an object?
I solved it for points, so polygons should be possible too.
from c4d import gui
def rot_points(obj, new_axis):
mat = ~new_axis * obj.GetMl()
points = obj.GetAllPoints()
bs = op.GetPointS()
sel = bs.GetAll(op.GetPointCount())
for index, selected in enumerate(sel):
if not selected:
points[index] = points[index] * mat
# Main function
mat = op.GetMl() * c4d.utils.MatrixRotX(c4d.utils.Rad(45))
# Execute main()
although you marked this already as solved, I'd just like to clarify one point.
There is no such thing as rotating polygons. Polygons are just made up of points (or rather point indexes), with the edges being implicitly defined by the order of points in a CPolygon. So rotating a polygon boils down to rotating the points involved in this polygon.
Ok, so I have to rotate the points to rotate a polygon.
I thought so. That is why I assumed that when I can rotate points, I can rotate polygons.