Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MB-Lab: Add a simplified export expression feature #270

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

amirpavlo
Copy link
Contributor

This feature makes use of Shape keys. The work flow is:

  1. Create a character
  2. Create a basis shape key followed by as many shape keys you desire
  3. Once you're done click on the "Export Expression Shape Keys"
    3a. Optionally you can select the "Apply to all Phenotype". This will
    apply the shape keys to all the expression files for all the same
    phenotype.

Signed-off-by: Amir Shehata amir.pavlo@gmail.com

This feature makes use of Shape keys. The work flow is:
1. Create a character
2. Create a basis shape key followed by as many shape keys you desire
3. Once you're done click on the "Export Expression Shape Keys"
3a. Optionally you can select the "Apply to all Phenotype". This will
apply the shape keys to all the expression files for all the same
phenotype.

Signed-off-by: Amir Shehata <amir.pavlo@gmail.com>
@TetoTheSquirrelFox
Copy link
Contributor

TetoTheSquirrelFox commented Jun 14, 2020

Many many thanks for the helps. Just 2 things about your commit :

  • You add indent to file_ops.save_json. No, please, because this method is used by all .json files and for some files it gives an ugly result, plus for a reason, in some tools the method doesn't work (the file is not written and an exception is shown).
  • I would say "import shapekeys" instead of "export shapekeys" for the button because you import to MB-Lab.

Addressed two comment:
1. removed indent=2 for json.dump
2. renamed the tool to Import instead of Export

I also added an option to override existing shapekeys.
This is important since it allows the user to override their own
shapekeys. It can be expanded later to expose a list of all the
expression shape keys, which the user can modify. However,
I still don't think it's a good idea to override the default
shape keys, as they are pretty good already.

Signed-off-by: Amir Shehata <amir.pavlo@gmail.com>
@animate1978
Copy link
Owner

Unfortunately this pull request causes conflict somehow and I am unable to fix this on my end, using the 'dev' branch.

@@ -26,7 +26,7 @@

import logging

import time
import time, ntpath

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use path instead.

Comment on lines +4392 to +4396
kl_v = key_data.values()
result = []
for l in kl_v:
result.append(l.co)
return result

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify to list comprehension.

return [l.co for l in key_data.values()]

@@ -130,7 +130,7 @@ def exists_database(lib_path):
def save_json_data(json_path, char_data):
try:
with open(json_path, "w") as j_file:
json.dump(char_data, j_file)
json.dump(char_data, j_file, indent=2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove. We should let the indent come from other configuration or make this an option instead of hard-coding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants