Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement uniform scale for layer and mask UVs #196

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

passivestar
Copy link
Contributor

@passivestar passivestar commented Oct 10, 2024

uniformscale.mp4

ui.py Outdated Show resolved Hide resolved
@ucupumar
Copy link
Owner

ucupumar commented Oct 10, 2024

As I mentioned in the code comments, mapping transformation should still refer to the actual input values of the nodes for keyframe and driver compatiblity. Mapping is a bit special since it doesn't take any connection for layer node inputs, but all other props in ucupaint always create input entries on the layer node tree.

So to implement uniform scaling, you should set up new input on the layer node, you can see the implementation on input_outputs.py, you can check for example how layer's intensity_value becomes a node input when the layer is enabled and goes back to python prop when the layer is disabled.

Then if it's already set up you need to connect the input to mapping node scale, the code is on node_connection.py. You can check intensity_value again the see how it works. Also, since blender 2.80 and lower can't take any mapping inputs, I think this feature will only be available on Blender 2.81 and newer.

One more thing, uniform scale should not be enabled by default for old file compatibility, you can always make this enabled by default with the option preference like the enable baked outside one.

@passivestar
Copy link
Contributor Author

I see, I'll look into that

@passivestar passivestar marked this pull request as draft October 10, 2024 15:48
@passivestar passivestar marked this pull request as ready for review October 11, 2024 11:51
@ucupumar
Copy link
Owner

I just tested the latest change and I noticed that the input doesn't disappear when uniform scale is disabled. I think all other inputs exist as node inputs only when necessary. Unless there's a good reason for it, I think uniform scale value should behave the same.

@passivestar
Copy link
Contributor Author

I just tested the latest change and I noticed that the input doesn't disappear when uniform scale is disabled. I think all other inputs exist as node inputs only when necessary. Unless there's a good reason for it, I think uniform scale value should behave the same

@ucupumar should be fixed now

@ucupumar
Copy link
Owner

Just tested it, now I got this error when creating a new layer
image

@passivestar
Copy link
Contributor Author

passivestar commented Oct 11, 2024

Had to do with the logic setting the default value for the uniform checkbox triggering the update function and causing tree updates before its ready. I think it should work now

@ucupumar
Copy link
Owner

Ok, I found some driver-related bug while testing this PR, I think I need to fix it first before merging this PR.

@ucupumar
Copy link
Owner

I just fixed the issue, can you please rebase your branch again?

@ucupumar
Copy link
Owner

ucupumar commented Oct 11, 2024

Just tested this again, I'm actually thinking about transferring the driver or keyframe from uniform scale value to the mapping itself, but whatever, it's not like someone gonna use it like that, lol. I'm merging this right away, thank you again! 🫡

@ucupumar ucupumar merged commit 8ade49a into ucupumar:master Oct 11, 2024
@passivestar
Copy link
Contributor Author

True, that's a rare thing to need to animate. But it can always be improved later in any case

@passivestar passivestar deleted the uniform-scale branch October 11, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants