Navigation Menu

Skip to content

Commit

Permalink
Update to 0.17.0
Browse files Browse the repository at this point in the history
Update to 0.17.0
  • Loading branch information
Darkblader24 committed Jun 3, 2020
2 parents 1d79500 + 43b9402 commit 89702cd
Show file tree
Hide file tree
Showing 49 changed files with 1,365 additions and 609 deletions.
65 changes: 36 additions & 29 deletions README.md
@@ -1,4 +1,4 @@
# Cats Blender Plugin (0.16.1)
# Cats Blender Plugin (0.17.0)

A tool designed to shorten steps needed to import and optimize models into VRChat.
Compatible models are: MMD, XNALara, Mixamo, Source Engine, Unreal Engine, DAZ/Poser, Blender Rigify, Sims 2, Motion Builder, 3DS Max and potentially more
Expand Down Expand Up @@ -35,13 +35,15 @@ Join our Discord to report errors, suggestions and make comments!
**Discord: https://discord.gg/f8yZGnv**

## Requirements
- Blender **2.79** or **2.80** or **2.81** (run as administrator is recommended)
- mmd_tools is **no longer required**! Cats comes pre-installed with it!
- Blender **2.79** or **2.80** or above (run as administrator is recommended)
- mmd_tools is **not required**! Cats comes pre-installed with it!
- If you have custom Python installed which Blender might use, you need to have Numpy installed

## Installation
- Download the plugin: [Cats Blender Plugin](https://github.com/michaeldegroot/cats-blender-plugin/archive/master.zip)
- Install the the addon in blender like so:
- Download the plugin: **[Cats Blender Plugin](https://github.com/michaeldegroot/cats-blender-plugin/archive/master.zip)**
- **Important: Do NOT extract the downloaded zip! You will need the zip file during installation!**
- Install the addon in blender like so:
- *This shows Blender 2.79. In Blender 2.80+ go to Edit > Preferences > Add-ons. Also you don't need to save the user settings there.*

![](https://i.imgur.com/eZV1zrs.gif)

Expand Down Expand Up @@ -298,6 +300,35 @@ It checks for a new version automatically once every day.

## Changelog

#### 0.17.0
- **Cats is now fully compatible with Blender 2.83!**
- *It was compatible with 2.82 all long*
- **Fix Model:**
- Added "Keep Twist Bones" option to Fix Model
- This will keep any bone containing 'Twist'
- Added "Fix MMD Twist Bones" option to Fix Model
- This will apply a fix to make the MMD arm twist bones usable **(Thanks Rokk!)**
- You do not need to enable "Keep Twist Bones" for this to work
- Added "Remove Rigidbodies and Joints" option to Fix Model
- This is solely intended for our non-VRChat users
- Added compatibility to more models
- Disabling the option "Remove Zero Weight Bones" now also keeps unused vertex groups
- **Importer:**
- Imported meshes from VRM files now get automatically parented to their armature
- Imported armatures now always show their bones in front and in wire mode
- Fixed export warning being empty
- Fixed importer error when the FBX importer was not enabled
- Fixed importer error when a zip file contained another zip file
- When importing a model, objects of a new scene now only get deleted if all three of them are present
- **Custom Model Creation:**
- Added "Remove Zero Weight Bones" option to Merge Armatures
- **Decimation:**
- Added "Remove Doubles" option
- **General:**
- Fixed some bugs
- Fixed objects getting unhidden when doing any cats operation in 2.80+
- Updated mmd_tools

#### 0.16.1
- Fixed export warning bug

Expand Down Expand Up @@ -334,30 +365,6 @@ It checks for a new version automatically once every day.
- Small bug fixes
- Updated mmd_tools

#### 0.15.0
- **Importer**:
- FBX no longer imports animations and poses by default
- **Fix Model**:
- Now always applies transforms of the model
- Added "Keep Upper Chest" option
- Warning: Currently having an Upper Chest breaks Eye Tracking, so don't use this if you want Eye Tracking
- Removed "Fix Full Body Tracking" option
- It is no longer needed for VRChat
- The button to add/remove the fix is still available in Model Options
- Improved Hips placement as recommended by VRChat
- Legs are now getting bend forward very slightly if they are completely straight
- Fixed a bug which could sometimes delete bones unintentionally
- **Model**:
- Fixed pose mode error in 2.80
- **Model Options**:
- Added new "Delete Zero Weight Vertex Groups" button
- Improved layout of the "Full Body Tracking Fix" buttons
- Fixed visual "Merge Weights" bug in Blender 2.80
- **Optimization**:
- Improved Material Combiner detection algorithm
- **General**:
- Updated mmd_tools

Read the full changelog [here](https://github.com/michaeldegroot/cats-blender-plugin/releases).


Expand Down
8 changes: 5 additions & 3 deletions __init__.py
Expand Up @@ -30,7 +30,7 @@
'author': 'GiveMeAllYourCats & Hotox',
'location': 'View 3D > Tool Shelf > CATS',
'description': 'A tool designed to shorten steps needed to import and optimize models into VRChat',
'version': (0, 16, 1), # Has to be (x, x, x) not [x, x, x]!! # Only change this version and the dev branch var right before publishing the new update!
'version': (0, 17, 0), # Has to be (x, x, x) not [x, x, x]!! # Only change this version and the dev branch var right before publishing the new update!
'blender': (2, 80, 0),
'wiki_url': 'https://github.com/michaeldegroot/cats-blender-plugin',
'tracker_url': 'https://github.com/michaeldegroot/cats-blender-plugin/issues',
Expand Down Expand Up @@ -76,7 +76,7 @@
importlib.reload(extentions)


# How to update mmd_tools:
# How to update mmd_tools: (outdated, no longer used)
# Delete mmd_tools_local folder
# Paste mmd_tools folder into project
# Refactor folder name "mmd_tools" to "mmd_tools_local"
Expand Down Expand Up @@ -318,8 +318,10 @@ def register():
# Set preferred Blender options
if hasattr(tools.common.get_user_preferences(), 'system') and hasattr(tools.common.get_user_preferences().system, 'use_international_fonts'):
tools.common.get_user_preferences().system.use_international_fonts = True
else:
elif hasattr(tools.common.get_user_preferences(), 'view') and hasattr(tools.common.get_user_preferences().view, 'use_international_fonts'):
tools.common.get_user_preferences().view.use_international_fonts = True
else:
pass # From 2.83 on this is no longer needed
tools.common.get_user_preferences().filepaths.use_file_compression = True
bpy.context.window_manager.addon_support = {'OFFICIAL', 'COMMUNITY', 'TESTING'}

Expand Down
45 changes: 42 additions & 3 deletions extentions.py
Expand Up @@ -41,8 +41,8 @@ def register():

Scene.remove_zero_weight = BoolProperty(
name='Remove Zero Weight Bones',
description="Cleans up the bones hierarchy, deleting all bones that don't directly affect any vertices.\n"
'Uncheck this if bones you want to keep got deleted',
description="Cleans up the bones hierarchy, deleting all bones that don't directly affect any vertices."
'\nUncheck this if bones or vertex groups that you want to keep got deleted',
default=True
)

Expand All @@ -55,6 +55,25 @@ def register():
default=False
)

Scene.keep_twist_bones = BoolProperty(
name='Keep Twist Bones',
description='This will keep any bone with "Twist" in the name.'
'\nSo if there are certain bones that you want to keep, you can add "Twist" to them and they won\'t get deleted.'
'\n\nVRChat can now make use of twist bones, so you can use this option to keep them',
default=False
)

Scene.fix_twist_bones = BoolProperty(
name='Fix MMD Twist Bones',
description='This will make MMD arm twist bones usable in VRChat.'
'\nWIll only work if the twist bones are properly named.'
'\nRequired names:'
'\n - ArmTwist[1-3]_[L/R]'
'\n - HandTwist[1-3]_[L/R]'
'\n\nYou don\'t need to enable "Keep Twist Bones" for this to work',
default=True
)

Scene.join_meshes = BoolProperty(
name='Join Meshes',
description='Joins all meshes of this model together.'
Expand All @@ -81,6 +100,13 @@ def register():
default=True
)

Scene.remove_rigidbodies_joints = BoolProperty(
name='Remove Rigidbodies and Joints',
description="Rigidbodies and joints are used by MMD software to simulate physics."
"\nThey are completely useless for VRChat, so removing them is recommended for VRChat users!",
default=True
)

Scene.use_google_only = BoolProperty(
name='Use Old Translations (not recommended)',
description="Ignores the internal dictionary and only uses the Google Translator for shape key translations."
Expand Down Expand Up @@ -145,7 +171,7 @@ def register():
Scene.apply_transforms = BoolProperty(
name='Apply Transforms',
description='Check this if both armatures and meshes are already at their correct positions.'
'\nThis will cause them to stay exactly like they are when merging',
'\nThis will cause them to stay exactly where they are when merging',
default=False
)

Expand All @@ -156,6 +182,13 @@ def register():
default=True
)

Scene.merge_armatures_remove_zero_weight_bones = BoolProperty(
name='Remove Zero Weight Bones',
description="Cleans up the bones hierarchy, deleting all bones that don't directly affect any vertices."
'\nUncheck this if bones or vertex groups that you want to keep got deleted',
default=True
)

# Decimation
Scene.decimation_mode = EnumProperty(
name="Decimation Mode",
Expand Down Expand Up @@ -236,6 +269,12 @@ def register():
"LittleFinger(1-3)_(L/R)"
)

Scene.decimation_remove_doubles = BoolProperty(
name="Remove Doubles",
description="Uncheck this if you got issues with with this checked",
default=True
)

Scene.max_tris = IntProperty(
name='Tris',
description="The target amount of tris after decimation",
Expand Down
19 changes: 14 additions & 5 deletions extern_tools/mmd_tools_local/bpyutils.py
Expand Up @@ -297,22 +297,31 @@ def __clean_drivers(self, key):

if bpy.app.version < (2, 75, 0):
def shape_key_remove(self, key):
assert(key.id_data == self.__obj.data.shape_keys)
obj = self.__obj
key_blocks = obj.data.shape_keys.key_blocks # key.id_data.key_blocks
assert(key.id_data == obj.data.shape_keys)
key_blocks = key.id_data.key_blocks
relative_key_map = {k.name:getattr(k.relative_key, 'name', '') for k in key_blocks}
obj.active_shape_key_index = key_blocks.find(key.name)
last_index, obj.active_shape_key_index = obj.active_shape_key_index, key_blocks.find(key.name)
if last_index >= obj.active_shape_key_index:
last_index = max(0, last_index-1)
bpy.context.scene.objects.active, last = obj, bpy.context.scene.objects.active
self.__clean_drivers(key)
bpy.ops.object.shape_key_remove()
bpy.context.scene.objects.active = last
for k in key_blocks:
k.relative_key = key_blocks.get(relative_key_map[k.name], key_blocks[0])
obj.active_shape_key_index = min(last_index, len(key_blocks)-1)
else:
def shape_key_remove(self, key):
assert(key.id_data == self.__obj.data.shape_keys)
obj = self.__obj
assert(key.id_data == obj.data.shape_keys)
key_blocks = key.id_data.key_blocks
last_index = obj.active_shape_key_index
if last_index >= key_blocks.find(key.name):
last_index = max(0, last_index-1)
self.__clean_drivers(key)
self.__obj.shape_key_remove(key)
obj.shape_key_remove(key)
obj.active_shape_key_index = min(last_index, len(key_blocks)-1)

class TransformConstraintOp:

Expand Down
18 changes: 8 additions & 10 deletions extern_tools/mmd_tools_local/core/bone.py
Expand Up @@ -236,6 +236,14 @@ def patch_rna_idprop(pose_bones):

@classmethod
def clean_additional_transformation(cls, armature):
# clean constraints
for p_bone in armature.pose.bones:
p_bone.mmd_bone.is_additional_transform_dirty = True
constraints = p_bone.constraints
remove_constraint(constraints, 'mmd_additional_rotation')
remove_constraint(constraints, 'mmd_additional_location')
if remove_constraint(constraints, 'mmd_additional_parent'):
p_bone.bone.use_inherit_rotation = True
# clean shadow bones
shadow_bone_types = {
'DUMMY',
Expand All @@ -246,19 +254,9 @@ def clean_additional_transformation(cls, armature):
def __is_at_shadow_bone(b):
return b.is_mmd_shadow_bone and b.mmd_shadow_bone_type in shadow_bone_types
shadow_bone_names = [b.name for b in armature.pose.bones if __is_at_shadow_bone(b)]

if len(shadow_bone_names) > 0:
with bpyutils.edit_object(armature) as data:
remove_edit_bones(data.edit_bones, shadow_bone_names)

# clean constraints
for p_bone in armature.pose.bones:
p_bone.mmd_bone.is_additional_transform_dirty = True
constraints = p_bone.constraints
remove_constraint(constraints, 'mmd_additional_rotation')
remove_constraint(constraints, 'mmd_additional_location')
if remove_constraint(constraints, 'mmd_additional_parent'):
p_bone.bone.use_inherit_rotation = True
cls.patch_rna_idprop(armature.pose.bones)

@classmethod
Expand Down

0 comments on commit 89702cd

Please sign in to comment.