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 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.
Hi,
I would like to know if we can quickly obtain a polygon corresponding to a selection.
I manage to do it in python, but for the large meshes it's much too slow, because I do treatments on the indices of points and faces.
Below, with python, I create two polygons with the corresponding material, for the two selections (selection_1 and selection_2)
For a large mesh (greater than 100 Mo), the use of indices for points and faces considerably slows down the program.
We see that the initial polygon has been divided correctly, according to the two selections
Thank you.
I had forgotten about this excellent feature of C4D.
It must be said that I rarely do plugins, because now C4D can do a lot of things.
Hi,
I have another problem that looks a bit like my previous post.
Now for each tag (type 5616), I want to know the name of the associated selection, if it exists.
Could you put the correct code in place of the dotted lines
tag = obj.GetFirstTag()
while tag:
if tag.GetType() == 5616: #texture tag
#name of tag
print tag.GetMaterial().GetName()
#name of the associated selection, if it exists
...
...
...
tag = tag.GetNext()
Thanks for your quick replies
I used GetBaseSelect() which allowed me to have the selected faces for each selection
list_polygon = obj.GetAllPolygons()
dim = len(list_polygon)
L = []
tag = obj.GetFirstTag()
while tag:
if tag.GetType() == c4d.Tpolygonselection:
sel = tag.GetBaseSelect()
L2 = []
for i in range(0,dim):
if sel.IsSelected(i):
L2.append(i)
L.append([tag.GetName(),L2])
tag = tag.GetNext()
for item in L:
print item[0]
print item[1]