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

Ability to duplicate materials #131

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

jake-goldsmith
Copy link
Contributor

Resolves #86

Adds a button in the MaterialWidget shown in the object inspector to duplicate the current material so its properties can be changed without affecting all objects using the same material. The user is prompted to enter a name for the new material.

Edge cases checked:

  • Material name already exists
  • Material names are filenames so check there are no illegal characters
  • Prevents file separators being added as filenames.

Other changes:

  • Fixed a bug where when duplicating objects the materials ObjectMap in the PickableModelComponent and ModelComponent was assigned by reference rather than deep-copied so changing the materials on a duplicate item changed all of its duplicates materials too.

Usage:

  1. To set up the scenario I have duplicated the Ship. In the MaterialWidget click "duplicate" to duplicate the material.

demo1

2 Enter the desired name:

demo2

  1. The duplicate material is created with the same properties as the original material. Changes can be made to its properties which only affect the new material. The new material asset is shown in the assets widget.

demo3

Todo:

  • Add automated tests. I need to do more research into how we could write good tests using this UI framework so will have to take a look into that later.

Copy link
Owner

@JamesTKhan JamesTKhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it out and everything looks good, nice work. Thank you!

@JamesTKhan JamesTKhan merged commit de28853 into JamesTKhan:master Jan 17, 2023
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.

Ability to duplicate materials
3 participants