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

Cleanup #24181

Merged
merged 5 commits into from
Jun 3, 2022
Merged

Cleanup #24181

merged 5 commits into from
Jun 3, 2022

Conversation

LeviPesin
Copy link
Contributor

@LeviPesin LeviPesin commented Jun 2, 2022

Related issue: #24047 (comment)

Description

This PR does many cleanup:

  • Fix remaining LGTM Recommendations issues,
  • Run npm run lint-fix (and fix it),
  • Remove prototype accesses except in test directory and animation system (mostly it is just function -> class transformation).

@LeviPesin
Copy link
Contributor Author

Also, is CameraControls even used anymore? It seems to be very similar to OrbitControls.

@mrdoob mrdoob added this to the r142 milestone Jun 3, 2022
@mrdoob mrdoob merged commit cac2e49 into mrdoob:dev Jun 3, 2022
@mrdoob
Copy link
Owner

mrdoob commented Jun 3, 2022

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Jun 3, 2022

Also, is CameraControls even used anymore? It seems to be very similar to OrbitControls.

I always thought it was over-engineered... I think we can remove it.

Material.prototype.copy.call( pointsMaterial, material );
pointsMaterial.color.copy( material.color );
pointsMaterial.map = material.map;
pointsMaterial.copy( material );
Copy link
Collaborator

@Mugen87 Mugen87 Jun 3, 2022

Choose a reason for hiding this comment

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

I don't think this line of code is right. Material.prototype.copy.call( pointsMaterial, material ); only executes the copy() method of the Material class whereas pointsMaterial.copy( material ); executes PointsMaterial.copy(). However, this will lead to undefined material properties if the given material is not of type PointsMaterial.

So using Material.prototype.copy() was done on purpose. /cc @donmccurdy

Copy link
Collaborator

@Mugen87 Mugen87 Jun 3, 2022

Choose a reason for hiding this comment

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

Remove prototype accesses

Like I said before, prototype access is not evil per se. At some places, it does make sense and a refactoring is not really required. I think we should only do such changes if they generate an additional value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes – I'm using Material.prototype.copy as the common denominator to copy properties that can be shared between PointsMaterial and other material types here. Errors can be thrown if the copy method tries to access methods on a Color property that isn't there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, reverted this change:
#24190

@LeviPesin LeviPesin deleted the cleanup branch June 3, 2022 08:38
LeviPesin added a commit to LeviPesin/three.js-1 that referenced this pull request Jun 3, 2022
Mugen87 pushed a commit that referenced this pull request Jun 3, 2022
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* Cleanup

* Fix one super()

* Fix another super()

* Cleanup webgpu_sprites

* Return lost lint line
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
snagy pushed a commit to snagy/three.js-1 that referenced this pull request Sep 21, 2022
* Cleanup

* Fix one super()

* Fix another super()

* Cleanup webgpu_sprites

* Return lost lint line
snagy pushed a commit to snagy/three.js-1 that referenced this pull request Sep 21, 2022
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.

None yet

4 participants