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

Advanced Morph Types #64

Closed
Hogarth-MMD opened this issue Jun 30, 2017 · 5 comments
Closed

Advanced Morph Types #64

Hogarth-MMD opened this issue Jun 30, 2017 · 5 comments

Comments

@Hogarth-MMD
Copy link

Hogarth-MMD commented Jun 30, 2017

Presumably at some point in time, mmd_tools will have full support for advanced morph types (material morphs, UV morphs, bone pose morphs, group morphs). Drool. :-) So I thought that I would share what I have figured out about this subject so far. This data for advanced morph types is stored on an 'EMPTY' object which is parent of a character's mesh object and armature object. I loaded a model into Blender with mmd_tools which has all of these types of morphs, and here is some data that I found via the Blender scripting console:

>>> bpy.context.active_object.mmd_root.uv_morphs[0]['data'][0]['offset'].to_list()
[-0.08337914943695068, -0.11126798391342163, 0.0, 0.0]

>>> bpy.context.active_object.mmd_root.uv_morphs[0]['data'][0]['index']
4376

>>> bpy.context.active_object.mmd_root.material_morphs[0]['data'][0].to_dict()
{'diffuse_color': [0.0, 0.0, 0.0, 0.0], 'sphere_texture_factor': [0.0, 0.0, 0.0, 20.0], 
'specular_color': [0.0, 0.0, 0.0], 'offset_type': 1, 'related_mesh': 'ByakurenWith Straight Hair', 
'shininess': 0.0, 'material_id': 0, 'toon_texture_factor': [0.0, 0.0, 0.0, 0.0], 
'ambient_color': [0.0, 0.0, 0.0], 'texture_factor': [0.0, 0.0, 0.0, 0.0], 
'edge_weight': 0.0, 'edge_color': [0.0, 0.0, 0.0, 0.0]}


>>> bpy.context.active_object.mmd_root.bone_morphs[0].data[0].bone
'胸調整.L'

>>> bpy.context.active_object.mmd_root.bone_morphs[0].data[0].location
Vector((0.0, 0.0, 0.0))

>>> bpy.context.active_object.mmd_root.bone_morphs[0].data[0].rotation
Quaternion((0.9940563440322876, 0.1088668555021286, -2.4513144335561177e-13, 9.518605459390983e-09))

>>> bpy.context.active_object.mmd_root.group_morphs[0].data[0].keys()
['name', 'morph_type', 'factor']
@Hogarth-MMD
Copy link
Author

Hogarth-MMD commented Jun 30, 2017

I am assuming that drivers and custom properties (with slider controls) would be needed to implement advanced morph types in Blender. But in Blender, when a property is controlled by a driver and a custom property slider control, that property cannot be edited, or keyframe animated. The driver kind of takes over control in a very possessive and exclusive way. So it seems like that would be a problem with implementing advanced morph types in Blender.

@Hogarth-MMD
Copy link
Author

>>> bpy.context.active_object.mmd_root.uv_morphs[0]['data'][0]['index']
4376

I posted this mmd_tools example data above. Please clarify to me what kind of 'index' this is.
Is this a vertex index OR a vertex index of faces?
vertex index: for example an object has 100 vertices, so it has 100 vertex indexes.
vertex index of faces: for example an object has 100 triangle faces, so it has 300 vertex indexes of faces.

@powroupi
Copy link
Owner

powroupi commented Jul 3, 2017

@Hogarth-MMD It is vertex index. (see properties/morph.py) 😃

@Hogarth-MMD
Copy link
Author

Thanks! Blender uses vertexes of faces for UVs.

@powroupi
Copy link
Owner

powroupi commented Dec 1, 2017

Okay, I'd like to close it for now, you can reopen it if you have new related questions. :)

@powroupi powroupi closed this as completed Dec 1, 2017
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

No branches or pull requests

2 participants