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
base: main
Are you sure you want to change the base?
Conversation
- lot's of static typing and whitespace improvements - small adjustments to existing scripts
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.
decided to give some input
%RealPreviewPivot.add_child(current_previewed_scene) | ||
|
||
if current_previewed_scene != null: | ||
if not current_previewed_scene == null: |
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.
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(): |
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.
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'): |
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.
see feedback above, the variable containing the script reference could most likely be used here as well
All credit goes to @CakeVR !
I just did this to make reviewing the core parts of the PR easier.