I found the solution (I already had this problem but I couldn't remember the right code)
mat [c4d.MATERIAL_TRANSPARENCY_COLOR] = c4d.Vector (1.0, 1.0, 1.0) #color white
mat.Update (True, True)
I found the solution to my problem, on the internet, with code samples:
I made this function which works fine:
def spline_update(doc,spline,tabNewPoint): tabPoint = spline.GetAllPoints() dim = len(tabNewPoint) if len(tabPoint) != dim: spline.ResizeObject(dim) for i in range(0,dim): point = tabNewPoint[i] spline.SetPoint(i,point) spline.Message(c4d.MSG_UPDATE) return spline
How to update a spline if the number of points changes ?
If the number of points is the same, we can use the following function:
def spline_update(spline,tabPoint): dim = len(tabPoint) for i in range(0,dim): spline.SetPoint(i,tabPoint[i]) spline.Message(c4d.MSG_UPDATE) return spline
If the number of points changes, we must use the ResizeObject() method
I'm looking for an example, which will save me from doing tests.
With a script, I create a large number of objects in my scene.
In the hierarchy, they are presented in the form of a list, which becomes difficult to read because it's too long.
So I want to put the names of the child objects under the name of the root object.
How can I do this ?
def hierarchie_organise(doc, object_root, list_object): # document name: doc # object root: object_root # child objects: list_object # checking (exclusion of the root object if it's in the list of child objects) list_child =  for object in list_object: if object != object_root: list_child.append(object) # positioning of list_child objects under the object_root object ... ... ... return
Thanks, it works well
My first method was complex:
I want to do a rotation for a polynone.
I know the coordinates of the points of the polygon, in the global coordinate system.
For this rotation, I know the axis of rotation, defined by a vector V, and the angle of rotation A with respect to this axis.
I manage to do this type of rotation, with matrices and with a change of Cartesian coordinate system, but I know that there is a much simpler method with C4D python functions
Indeed, with SendModelingCommand it would be faster.
I don't remember how we visualize with C4D the python code corresponding to the actions of the keyboard and the mouse.