-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fix for Edit PolyShape tool reverting previously merged polyshapes #583
base: master
Are you sure you want to change the base?
Conversation
// Remove PolyShape component if one is present post-merge | ||
var polyShapeComp = mesh.gameObject.GetComponent<PolyShape>(); | ||
if (polyShapeComp != null ) | ||
UndoUtility.DestroyImmediate(polyShapeComp); |
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 we should also remove ProBuilderShape Components when merging 2 PB objects (2 PBShapes or one PBShape + PolyShape) because it does not make sense either to have access to the shape parameters anymore in that case, right ?
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.
@lopezt-unity Good point! Added this in d00e0b4. Test also updated.
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.
Works great on my end !!
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.
LGTM,
Adding some comments to make tests improvements but nothing blocking here :D
m_mesh1 = ShapeFactory.Instantiate<Cube>(); | ||
m_mesh2 = ShapeFactory.Instantiate<Cone>(); | ||
m_mesh3 = ShapeFactory.Instantiate<Cylinder>(); | ||
m_mesh1.gameObject.AddComponent<BoxCollider>(); |
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.
Remove this :)
[TestCase(typeof(PolyShape))] | ||
[TestCase(typeof(ProBuilderShape))] |
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.
Maybe try to change this for something like:
[TestCase(typeof(PolyShape),typeof(PolyShape))]
[TestCase(typeof(ProBuilderShape),typeof(ProBuilderShape))]
[TestCase(typeof(ProBuilderShape),typeof(PolyShape))]
ActiveEditorTracker.sharedTracker.ForceRebuild(); | ||
|
||
var mergeObjectsAction = new MergeObjects(); | ||
var newMeshes = mergeObjectsAction.DoMergeObjectsAction(); |
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.
Maybe just add an assert on newMeshes.Count == 1
?
Purpose of this PR
PR fixes issue where merging two or more polyshape objects would not remove the PolyShape component resulting in issue down the line when
Edit PolyShape
tool would be activated.Links
Jira: https://jira.unity3d.com/browse/PBLD-205
Comments to Reviewers
[List known issues, planned work, provide any extra context for your code.]