-
-
Notifications
You must be signed in to change notification settings - Fork 58
Add layer mask duplication operator #275
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
base: master
Are you sure you want to change the base?
Conversation
0c860cf to
2b1c19e
Compare
This reverts commit 2b1c19e.
|
Oh yeah, I don't realize that you can just create a new mask with all properties copied from the original mask. I thought duplicating a mask is similar to duplicating a layer, which actually copies the node manually. Okay, I'll test this later. Thanks for the PR! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some comments on the implementation, maybe you can address those. Nice work otherwise! 👍
| ) | ||
|
|
||
| # Copy extra float/vector properties | ||
| new_mask.intensity_value = mask.intensity_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying the intensity_value property directly won't use the updated value that the original mask actually uses. The property only stores the value only when the mask is disabled. This is because ucupaint prioritizes the value that actually exists as node input in the material rather than the one on the python property. Ucupaint always deletes unnecessary nodes and inputs when no entity is using them, so it's for optimization purposes.
You can use get_entity_prop_value and set_entity_prop_value functions to get and set the entity property. Those will guarantee use the correct value. You learn what those functions do in common.py
I hope that's not too confusing, please ask me if you have any questions.
| mask_type=mask.type, | ||
| texcoord_type=mask.texcoord_type, | ||
| uv_name=mask.uv_name, | ||
| image=image, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's should be an option to duplicate packed images, like on Duplicate Layer operator
| new_mask.intensity_value = mask.intensity_value | ||
|
|
||
| # Transform | ||
| new_mask.translation = mask.translation[:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For transformation, it's a bit different to copy the values, you need to get the mapping node from the original mask and copy the values to the new mapping node
| new_mask.blur_vector_factor = mask.blur_vector_factor | ||
|
|
||
| # Decal projection distance | ||
| new_mask.decal_distance_value = mask.decal_distance_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one also should use get_entity_prop_value and set_entity_prop_value
Initial version of the layer mask duplication operator. The feature is currently functional but incomplete.
Known issues:
CLOSES #153