[Closed] difference in loading .env files by hand and by code?
written a script to store the bone list of a skinned object and the location of an .env file.
The user should be able to recreate the skin, add the bones in order and reload the .env file on via script.this works except the loading .env file. I use the following code to load the .env file
skinOps.loadEnvelope ObjtoSkin.skin inputobject.EnvFile
(where ObjtoSkin is the skinned mesh and EnvFile is the string location of the .env filestored in a struct called inputobject)
but i get terrible results, loading the .env file by hand produces the right results
am i doing something wrong?
I always found .envs to be slightly wishy washy – even when you can save them as ASCII format.
I have my own format now i can save skin data in – is nice as it offers benefits over .env as firstly it can auto-match wrong order/missing bones, and also does partial skinning which is a must i.e I can save the skin for selected verts and sort of mix and match how i want.
You have far greater control if you can write the data yourself to a custom format. Max has a big skinOps libray of functions.
Thanks for the tip eek, I had written out the skin data as well but it wasnt applying – but i think i know what I did wrong – didnt zero out exisiting skin weight values – talk about schoolboy error!
I think i use the replaceSkinWeights function… I tried doing the apply before and nothing happened. Was a while ago i wrote the thing
I ended up using replace on the first bone of every vert and setting it to 0 , and then removing 0 weighted verts on the mesh- this effectively removes all the skin information so i can just apply the skin data in the array.
this way is fairly quick (it takes approximately 20 seconds to add skin and bones, reset the weights and read the new skin weights in) but I found a new problem. Bind pose!
becasue animators have a habit of animating on frame 0 I need to store the bind pose of the rig . other wise the mesh breaks terribly. In my own test stuff I only animated something fairly simple with its bind pose at 0. just wondering if you store a bind pose in files or how you would go about storing this information. I was thinking something like this:
[#(BoneXXX,(transform)),#(BoneYYY,(transform)),#(BoneZZZ,(transform))]
and then seaching the scene fothe object and then setting its transform from the list.