Member kritskiy Posted October 18, 2024 Member Share Posted October 18, 2024 (edited) I think my issue comes from the fact that the value in the tree (that's also output by .getPolycount() is not the same as the initial value in the Resample dialog: So when I run this I'm getting a wrong result. active_element = coat.Scene.current() vol = active_element.Volume() active_polycount = vol.getPolycount() target_polycount = 50000 resample_scale = math.sqrt(target_polycount / active_polycount) # prints out current polycount: 176; resample_scale: 16.85499656158105, the resulting polycount is at 12k print(f"current polycount: {active_polycount}; resample_scale: {resample_scale}") def ui_command(): coat.ui.setSliderValue("$ResampleParams::ResamplingScale", resample_scale) coat.ui.setEditBoxValue("$ResampleParams::RequiredPolycount", target_polycount) # this seems to be completely ignored coat.ui.cmd("$DialogButton#1") coat.ui.cmd("$Resample", ui_command) If I manually put 41 as active_polycount, the resampling is correct. So my question is, how do I get this "initial polycount" value, 41 ? Or maybe how can I use $ResampleParams::RequiredPolycount instead of ResamplingScale ? Putting any value in it doesn't seem to change anything CC @Andrew Shpagin Edited October 18, 2024 by kritskiy Quote Link to comment Share on other sites More sharing options...
Member kritskiy Posted October 18, 2024 Author Member Share Posted October 18, 2024 Oh, this works. But this seems... weird and wrong? def ui_command(): initial_polygon = int(coat.ui.getEditBoxValue('$ResampleParams::RequiredPolycount')) resample_scale = math.sqrt(target_polycount / initial_polygon) coat.ui.setSliderValue("$ResampleParams::ResamplingScale", resample_scale) coat.ui.cmd("$DialogButton#1") coat.ui.cmd("$Resample", ui_command) Quote Link to comment Share on other sites More sharing options...
Carlosan Posted October 18, 2024 Share Posted October 18, 2024 As I remember that issue was solved on version 27 Quote Link to comment Share on other sites More sharing options...
Member kritskiy Posted October 18, 2024 Author Member Share Posted October 18, 2024 (edited) I'm on 2024.27 though (forgot to mention, sorry) Edited October 18, 2024 by kritskiy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.