Skip to content

Commit

Permalink
fix: fbx animation nodes without childs
Browse files Browse the repository at this point in the history
with this the extremities (? are fixed
they were weirdly rotated before (eg: shield and sword)
could have fix it with code perhaps but this is easier :)
  • Loading branch information
azimut committed Nov 11, 2024
1 parent 3251a94 commit f90b36f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/actors/assimp/bones-helpers.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
;; if it's NOT part of the animation, do nothing (m4:identity)
(a:if-let ((node-anim (gethash name animation-index)))
(get-time-transform node-anim (mod time duration))
(m4:identity)))))
(m4:transpose old-transform)))))

(setf (gethash name nodes-transforms) new-transform)

Expand Down
16 changes: 10 additions & 6 deletions src/actors/assimp/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@
(defun assimp-safe-import-into-lisp (file)
"wrapper around ai:import-into-lisp, attempts to return a valid scene"
(let* ((scene (or (let ((ai::*translate-verbose* t))
(ai:import-into-lisp file))
(ai:import-into-lisp
file :properties '(:import-fbx-read-textures nil)))
(error "cannot simple load the file")))
(processing-flags ;; try to ensure normals
(if (emptyp (ai:normals (aref (ai:meshes scene) 0)))
Expand All @@ -314,11 +315,14 @@
(cons :ai-process-calc-tangent-space processing-flags)
processing-flags))
(scene
(ai:import-into-lisp file :processing-flags (print (remove-duplicates processing-flags))
;; :properties
;; '(:pp-slm-triangle-limit 25000)
;;'(:pp-slm-vertex-limit 20000)
)))
(ai:import-into-lisp
file
:properties '(:import-fbx-preserve-pivots nil)
:processing-flags (print (remove-duplicates processing-flags))
;; :properties
;; '(:pp-slm-triangle-limit 25000)
;;'(:pp-slm-vertex-limit 20000)
)))
;; TODO: error instead if there is an untextured among textured
;; Error if all texture coords are missing :(
#+nil
Expand Down

0 comments on commit f90b36f

Please sign in to comment.