Awesome @m_magalhaes, works perfect now!
Thank very much!
Flavio
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 :slightly_smiling_face: !
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 :thinking_face:
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!
Thanks a lot @C4DS @m_adam !
So I think it's better to create separate CommandDataplugins to perform the same action of each button, it's less complicated and allow the user to change the keyboard shortcuts and exclude the need of the GUI being always open.
Although the m_adam suggestions may be useful for other plugins ideas I have. I'll try it later.
Thanksss !
Hello!
I'm so happy with the C4D python API, it allows to create scripts, plugins, interfaces, menus, etc, very easily!
My question is:
Is it possible to assign shortcuts to these buttons from gui.GeDialog ?
If not, I think I could achieve that by writing separate scripts to perform the same action the button does, so it appear in the customize commands window.
Thanks in advance!
Flavio