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
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
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
Awesome @m_magalhaes, works perfect now!
Thank very much!
Flavio
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
@PluginStudent @C4DS
ah, so I think this is more complex than I thought
I 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 a for
loop.
It may cause some bugs depending how the geometry is... but at least is a starting point and a tough one for me xD
Thank you guys!
Flavio Diniz
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
and PolygonObject
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
@indexofrefraction I know this is not what you've asked, but it might help you:
Redshift does have a method of subdivision called screen space adaptive, which make more subdivisions on polygons that are close to the camera and less to those that are far from the camera. So it relatively lightweight because it happen only at render time and still bring good results.
@indexofrefraction I was experimenting this exactly right now!
I'm sure it's not done in the most optimized way, but it does return a beautiful quad polygon, here is:
import c4d
def main():
poly = c4d.PolygonObject(4,1)
a = c4d.CPolygon(0,1,2,3)
poly.SetPolygon(0,a)
poly.SetPoint(0, c4d.Vector(0,0,0))
poly.SetPoint(1, c4d.Vector(50,0,0))
poly.SetPoint(3, c4d.Vector(0,0,-50))
poly.SetPoint(2, c4d.Vector(50,0,-50))
return poly
edit: this is just for generating a polygon, I don't know how to make parametric subdivisions on it.
@Cairyn said in Close any C4D Window:
That's because there is none. The Windows functionality in the API is very limited. You can open some through CallCommand but identification and handling of specific windows is not supported.
Only thing you could do is loading a new layout.
I was afraid of that answer
But thank you anyway
Hi !
Is it possibly to close any Cinema4D window like the ones below by using python ?
I've tried acessing this command, but I had no success, because I didn't find anything on the python API to get C4D windows...
Thanks!