Skip to content

Commit

Permalink
Update to 0.13.3
Browse files Browse the repository at this point in the history
Update to 0.13.3
  • Loading branch information
Darkblader24 authored May 26, 2019
2 parents 06302a4 + 027536d commit 6511f73
Show file tree
Hide file tree
Showing 19 changed files with 239 additions and 153 deletions.
44 changes: 14 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cats Blender Plugin (0.13.2)
# Cats Blender Plugin (0.13.3)

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 @@ -46,6 +46,7 @@ https://catsblenderplugin.com
![](https://i.imgur.com/eZV1zrs.gif)

- Check your 3d view and there should be a new menu item called **CATS** ....w00t
- Since Blender 2.80 the CATS tab is on the right in the menu that opens when pressing 'N'

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

Expand Down Expand Up @@ -332,6 +333,18 @@ It checks for a new version automatically once every day.

## Changelog

#### 0.13.3
- **Importer**:
- Fixed imported armatures being in edit mode
- **Custom Model Creation**:
- Merge Armatures now properly merges bones when the vertex group of one of the merging bones is missing
- Attach Mesh no longer removes zero weight bones and constraints
- **Model Options**:
- Fixed error when switching to object mode during pose mode
- **General**
- 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
Expand Down Expand Up @@ -394,35 +407,6 @@ It checks for a new version automatically once every day.
- Updated mmd_tools
- Fixed multiple errors

#### 0.12.2
- **Optimization**:
- Added new "Convert Textures to PNG" button
- This converts all texture files into PNG files
- This helps with transparency and compatibility issues
- The converted image files will be saved next to the old ones
- **Model**:
- Made SSBU models compatible
- **Exporter**:
- No longer warns of meshes that could be split by Unity
- Instead warns when having more than 70k tris
- Now warns at 10 materials instead of 4, will be changed back when more nuanced warnings are in place
- **Decimation**:
- Changed default decimation value to 70,000 tris
- **General**:
- Fixed corrupted meshes breaking nearly all Cats features
- Added automatic fixing of faulty Cats installations
- Restart Cats if it doesn't show up after updating
- Rewrote the entire updater
- Added some Blender 2.8 compatibility fixes
- Updated mmd_tools

#### 0.12.1
- **General**:
- Fixed an error removing the whole Cats UI
- Fixed an error on Fix Model and other various buttons
- Stopping Pose Mode in Blender 2.8 now selects the Box Selection tool instead of the 3D Cursor
- Updated mmd_tools (improved 2.8 materials)

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


Expand Down
5 changes: 3 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'author': 'GiveMeAllYourCats',
'location': 'View 3D > Tool Shelf > CATS',
'description': 'A tool designed to shorten steps needed to import and optimize models into VRChat',
'version': (0, 13, 2), # 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, 13, 3), # 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 @@ -83,9 +83,10 @@


# How to update mmd_tools:
# Paste mmd_tools folder into project
# Delete mmd_tools_local folder
# Paste mmd_tools folder into project
# Refactor folder name "mmd_tools" to "mmd_tools_local"
# Move mmd_tools_local folder into extern_tools folder
# Search for "show_backface_culling" and set it to False in view.py
# Done

Expand Down
19 changes: 17 additions & 2 deletions extern_tools/mmd_tools_local/core/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ def removeDrivers(cameraObj):
cameraObj.data.driver_remove('ortho_scale')
cameraObj.driver_remove('rotation_euler')

@staticmethod
def __focus_object_get(cameraObj):
camera = cameraObj.data
data = getattr(camera, 'dof', camera)
return data.focus_object if hasattr(data, 'focus_object') else data.dof_object

@staticmethod
def __focus_object_set(cameraObj, focus):
camera = cameraObj.data
data = getattr(camera, 'dof', camera)
if hasattr(data, 'focus_object'):
data.focus_object = focus
else:
data.dof_object = focus

@staticmethod
def convertToMMDCamera(cameraObj, scale=1.0):
if MMDCamera.isMMDCamera(cameraObj):
Expand All @@ -65,7 +80,6 @@ def convertToMMDCamera(cameraObj, scale=1.0):
SceneOp(bpy.context).link_object(empty)

cameraObj.parent = empty
cameraObj.data.dof_object = empty
cameraObj.data.sensor_fit = 'VERTICAL'
cameraObj.data.lens_unit = 'MILLIMETERS' # MILLIMETERS, FOV
cameraObj.data.ortho_scale = 25*scale
Expand All @@ -77,6 +91,7 @@ def convertToMMDCamera(cameraObj, scale=1.0):
cameraObj.lock_location = (True, False, True)
cameraObj.lock_rotation = (True, True, True)
cameraObj.lock_scale = (True, True, True)
MMDCamera.__focus_object_set(cameraObj, empty)
MMDCamera.addDrivers(cameraObj)

empty.location = (0, 0, 10*scale)
Expand Down Expand Up @@ -105,7 +120,7 @@ def newMMDCameraAnimation(cameraObj, cameraTarget=None, scale=1.0, min_distance=

_target_override_func = None
if cameraTarget is None:
_target_override_func = lambda camObj: camObj.data.dof_object or camObj
_target_override_func = lambda camObj: MMDCamera.__focus_object_get(camObj) or camObj

action_name = mmd_cam_root.name
parent_action = bpy.data.actions.new(name=action_name)
Expand Down
25 changes: 19 additions & 6 deletions extern_tools/mmd_tools_local/core/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ def _load_image(self, filepath):
img = bpy.data.images.new(os.path.basename(filepath), 1, 1)
img.source = 'FILE'
img.filepath = filepath
img.use_alpha = (img.depth == 32 and img.file_format != 'BMP')
use_alpha = (img.depth == 32 and img.file_format != 'BMP')
if hasattr(img, 'use_alpha'):
img.use_alpha = use_alpha
elif not use_alpha:
img.alpha_mode = 'NONE'
return img

def __load_texture(self, filepath):
Expand Down Expand Up @@ -401,22 +405,27 @@ def use_sphere_texture(self, use_sphere, obj=None):

def create_sphere_texture(self, filepath, obj=None):
texture = self.__create_texture_node('mmd_sphere_tex', filepath, (-2, -2))
sphere_texture_type = int(self.material.mmd_material.sphere_texture_type)
texture.color_space = 'NONE' if sphere_texture_type == 2 else 'COLOR'
self.update_sphere_texture_type(obj)
return _DummyTextureSlot(texture.image)

def update_sphere_texture_type(self, obj=None):
sphere_texture_type = int(self.material.mmd_material.sphere_texture_type)
is_sph_add = (sphere_texture_type == 2)

if sphere_texture_type not in (1, 2, 3):
self.__update_shader_input('Sphere Tex Fac', 0)
else:
self.__update_shader_input('Sphere Tex Fac', 1)
self.__update_shader_input('Sphere Mul/Add', sphere_texture_type == 2)
self.__update_shader_input('Sphere Tex', (0, 0, 0, 1) if sphere_texture_type == 2 else (1, 1, 1, 1))
self.__update_shader_input('Sphere Mul/Add', is_sph_add)
self.__update_shader_input('Sphere Tex', (0, 0, 0, 1) if is_sph_add else (1, 1, 1, 1))

texture = self.__get_texture_node('mmd_sphere_tex')
if texture:
if hasattr(texture, 'color_space'):
texture.color_space = 'NONE' if is_sph_add else 'COLOR'
elif hasattr(texture.image, 'colorspace_settings'):
texture.image.colorspace_settings.name = 'Linear' if is_sph_add else 'sRGB'

mat = self.material
nodes, links = mat.node_tree.nodes, mat.node_tree.links
if sphere_texture_type == 3:
Expand Down Expand Up @@ -526,13 +535,17 @@ def update_is_double_sided(self):
mmd_mat = mat.mmd_material
if hasattr(mat, 'game_settings'):
mat.game_settings.use_backface_culling = not mmd_mat.is_double_sided
elif hasattr(mat, 'use_backface_culling'):
mat.use_backface_culling = not mmd_mat.is_double_sided
self.__update_shader_input('Double Sided', mmd_mat.is_double_sided)

def update_self_shadow_map(self):
mat = self.material
mmd_mat = mat.mmd_material
cast_shadows = mmd_mat.enabled_self_shadow_map if mmd_mat.alpha > 1e-3 else False
if hasattr(mat, 'transparent_shadow_method'):
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):
Expand Down
Loading

0 comments on commit 6511f73

Please sign in to comment.