Navigation

    • Register
    • Login
    • Search
    1. Home
    2. Kantronin
    Kantronin

    Kantronin

    @Kantronin

    2
    Reputation
    26
    Posts
    42
    Profile views
    0
    Followers
    3
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    Kantronin Follow

    Best posts made by Kantronin

    RE: Transparency channel - Color update

    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)

    posted in Cinema 4D SDK •
    RE: How to create a layer Reflection (Legacy) ?

    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/

    posted in Cinema 4D SDK •

    Latest posts made by Kantronin

    Remove points from a polygon

    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 ?

    posted in General Talk •
    Creation of UVW tag for a plane

    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.

    pic.jpg

    posted in Cinema 4D SDK •
    RE: Rotation for polygon

    @ferdinand

    Thanks, it works well

    My first method was complex:

    • creation of a new orthogonal spatial system, with one of its axes is identical to the axis of rotation
    • compute the coordinates of the points of the object in this new spatial system, then rotate the object
    • calculation of the new coordinates in the initial orthogonal spatial system.
    posted in Cinema 4D SDK •
    Rotation for polygon

    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

    posted in Cinema 4D SDK •
    RE: Polygon corresponding to a selection

    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.

    posted in Cinema 4D SDK •
    RE: Polygon corresponding to a selection

    @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.

    posted in Cinema 4D SDK •
    Polygon corresponding to a selection

    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.

    img1.jpg

    We see that the initial polygon has been divided correctly, according to the two selections

    img2.jpg

    posted in Cinema 4D SDK •
    RE: Selection associated with a texture tag

    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.

    posted in Cinema 4D SDK •
    Selection associated with a texture tag

    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

    alt text

    	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()
    
    posted in Cinema 4D SDK •
    RE: Face associated with a selection

    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]
    
    posted in Cinema 4D SDK •