Thanks a lot @i_mazlov !
The issue is solved !

Latest posts made by FlavioDiniz
-
RE: DrawHUDText issue with viewport camera navigation
-
RE: BaseDraw.DrawTexture Issue
Fantastic @i_mazlov !
Both issues are solved, thank you so much !Cheers,
Flavio Diniz -
BaseDraw.DrawTexture Issue
Hi !
In an attempt to circumvent a bug in the DrawHUDText and DrawMultipleHUDText (link below), I'm trying to use the DrawTexture function, but now we have two issues.
(https://developers.maxon.net/forum/topic/15394/drawhudtext-issue-with-viewport-camera-navigation)1 - The first issue is the mouse cursor doesn't orbit to the object in the viewport, it's like the text is being drawn in the whole screen and the camera is orbiting around the text... I tested several Zdepth settings. no luck.
2 - The second issue is the lag, notice the difference in C4D 2023 and 2025 in the video below (problem is also present in 2024).
So far I noticed the lag (and the camera orbit issue) on the DrawHUDText, DrawMultipleHUDText and DrawTexture functions. Other simple functions like DrawPoint2D, DrawLine2D and DrawLine does't have issues.
The code I'm using on a tag is:
import c4d from c4d import plugins, bitmaps, documents def main() -> None: pass def draw(bd) -> bool: bh = c4d.plugins.BaseDrawHelp(bd, doc) bd.LineZOffset(2) bd.SetMatrix_Screen() text = "My Tex asssssssssssssssssssdasdasdt" cm = c4d.bitmaps.GeClipMap() cm.Init(0, 0, 32) cm.BeginDraw() width = cm.TextWidth(text) height = cm.TextHeight() cm.EndDraw() cm.Destroy() cm.Init(width, height, 32) cm.BeginDraw() cm.SetColor(255, 255, 255, 255) cm.TextAt(0,0,text) cm.EndDraw() bd.SetMatrix_Screen() bd.SetLightList(c4d.BDRAW_SETLIGHTLIST_NOLIGHTS) xpos=255 ypos=255 padr = [(c4d.Vector(xpos,ypos,0)), (c4d.Vector(xpos+width,ypos,0)), (c4d.Vector(xpos+width,ypos+height,0)), (c4d.Vector(xpos,ypos+height,0))] cadr = [(c4d.Vector(1,1,1)), (c4d.Vector(1,1,1)), (c4d.Vector(1,1,1)), (c4d.Vector(1,1,1))] vnadr = [(c4d.Vector(0,0,1)), (c4d.Vector(0,0,1)), (c4d.Vector(0,0,1)), (c4d.Vector(0,0,1))] uvadr = [(c4d.Vector(0,0,0)), (c4d.Vector(1,0,0)), (c4d.Vector(1,1,0)),(c4d.Vector(0,1,0))] cmbmp = bitmaps.BaseBitmap() cmbmp = cm.GetBitmap() bmp = bitmaps.BaseBitmap() bmp = cm.GetBitmap() alpha = bmp.GetInternalChannel() #Get at the RGBA channels of the bitmap copy alpha = bmp.AddChannel(True, False) bd.SetDepth(False) bd.DrawTexture(bmp,padr,cadr,vnadr,uvadr,4,c4d.DRAW_ALPHA_NORMAL,c4d.DRAW_TEXTUREFLAGS_0) return True
There's nothing special on the code, we can also see the issue with a simpler code:
import c4d def main() -> None: pass def draw(bd: c4d.BaseDraw) -> bool: bd = doc.GetActiveBaseDraw() bd.DrawHUDText(200,200,"TESTING TEXT") return c4d.DRAWRESULT_OK
I'm also attaching my C4D file:
draw_hud_text_issue2.c4dThat said, is there any working way to write text to the viewport with Python ?
Thanks in advance !
Flavio Diniz -
RE: BaseDraw.DrawHUDText in Cinema4D 2024
@ferdinand said in BaseDraw.DrawHUDText in Cinema4D 2024:
But generally speaking, no, DrawHUDText is not broken, at least not our knowledge.
Hi @ferdinand , sorry if this is an inappropriate place to post, but I should remember there's a bug on DrawHudText.
It's not related to the issue @Runner009 related, but this one: https://developers.maxon.net/forum/topic/15394/drawhudtext-issue-with-viewport-camera-navigationI just downloaded the script you provided in the post above and tested in C4D 2024.2.0, and the issue exists, not sure if it was fixed in C4D 2024.4.
Best,
Flavio Diniz -
RE: DrawHUDText issue with viewport camera navigation
I think it must be a bug ! and I'm surprised I haven't heard anyone talking about this so far, since the "DrawHUDText" is so common for people to use
I also noticed the same problem happening with "DrawMultipleHUDText".Thanks!
Flavio Diniz -
DrawHUDText issue with viewport camera navigation
Hi!
I made an script back in C4D 2023 to draw some information on the viewport (filename, camera lens, frame number, etc). It was working perfectly in C4D 2023, but in 2024 it is glitching the viewport camera navigation.
It's like the drawn text is in front of everything and when you click to orbit the camera, you click on the drawn text instead of the object.
Let me try to explain with some GIFs.
2023: I click on the corner of the cube to orbit the camera around it and it works.
2024: I click on the corner of the cube to orbit the camera and the orbit pivot insn't on the cube, but on the center of the screen.
It's not about the navigation mode, I already made sure I'm on the "mouse" mode.
When I delete the script on 2024, everything goes back to the normal, so I know the problem is the script.
and here it is, it's on a python tag:
# Playblast Overlay by Flavio Diniz import c4d def main() -> None: pass def draw(bd: c4d.BaseDraw) -> bool: bd = doc.GetActiveBaseDraw() frame = bd.GetFrame() right = frame["cr"] bottom = frame["cb"] camera = "Camera: "+ bd.GetSceneCamera(doc).GetName() filename = doc[c4d.DOCUMENT_FILEPATH].split("\\",-1)[-1] focal = str(bd.GetSceneCamera(doc)[c4d.RSCAMERAOBJECT_FOCAL_LENGTH]) +" mm" frame = "Frame: "+ str(doc[c4d.DOCUMENT_TIME].GetFrame(doc.GetFps())) bd.DrawHUDText(int(right /2)-300, int(bottom)-20, "{0} | {1} - {2} | {3}".format(filename, camera, focal, frame)) return c4d.DRAWRESULT_OK
Does anyone have any idea of what could be happening ?
Thanks!Flavio Diniz
-
RE: Get edges segments in a polygon object
Awesome @m_magalhaes, works perfect now!
Thank very much!Flavio
-
RE: Get edges segments in a polygon object
Fantastic @m_magalhaes !
works very well! and for the use I'm planning, I will always be using parallel selection segments, so cross selections isn't a issue!
there's an small error, I guess it's happening because there's no polygons to the left to be checked.
I haven't had time to fully read your code yet, but it's already very helpful!
I'll try to solve this error by modifying your code or building another use using you as base.Thank you!
(I'll let it unsolved for today, in case someone wants to post something else, then I'll change to solved)
Flavio Diniz
-
RE: Get edges segments in a polygon object
@PluginStudent @C4DS
ah, so I think this is more complex than I thoughtI guess I have to make a function to compare the edges by using their points...
if two edges shares the same point, it means these two edges are a single segment. So create a BaseSelect of these edges and use it in afor
loop.
It may cause some bugs depending how the geometry is... but at least is a starting point and a tough one for me xDThank you guys!
Flavio Diniz
-
Get edges segments in a polygon object
Hi!
I'm trying to find the selected edges segments in a polygon object, like the one below:
I want to get each segment separated, so I can create some functions like the example below:
for segment in segmentlist: MoveInUvSpace()
I've tried a lot of things with
BaseSelect
,Neighbor
andPolygonObject
classes, but no success...here's my testing code, I was able to get the total edge count, get the ammount of edges selected edges and get the the selected edge with its index.
import c4d def main(): op = doc.GetActiveObject() nb = c4d.utils.Neighbor() nb.Init(op) seledges = op.GetSelectedEdges(nb,c4d.EDGESELECTIONTYPE_SELECTION) #base select print seledges.GetSegments() print seledges.GetCount() print seledges.GetRange(1,nb.GetEdgeCount()) print "total edges", nb.GetEdgeCount() notselected = [] selectededge = [] bs = op.GetEdgeS() sel = bs.GetAll(nb.GetEdgeCount()) for index, selected in enumerate(sel): if not selected: continue print "Index", index, "is selected" selectededge.append(selected) print notselected print selected if __name__=='__main__': main()
if anyone have any hint in how I could achieve this, I would be very happy!
Flavio Diniz