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 (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:
https://www.c4dcafe.com/ipb/forums/topic/101805-materials-and-shaders-with-python/
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
Hi
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.
I found the solution on https://plugincafe.maxon.net/
It was enough in the for loop to add the following line of code:
for object in list_object:
if object != object_root:
object.InsertUnder(object_root)
c4d.EventAdd()
Hi,
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
True
I have created a function that adds points to a polygon.
But how to remove a point from a polygon, as well as remove the faces that contain it ?
Creation of UVW tag for a plane
I would like to know how to create texture coordinates for a plane, with python.
So I want to create with python the basic UVW tag for a plan.
I would like to get the same result as with Bodypaint.
Thanks, it works well
My first method was complex:
Hi,
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
I am going to write a new script, using c4d.CallCommand and c4d.utils.SendModelingCommand which can do the same thing much faster.
The Script log window presents the code very well, in real time, for many operations.
@cairyn said in Polygon corresponding to a selection:
SendModelingCommand
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.