Fix #104706: Imported FBX shape key values outside the 0.0 to 1.0 range are clamped #104740
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#104740
Loading…
Reference in New Issue
No description provided.
Delete Branch "Mysteryem/blender-addons:fbx_extend_deformpercent_range_pr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This patch changes the FBX import of shape keys by decreasing/increasing
their slider_min/slider_max to fit the imported Value (DeformPercent in
FBX). If the imported Value already fits within the slider range, no
changes are made.
To fit the imported Value, the slider_min/slider_max is set to double
the imported Value if that would fit it within the slider range,
otherwise the slider_min/slider_max is decreased/increased by double the
distance from the imported Value to the current slider_min/slider_max.
Expanded slider_min/slider_max values are rounded down/up to the nearest
integer to produce a more visually pleasing result.
The animated values of shape keys are also checked when animations are
imported and decrease/increase slider_min/slider_max in the same way.
Blender has a hard minimum of -10.0 for slider_min and hard max of 10.0
for slider_max (the importer gets these values from the ShapeKey type's
bl_rna rather than being hardcoded). If a shape key's current or
animated value goes outside that range, a warning is printed to the
system console.
Setting slider_min/slider_max to double the imported Value when it's outside the default 0.0 to 1.0 range was what was suggested in the issue, but I think there are many different ways this could be handled. Two alternatives for setting slider_min/slider_max that stand out to me are:
Besides comment below, LGTM.
I do not have a strong opinion regarding computing of new min/max range values... I kinda do like the idea of setting to whole values though, maybe
floor(value * 2)
/ceil(value * 2)
?floor(value + 1)
/ceil(value + 1)
;)@ -1644,6 +1677,17 @@ def blen_read_shapes(fbx_tmpl, fbx_data, objects, me, scene):
shape_cos[indices] += dvcos
kb.data.foreach_set("co", shape_cos.ravel())
# The default slider_min is 0.0 and slider_max is 1.0. If the imported weight is outside this range, attempt to
This block of code is essentially the same as the one in the animation handling above? Think both could be factorized into a single utility function, would also help tweaking the min/max slider values behavior without having two edit two different pieces of code.
9d71c330d3
tobda669f05c
Expanding the slider range has been moved to a separate
expand_shape_key_range
function in fbx_utils.py.The method of expanding slider_min/slider_max is now setting the min/max to
floor(value * 2)
/ceil(value * 2)
if that will fit the value within the slider range. This covers all current import cases, but to ensure the function works for generic input, e.g. a current slider_min of 1.0 and value of 2.0, if setting tovalue * 2
does not work, the function will instead decrease/increase the slider_min/slider_max by double the distance between the slider_min/slider_max and the value, and then perform the samefloor
/ceil
as before.LGTM, thanks!