Class: RuboCop::Cop::SketchupBugs::UniformScaling

Inherits:
SketchUp::Cop show all
Includes:
SketchUp::SketchUpTargetRange
Defined in:
lib/rubocop/sketchup/cop/bugs/uniform_scaling.rb

Overview

Until SketchUp 2018 ‘Geom::Transformation.scaling(scale)` modified the 16th value in the transformation matrix. This way of scaling the matrix isn’t fully accounted in all places in SketchUp. There are also a number of exporters and render engines which also doesn’t fully handle this.

Examples:

Workaround for SketchUp versions older than SketchUp 2018

tr = Geom::Transformation.scaling(scale, scale, scale)

Constant Summary collapse

MSG =
'Resulting transformation matrix might yield unexpected '\
'results.'

Constants inherited from SketchUp::Cop

SketchUp::Cop::SKETCHUP_DEPARTMENT_SEVERITY

Constants included from SketchUp::Config

SketchUp::Config::DEFAULT_CONFIGURATION

Instance Method Summary collapse

Methods included from SketchUp::SketchUpTargetRange

included, #sketchup_target_max_version, #sketchup_target_min_version, #valid_for_target_sketchup_version?

Methods inherited from SketchUp::Cop

inherited, #relevant_file?

Instance Method Details

#on_send(node) ⇒ Object



26
27
28
29
30
31
# File 'lib/rubocop/sketchup/cop/bugs/uniform_scaling.rb', line 26

def on_send(node)
  return unless valid_for_target_sketchup_version?
  return unless transformation_scaling?(node)

  add_offense(node.arguments.first)
end