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 from Cakes LayeredPortrait PR #2198

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jowan-Spooner
Copy link
Collaborator

  • lot's of static typing and whitespace improvements
  • small adjustments to existing scripts

All credit goes to @CakeVR !
I just did this to make reviewing the core parts of the PR easier.

- lot's of static typing and whitespace improvements
- small adjustments to existing scripts
@Jowan-Spooner Jowan-Spooner added the Enhance ⚡ Improve a feature's workflow. label Apr 22, 2024
@Jowan-Spooner Jowan-Spooner marked this pull request as draft April 26, 2024 10:42
Copy link
Contributor

@Pheubel Pheubel left a comment

Choose a reason for hiding this comment

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

decided to give some input

%RealPreviewPivot.add_child(current_previewed_scene)

if current_previewed_scene != null:
if not current_previewed_scene == null:
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be turned into if current_previewed_scene: and it should still function the same. If it is done this way to make it more clear, i find that the earlier version reads better in intention.

if current_portrait_data.get('ignore_char_scale', false):
scale = current_portrait_data.get('scale', 1)

var offset: Vector2 = current_portrait_data.get('offset', Vector2()) + current_resource.offset

if is_instance_valid(scene.get_script()) and scene.script.is_tool():
Copy link
Contributor

Choose a reason for hiding this comment

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

scene.get_script() should probably be held in a variable and used later. direct access to Object.script is not intended, see Object's description.

Note: The script is not exposed like most properties. To set or get an object's Script in code, use set_script and get_script, respectively.

if is_instance_valid(scene.get_script()) and scene.script.is_tool() and scene.has_method('_get_covered_rect'):
var rect: Rect2= scene._get_covered_rect()

if not scene.get_script() == null and scene.script.is_tool() and scene.has_method('_get_covered_rect'):
Copy link
Contributor

Choose a reason for hiding this comment

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

see feedback above, the variable containing the script reference could most likely be used here as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhance ⚡ Improve a feature's workflow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants