Skip to content

Fix for Edit PolyShape tool reverting previously merged polyshapes - #583

Merged
modrimkus-unity merged 4 commits into
masterfrom
bugfix/pbld-205-polyshape-merging
Feb 6, 2025
Merged

modrimkus-unity merged 4 commits into
masterfrom
bugfix/pbld-205-polyshape-merging

Conversation

@modrimkus-unity

Copy link
Copy Markdown
Contributor

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.]

Comment on lines +66 to +69
// Remove PolyShape component if one is present post-merge
var polyShapeComp = mesh.gameObject.GetComponent<PolyShape>();
if (polyShapeComp != null )
UndoUtility.DestroyImmediate(polyShapeComp);

Copy link
Copy Markdown
Collaborator

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 ?

Copy link
Copy Markdown
Contributor Author

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.

@katherinesheridan1 katherinesheridan1 left a comment

Copy link
Copy Markdown
Contributor

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 !!

@lopezt-unity lopezt-unity left a comment

Copy link
Copy Markdown
Collaborator

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>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove this :)

Comment on lines +35 to +36
[TestCase(typeof(PolyShape))]
[TestCase(typeof(ProBuilderShape))]

Copy link
Copy Markdown
Collaborator

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))]

Comment thread Tests/Editor/Actions/MergeObjectsTest.cs
@modrimkus-unity

Copy link
Copy Markdown
Contributor Author

@lopezt-unity updated the test 👍

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.

3 participants