Skip to content

Commit

Permalink
Miscellaneous bugfixes (#134)
Browse files Browse the repository at this point in the history
* Fix news/new typo in BufferGeometry

* Not all geometries have morph_targets

* fix incorrectly-nested method
  • Loading branch information
Floppy authored Dec 6, 2024
1 parent 5a0d54e commit 27a269a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/mittsu/core/buffer_geometry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def to_json
end

def clone
geometry = Mittsu::BufferGeometry.news
geometry = Mittsu::BufferGeometry.new

@attributes.each do |key, attribute|
geometry[key] = attribute.clone
Expand Down
14 changes: 8 additions & 6 deletions lib/mittsu/objects/mesh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def initialize(geometry = Geometry.new, material = MeshBasicMaterial.new(color:
end

def update_morph_targets
return unless @geometry.respond_to?(:morph_targets)

if !@geometry.morph_targets.nil? && !@geometry.morph_targets.empty?
@morph_targets_base = -1
@morph_target_forced_order = []
Expand All @@ -26,14 +28,14 @@ def update_morph_targets
@morph_targets_influences << 0
@morph_targets_dictionary[target.name] = m
end
end

def morph_target_index_by_name(name)
morph_target_index = @morph_targets_dictionary[name]
return morph_target_index unless morph_target_index.nil?
def morph_target_index_by_name(name)
morph_target_index = @morph_targets_dictionary[name]
return morph_target_index unless morph_target_index.nil?

puts "WARNING: Mittsu::Mest#morph_target_index_by_name: morph target #{name} does not exist. Returning 0."
0
end
puts "WARNING: Mittsu::Mesh#morph_target_index_by_name: morph target #{name} does not exist. Returning 0."
0
end
end

Expand Down

0 comments on commit 27a269a

Please sign in to comment.