I found a solution in other posts, and this is an video example:
Posts made by chuanzhen
-
RE: GeUserArea use DrawBitmap() to overlay multiple images(has alpha)
-
GeUserArea use DrawBitmap() to overlay multiple images(has alpha)
Hi
I drew some images in UserArea use DrawBitmap(), but when I overlaid the images, the alpha of the final drawn image was not transparent, but the color of DrawSetPen() was used. How can I make the transparent area of the overlaid image display the color of the lower layer.my code :
self.DrawSetPen(c4d.Vector(0)) self.DrawBitmap(dragbmp,x, y, width, height, 0, 0, width, height, c4d.BMP_ALLOWALPHA)
This is an example of a video where when I drag the image, the transparent area of the image turns black and the background color is not displayed:
-
RE: I want to extract the polygon index of the inverted normal
@ferdinand In the code description in the previous text, it was described as using a right-hand coordinate system, but the Python SDK doc described using a left-hand coordinate system, which I have some doubts about it.
...Cinema 4D uses a right-handed coordinate system....
-
BitmapButton not work
Hi,
I created a Bitmaobutton GUI, but the GUI only works in the right area of the image, and clicking on the left does not work。
my code:custom_gui = self.AddCustomGui(ID, c4d.CUSTOMGUI_BITMAPBUTTON, "", c4d.BFH_SCALEFIT, 0, 0, bc) custom_gui.SetImage(bitmap)
Thanks for any help!
-
Xref object Make it Editable
Hi,
There are several XRF objects in the document, and I want to implement the Make it Editable like in the XRF manager or in Object manager.This is the method I used, but the result is incorrectres = c4d.utils.SendModelingCommand( command=c4d.MCOMMAND_MAKEEDITABLE, list=xref_objs, mode=c4d.MODELINGCOMMANDMODE_ALL, bc=c4d.BaseContainer(), doc=backup_doc) for obj in res: backup_doc.InsertObject(obj)
Thanks for any help!
-
RE: Discussion on Methods for Calculating the Inner Points of a Quadrilateral
Hi @i_mazlov
Through exploring these two pages,page1,page2, I have converted them into Python code Inverse_Bilinear_Interpolation(), which can replace GetPolyPointST(). I am not sure why GetPolyPointST() may obtain incorrect values in certain situations, but Inverse_Bilinear_Interpolation() does not go wrong in complex situations.video use Inverse_Bilinear_Interpolation()
-
RE: Discussion on Methods for Calculating the Inner Points of a Quadrilateral
Hi @i_mazlov
When using GetPolyPointST(), I encountered a problem where the positions of almost equal points (with only a slight difference in numerical accuracy) resulted in significantly different U and V results.
I am studying this page seriously, and it seems that some knowledge points are beyond my scope, so I need some time to explore.The following are the position information of points a, b, c, d, and p. They only differ in accuracy, with u ≈ 0.25 and v ≈ 0.75 being the correct values .
-----The first group of points a, b, c, d, p**
Vector(-168.343, 0, 0) Vector(-33.643, -161.111, 0) Vector(168.343, 0, 0) Vector(33.643, 161.111, 0) Vector(16.822, 80.555, 0)
result
U:0.25000334744941866,V:0.7500002434367552-----The second group of points a, b, c, d, p
a --
x: -168.34254079251306
y: 2.842170943040401e-14
z: 0.0
b --
-33.643095911746244
-161.11092598042546
0.0
c --
168.34254079251275
2.842170943040401e-14
0.0
d --
33.64309591174592
161.1109259804255
0.0
p --
16.82154795587286
80.55546299021273
0.0
result:
U:0.4999999999999992, V:0.7453163657465864 -
RE: Discussion on Methods for Calculating the Inner Points of a Quadrilateral
@i_mazlov Thank you for your detailed reply, it was really helpful!
The following video shows the results, which work well. The blue polygon uses GetPolyPointST()
-
How to get screen space
Hi,
The position information of the screen space obtained using BaseView.WS() is that the upper left corner of the c4d view is the origin (x=0, y=0).How to convert it to the position of the entire computer screen?
Thanks for any help! -
RE: Discussion on Methods for Calculating the Inner Points of a Quadrilateral
@i_mazlov Thank you for your detailed reply. It has been very helpful to me. Due to being busy with other matters, I was unable to reply in a timely manner.
Before asking a question, the method I used was to continuously segment the quadrilateral and then find the block where point P is located. I will explain how it works in the image (it is approximate, not numerical):
The perspective transformation you mentioned inspired me. If I could directly transform an arbitrary quadrilateral into a standard square a'b'c'd’. Then the coordinates of point P after transformation would be the desired result value. However, I encountered a problem during the transformation. I could only determine which triangle region of abcd point P is in (abcd contains two triangle regions, abc and acd), and then perform the transformation to map it to the standard square a'b'c'd‘.
The following video is a comparison of these two calculation methods. (Gray represents the original quadrilateral, green+red represents the grid with higher density, and the results are converted into weights for easy observation. The green grid uses continuous segmentation of the quadrilateral, while the red grid uses a method to determine which triangle is inside and then convert it to a standard quadrilateral.)
-
Discussion on Methods for Calculating the Inner Points of a Quadrilateral
Hi,
In the plane, there is a quadrilateral 'abcd' and a point P. The line connecting the equal percentage segments of line ab and line dc can fill the area of the entire polygon. (The 0.25, 0.5, and 0.75 percentage segments connecting line ab and line dc, respectively, are shown in the figure below) If we fill infinitely, then there must be a line segment passing through point P. How to know what percentage of line segment passes through point P.
-
RE: After undo, point object SetAllPoints not update
@ferdinand Thanks for your help!
-
After undo, point object SetAllPoints not update
Hi,
I encountered a problem. When I set the position of an object's point, however, when I undo it and set it again, the object does not refresh in time. Only if I click on the object again and set it again will it be refreshed in time.This is the video,
-
RE: How to hide object local coordinates
@i_mazlov Is it possible to achieve the layer lock operation method by not creating a layer? It seems that the layer lock can be achieved without displaying the local coordinate axes!