forked from AMarquez94/Atlas-Fate-Between-Light-and-Darkness
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
97f7f55
commit eae5b2b
Showing
18 changed files
with
191 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[ { | ||
"entity": | ||
{ | ||
"name": "superplayer", | ||
"transform": | ||
{ | ||
"pos": "0 0 0", | ||
"rotation": "0.0 0.0 0.0 1.0" | ||
}, | ||
"skeleton": { | ||
"skeleton": "data/skeletons/player/player.skeleton" | ||
}, | ||
"abs_aabb":true, | ||
"local_aabb":true, | ||
"player_animator":true, | ||
"render" : [ | ||
{ | ||
"mesh": "data/skeletons/player/body_.mesh" | ||
, | ||
"materials": | ||
[ | ||
"data/skeletons/paladin/paladin.material" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,28 @@ | ||
[ | ||
{ | ||
"entity": | ||
{ | ||
"name": "Paladin" | ||
, | ||
"transform": | ||
{ | ||
"pos": "0 0 0", | ||
"rotation": "0.0 0.0 0.0 1.0" | ||
}, | ||
"skeleton": { | ||
"skeleton": "data/skeletons/cally/cally.skeleton" | ||
}, | ||
"abs_aabb":true, | ||
"local_aabb":true, | ||
"player_animator":true, | ||
"render" : [ | ||
{ | ||
"mesh": "data/skeletons/cally/cally.mesh" | ||
, | ||
"materials": | ||
[ | ||
"data/skeletons/paladin/paladin.material" | ||
] | ||
} | ||
] | ||
} | ||
{ | ||
"name": "superplayer", | ||
"transform": | ||
{ | ||
"pos": "-10 0 -5", | ||
"rotation": "0.0 0.0 0.0 1.0" | ||
}, | ||
"skeleton": { | ||
"skeleton": "data/skeletons/Bip001/player.skeleton" | ||
}, | ||
"abs_aabb":true, | ||
"local_aabb":true, | ||
"render" : [ | ||
{ | ||
"mesh": "data/skeletons/Bip001/Bip001.mesh" | ||
, | ||
"materials": | ||
[ | ||
"data/skeletons/paladin/paladin.material" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name":"Bip001", | ||
"anims" : [ | ||
{ "name" : "prova_uri07" } | ||
] | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
clearListener() | ||
|
||
struct TSkeletonsExporter ( | ||
project_path = "C:/Users/mcv16_alumne/Desktop/Deep Shadows/Bin/data/skeletons/", | ||
skel_name = "player", -- smurf | ||
skel_root_path, -- "C:/../bin/data/skeletons/smurf/, | ||
skel_file, -- "C:/../bin/data/skeletons/smurf/smurf.csf" | ||
|
||
fn isBone obj = ( | ||
-- Discard black bones | ||
return classof obj == Biped_Object and obj.wireColor != Black | ||
), | ||
|
||
-- Search the root bones in the scene to define the .csf | ||
fn findSkelCandidates = ( | ||
local obj_bones = #() | ||
for obj in $* do ( | ||
if isBone obj and obj.parent == undefined then ( | ||
format "% is a root bone\n" obj.name | ||
append obj_bones obj | ||
) | ||
) | ||
return obj_bones | ||
), | ||
|
||
-- Find in the scene the bones which will be exported as part of the animation | ||
-- Change the color to black to discard the bones | ||
fn findBoneCandidates = ( | ||
local objs = #() | ||
for obj in $* do ( | ||
if isBone obj then ( | ||
format "% is a bone for the animation\n" obj.name | ||
append objs obj | ||
) | ||
) | ||
return objs | ||
), | ||
|
||
-- Returns an array of meshes which have the skin modifier and will be exported as .cmf | ||
fn findMeshCandidates = ( | ||
local objs = #() | ||
for obj in $* do ( | ||
if (classof obj == PolyMeshObject) or (classof obj == Editable_Mesh) then ( | ||
if obj.modifiers[#Skin] != undefined then ( | ||
format "% is a skinned mesh \n" obj.name | ||
append objs obj | ||
) | ||
) | ||
) | ||
return objs | ||
), | ||
|
||
|
||
fn setSkelName new_name = ( | ||
skel_name = new_name | ||
skel_root_path = project_path + "skeletons/" + skel_name + "/" | ||
makedir skel_root_path | ||
skel_file = skel_root_path + skel_name + ".csf" | ||
), | ||
|
||
-- Find a bone candidate to be the root, and choose his name as name of the output file | ||
fn findRootBone = ( | ||
local root_bones = findSkelCandidates() | ||
local root = root_bones[1] | ||
setSkelName root.name | ||
return root_bones | ||
), | ||
|
||
fn exportSkelAndMeshes = ( | ||
if ExportCalSkel == undefined then throw "Please, install the cal3d tools" | ||
|
||
local root_bones = findRootBone() | ||
local root = root_bones[1] | ||
|
||
-- Pasar a modo figura si esta en modo pose | ||
local was_in_figure_mode = root.controller.figureMode | ||
root.controller.figureMode = true | ||
local bones_to_export = findBoneCandidates() | ||
|
||
for b in bones_to_export do ( | ||
format "Bone Skel is %\n" b.name | ||
) | ||
|
||
format "Exporting cal csf to %\n" skel_file | ||
local rc = ExportCalSkel skel_file bones_to_export off | ||
|
||
-- Export la mesh... | ||
local obj_meshes = findMeshCandidates() | ||
for obj in obj_meshes do ( | ||
local mesh_file = skel_root_path + obj.name + ".cmf" | ||
-- 0.01 threshold, no LOD, no springs | ||
local rc = ExportCalMesh mesh_file skel_file obj 4 0.01 false false | ||
if rc != 0 then throw ("Failed to export cal3d mesh from object " + obj.name ) | ||
) | ||
|
||
-- Restaurar el modo pose si es q estaba en modo pose inicialmente | ||
if was_in_figure_mode == false then root.controller.figureMode = false | ||
), | ||
|
||
fn exportAnim = ( | ||
local root_bones = findRootBone() | ||
|
||
-- Export anims. | ||
-- Take the name of the output file from the .max filename | ||
local anim_name = getFilenameFile maxfilename | ||
local animation_file = skel_root_path + anim_name + ".caf" | ||
-- Get all the bones to export | ||
local bones_to_export = findBoneCandidates() | ||
-- frames to integer-frames | ||
-- From 60f we need to get the 60 as integer | ||
local begin_time = animationRange.start as integer * frameRate / 4800 | ||
local end_time = animationRange.end as integer * frameRate / 4800 | ||
local rc = ExportCalAnim animation_file skel_file bones_to_export begin_time end_time 0 frameRate | ||
if rc != 0 then throw ("Failed to export cal3d anim: " + (rc as integer) ) | ||
) | ||
) | ||
|
||
gc() | ||
se = TSkeletonsExporter() | ||
se.exportSkelAndMeshes() | ||
se.exportAnim() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters