Skip to content

Commit

Permalink
Update to 0.15.0
Browse files Browse the repository at this point in the history
Update to 0.15.0
  • Loading branch information
Darkblader24 authored Sep 19, 2019
2 parents a5dc151 + bb756db commit bb382b1
Show file tree
Hide file tree
Showing 39 changed files with 593 additions and 455 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ resources/settings.json
resources/dictionary_google.json
resources/google-response.txt
resources/ignore_version.txt
resources/no_auto_ver_check.txt
.coverage
mmd_tools_local2
60 changes: 34 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cats Blender Plugin (0.14.0)
# Cats Blender Plugin (0.15.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 All @@ -11,9 +11,7 @@ There are a lot of perks like having your name inside the plugin!

[![](https://i.imgur.com/BFIald5.png)](https://www.patreon.com/catsblenderplugin)

Master branch: ![](https://api.travis-ci.org/michaeldegroot/cats-blender-plugin.svg?branch=master)

Development branch: ![](https://api.travis-ci.org/michaeldegroot/cats-blender-plugin.svg?branch=development)
#### Download here: [Cats Blender Plugin](https://github.com/michaeldegroot/cats-blender-plugin/archive/master.zip)

## Features
- Optimizing model with one click!
Expand All @@ -31,14 +29,15 @@ Development branch: ![](https://api.travis-ci.org/michaeldegroot/cats-blender-pl

*More to come!*

## Website
Check our website to report errors, suggestions or make comments!
https://catsblenderplugin.com
## Discord
Join our Discord to report errors, suggestions and make comments!

## Requirement
**Discord: https://discord.gg/f8yZGnv**

- Blender 2.79 or 2.80 (run as administrator is recommended)
## Requirements
- Blender **2.79** or **2.80** (run as administrator is recommended)
- mmd_tools is **no longer 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)
Expand Down Expand Up @@ -102,7 +101,7 @@ This tries to completely fix your model with one click.

## Model Options

![](https://i.imgur.com/ZiyyAsn.png)
![](https://i.imgur.com/ZPj2VUJ.png)

##### Translation
- Translate certain entities from any japanese to english.
Expand Down Expand Up @@ -343,6 +342,30 @@ It checks for a new version automatically once every day.

## Changelog

#### 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

#### 0.14.0
- **Cats is now fully compatible with Blender 2.80!**
- **Fix Model**:
Expand All @@ -361,7 +384,7 @@ It checks for a new version automatically once every day.
- "Combine Same Materials" and "Convert Textures to PNG" are now compatible with Blender 2.80
- Added loading cursor to "Convert Textures to PNG"
- Added support for Shotariyas Material Combiner in Blender 2.80
- Minimum required Material Combiner version is now v2.1.1.1
- Minimum required Material Combiner version is now v2.1.1.2
- It now fully supports VRM models, has a greatly improved combining logic and an updated UI
- It also got compression removed, so you will always get full quality images now
- **Updater**:
Expand All @@ -388,21 +411,6 @@ It checks for a new version automatically once every day.
- Updated mmd_tools
- The Blender 2.80 API is stable now, so Cats should no longer break in 2.80

#### 0.13.2
- **Importer**:
- Now selects the imported armature in Cats
- Added bone orientation fix after import if all bones point in the same direction
- **Fix Model**:
- Changed clipping planes to 0.01 and 150
- This prevents rendering inaccuracies (thanks Rokk!)
- Fix Model also no longer resets the visibility of objects
- Added option to not connect the bones to their respective child
- **Eye Tracking**:
- Added random vertex movement back in
- Instead of the exporter, Fix Model deleted empty shapekeys now (whoops)
- **General**
- Disabled backface culling in mmd_tools again

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


Expand Down
29 changes: 22 additions & 7 deletions __init__.py
Original file line number Diff line number Diff line change
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, 14, 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!
'version': (0, 15, 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 @@ -59,12 +59,6 @@
else:
is_reloading = True

# Don't allow Blender versions older than 2.75
if bpy.app.version < (2, 75):
sys.tracebacklimit = 0
raise ImportError('\n\nThis Blender version is not supported by Cats. '
'\nPlease use Blender 2.79 or later.')

# Load or reload all cats modules
if not is_reloading:
# This order is important
Expand Down Expand Up @@ -211,6 +205,24 @@ def remove_corrupted_files():
'\n')


def check_unsupported_blender_versions():
# Don't allow Blender versions older than 2.75
if bpy.app.version < (2, 75):
unregister()
sys.tracebacklimit = 0
raise ImportError('\n\nBlender versions older than 2.75 are not supported by Cats. '
'\nPlease use Blender 2.79 or later.'
'\n')

# Versions 2.80.0 to 2.80.74 are beta versions, stable is 2.80.75
if (2, 80, 0) <= bpy.app.version < (2, 80, 75):
unregister()
sys.tracebacklimit = 0
raise ImportError('\n\nYou are still on the beta version of Blender 2.80!'
'\nPlease update to the release version of Blender 2.80.'
'\n')


def set_cats_version_string():
version = bl_info.get('version')
version_temp = []
Expand Down Expand Up @@ -241,6 +253,9 @@ def set_cats_version_string():
def register():
print("\n### Loading CATS...")

# Check for unsupported Blender versions
check_unsupported_blender_versions()

# Check for faulty CATS installations
remove_corrupted_files()

Expand Down
9 changes: 4 additions & 5 deletions extentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ def register():
update=Common.update_material_list
)

Scene.full_body = BoolProperty(
name='Apply Full Body Tracking Fix',
description="Applies a general fix for Full Body Tracking.\n\n"
'Can potentially reduce the knee bending of every avatar in VRChat.\n'
'You can safely ignore the "Spine length zero" warning in Unity',
Scene.keep_upper_chest = BoolProperty(
name='Keep Upper Chest',
description="VrChat now partially supports the Upper Chest bone, so deleting it is no longer necessary."
"\n\nWARNING: Currently this breaks Eye Tracking, so don't check this if you want Eye Tracking",
default=False
)

Expand Down
7 changes: 7 additions & 0 deletions extern_tools/mmd_tools_local/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def menu_func_export(self, context):
def menu_func_armature(self, context):
self.layout.operator(operators.model.CreateMMDModelRoot.bl_idname, text='Create MMD Model', icon='OUTLINER_OB_ARMATURE')

def header_view3d_pose_draw(self, context):
obj = context.active_object
if obj and obj.type == 'ARMATURE' and obj.mode == 'POSE':
self.layout.operator('mmd_tools.flip_pose', text='', icon='ARROW_LEFTRIGHT')

@persistent
def load_handler(dummy):
from mmd_tools_local.core.sdef import FnSDEF
Expand All @@ -114,6 +119,7 @@ def register():
print(__name__, 'registed %d classes'%len(__bl_classes))
properties.register()
bpy.app.handlers.load_post.append(load_handler)
bpy.types.VIEW3D_HT_header.append(header_view3d_pose_draw)
if bpy.app.version < (2, 80, 0):
bpy.types.INFO_MT_file_import.append(menu_func_import)
bpy.types.INFO_MT_file_export.append(menu_func_export)
Expand All @@ -132,6 +138,7 @@ def unregister():
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
bpy.types.VIEW3D_MT_armature_add.remove(menu_func_armature)
bpy.types.VIEW3D_HT_header.remove(header_view3d_pose_draw)
bpy.app.handlers.load_post.remove(load_handler)
properties.unregister()
for cls in reversed(__bl_classes):
Expand Down
2 changes: 0 additions & 2 deletions extern_tools/mmd_tools_local/core/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,6 @@ def update_self_shadow_map(self):
cast_shadows = mmd_mat.enabled_self_shadow_map if mmd_mat.alpha > 1e-3 else False
if hasattr(mat, 'shadow_method'):
mat.shadow_method = 'HASHED' if cast_shadows else 'NONE'
if hasattr(mat, 'transparent_shadow_method'): #XXX
mat.transparent_shadow_method = 'HASHED' if cast_shadows else 'NONE'

def update_self_shadow(self):
mat = self.material
Expand Down
9 changes: 6 additions & 3 deletions extern_tools/mmd_tools_local/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ def rigidGroupObject(self):
break
if self.__rigid_grp is None:
rigids = bpy.data.objects.new(name='rigidbodies', object_data=None)
SceneOp(bpy.context).link_object(rigids)
rigids.mmd_type = 'RIGID_GRP_OBJ'
rigids.parent = self.__root
rigids.hide = rigids.hide_select = True
rigids.lock_rotation = rigids.lock_location = rigids.lock_scale = [True, True, True]
SceneOp(bpy.context).link_object(rigids)
self.__rigid_grp = rigids
return self.__rigid_grp

Expand All @@ -426,11 +426,11 @@ def jointGroupObject(self):
break
if self.__joint_grp is None:
joints = bpy.data.objects.new(name='joints', object_data=None)
SceneOp(bpy.context).link_object(joints)
joints.mmd_type = 'JOINT_GRP_OBJ'
joints.parent = self.__root
joints.hide = joints.hide_select = True
joints.lock_rotation = joints.lock_location = joints.lock_scale = [True, True, True]
SceneOp(bpy.context).link_object(joints)
self.__joint_grp = joints
return self.__joint_grp

Expand All @@ -441,11 +441,11 @@ def temporaryGroupObject(self):
break
if self.__temporary_grp is None:
temporarys = bpy.data.objects.new(name='temporary', object_data=None)
SceneOp(bpy.context).link_object(temporarys)
temporarys.mmd_type = 'TEMPORARY_GRP_OBJ'
temporarys.parent = self.__root
temporarys.hide = temporarys.hide_select = True
temporarys.lock_rotation = temporarys.lock_location = temporarys.lock_scale = [True, True, True]
SceneOp(bpy.context).link_object(temporarys)
self.__temporary_grp = temporarys
return self.__temporary_grp

Expand Down Expand Up @@ -552,6 +552,9 @@ def build(self):
rigid_body.setRigidBodyWorldEnabled(rigidbody_world_enabled)

def clean(self):
#FIXME rigid body cache is out of sync on Blender 2.8
# [Build] at frame 1 -> [Play] -> [Stop] at frame N -> [Clean] at frame N -> [Play] -> crash
# [Build] at frame 1 -> [Play] -> [Stop] at frame N -> [Clean] at frame N -> go to frame 1 ->[Play] -> ok
rigidbody_world_enabled = rigid_body.setRigidBodyWorldEnabled(False)
logging.info('****************************************')
logging.info(' Clean rig')
Expand Down
5 changes: 1 addition & 4 deletions extern_tools/mmd_tools_local/core/pmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ def readFloat(self):
return v

def readVector(self, size):
fmt = '<'
for i in range(size):
fmt += 'f'
return list(struct.unpack(fmt, self.__fin.read(4*size)))
return struct.unpack('<'+'f'*size, self.__fin.read(4*size))

def readByte(self):
v, = struct.unpack('<B', self.__fin.read(1))
Expand Down
14 changes: 3 additions & 11 deletions extern_tools/mmd_tools_local/core/pmx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,15 @@ def readUnsignedShort(self):

def readStr(self):
length = self.readInt()
fmt = '<' + str(length) + 's'
buf, = struct.unpack(fmt, self.__fin.read(length))
buf, = struct.unpack('<%ds'%length, self.__fin.read(length))
return str(buf, self.header().encoding.charset, errors='replace')

def readFloat(self):
v, = struct.unpack('<f', self.__fin.read(4))
return v

def readVector(self, size):
fmt = '<'
for i in range(size):
fmt += 'f'
return list(struct.unpack(fmt, self.__fin.read(4*size)))
return struct.unpack('<'+'f'*size, self.__fin.read(4*size))

def readByte(self):
v, = struct.unpack('<B', self.__fin.read(1))
Expand Down Expand Up @@ -172,11 +168,7 @@ def writeFloat(self, v):
self.__fout.write(struct.pack('<f', float(v)))

def writeVector(self, v):
l = len(v)
fmt = '<'
for i in range(l):
fmt += 'f'
self.__fout.write(struct.pack(fmt, *v))
self.__fout.write(struct.pack('<'+'f'*len(v), *v))

def writeByte(self, v):
self.__fout.write(struct.pack('<B', int(v)))
Expand Down
5 changes: 0 additions & 5 deletions extern_tools/mmd_tools_local/core/pmx/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,11 +968,6 @@ def __doLoadMeshData(self, meshObj, bone_map):
if bpy.app.version < (2, 80, 0):
_to_mesh = lambda obj: obj.to_mesh(bpy.context.scene, apply_modifiers=True, settings='PREVIEW', calc_tessface=False, calc_undeformed=False)
_to_mesh_clear = lambda obj, mesh: bpy.data.meshes.remove(mesh)
elif hasattr(bpy.context, 'depsgraph'): #XXX
def _to_mesh(obj):
bpy.context.view_layer.update()
return obj.to_mesh(bpy.context.depsgraph, apply_modifiers=True, calc_undeformed=False)
_to_mesh_clear = lambda obj, mesh: bpy.data.meshes.remove(mesh)
else:
def _to_mesh(obj):
bpy.context.view_layer.update()
Expand Down
11 changes: 11 additions & 0 deletions extern_tools/mmd_tools_local/core/sdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __sdef_muted(cls, obj, shapekey):
if mute != cls.g_bone_check[hash(obj)].get('sdef_mute'):
mod = obj.modifiers.get('mmd_bone_order_override')
if mod and mod.type == 'ARMATURE':
#FIXME not working well inside driver function on Blender 2.8
if not mute and cls.MASK_NAME not in obj.vertex_groups:
mask = tuple(i[0] for v in cls.g_verts[hash(obj)].values() for i in v[2])
obj.vertex_groups.new(name=cls.MASK_NAME).add(mask, 1, 'REPLACE')
Expand Down Expand Up @@ -223,6 +224,9 @@ def bind(cls, obj, bulk_update=None, use_skip=True, use_scale=False):
cls.register_driver_function()
if bulk_update is None:
bulk_update = cls.__get_benchmark_result(obj, shapekey, use_scale, use_skip)
# FIXME: force disable use_skip=True for bulk_update=False on 2.8
if bpy.app.version >= (2, 80, 0) and (not bulk_update and use_skip):
use_skip = False
# Add the driver to the shapekey
f = obj.data.shape_keys.driver_add('key_blocks["'+cls.SHAPEKEY_NAME+'"].value', -1)
if hasattr(f.driver, 'show_debug_info'):
Expand All @@ -233,6 +237,13 @@ def bind(cls, obj, bulk_update=None, use_skip=True, use_scale=False):
ov.type = 'SINGLE_PROP'
ov.targets[0].id = obj
ov.targets[0].data_path = 'name'
mod = obj.modifiers.get('mmd_bone_order_override')
if mod and mod.type == 'ARMATURE':
ov = f.driver.variables.new()
ov.name = 'arm'
ov.type = 'SINGLE_PROP'
ov.targets[0].id = mod.object
ov.targets[0].data_path = 'name'
if hasattr(f.driver, 'use_self'): # Blender 2.78+
f.driver.use_self = True
param = (bulk_update, use_skip, use_scale)
Expand Down
2 changes: 1 addition & 1 deletion extern_tools/mmd_tools_local/operators/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def execute(self, context):
space.show_backface_culling = True
return {'FINISHED'}
else:
def execute(self, context): #TODO
def execute(self, context): #TODO
context.scene.render.engine = 'BLENDER_EEVEE'

shading_mode = getattr(self, '_shading_mode', None)
Expand Down
Loading

0 comments on commit bb382b1

Please sign in to comment.