Skip to content

Commit 6511f73

Browse files
authored
Update to 0.13.3
Update to 0.13.3
2 parents 06302a4 + 027536d commit 6511f73

19 files changed

Lines changed: 239 additions & 153 deletions

File tree

README.md

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cats Blender Plugin (0.13.2)
1+
# Cats Blender Plugin (0.13.3)
22

33
A tool designed to shorten steps needed to import and optimize models into VRChat.
44
Compatible models are: MMD, XNALara, Mixamo, Source Engine, Unreal Engine, DAZ/Poser, Blender Rigify, Sims 2, Motion Builder, 3DS Max and potentially more
@@ -46,6 +46,7 @@ https://catsblenderplugin.com
4646
![](https://i.imgur.com/eZV1zrs.gif)
4747

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

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

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

333334
## Changelog
334335

336+
#### 0.13.3
337+
- **Importer**:
338+
- Fixed imported armatures being in edit mode
339+
- **Custom Model Creation**:
340+
- Merge Armatures now properly merges bones when the vertex group of one of the merging bones is missing
341+
- Attach Mesh no longer removes zero weight bones and constraints
342+
- **Model Options**:
343+
- Fixed error when switching to object mode during pose mode
344+
- **General**
345+
- Updated mmd_tools
346+
- The Blender 2.80 API is stable now, so Cats should no longer break in 2.80
347+
335348
#### 0.13.2
336349
- **Importer**:
337350
- Now selects the imported armature in Cats
@@ -394,35 +407,6 @@ It checks for a new version automatically once every day.
394407
- Updated mmd_tools
395408
- Fixed multiple errors
396409

397-
#### 0.12.2
398-
- **Optimization**:
399-
- Added new "Convert Textures to PNG" button
400-
- This converts all texture files into PNG files
401-
- This helps with transparency and compatibility issues
402-
- The converted image files will be saved next to the old ones
403-
- **Model**:
404-
- Made SSBU models compatible
405-
- **Exporter**:
406-
- No longer warns of meshes that could be split by Unity
407-
- Instead warns when having more than 70k tris
408-
- Now warns at 10 materials instead of 4, will be changed back when more nuanced warnings are in place
409-
- **Decimation**:
410-
- Changed default decimation value to 70,000 tris
411-
- **General**:
412-
- Fixed corrupted meshes breaking nearly all Cats features
413-
- Added automatic fixing of faulty Cats installations
414-
- Restart Cats if it doesn't show up after updating
415-
- Rewrote the entire updater
416-
- Added some Blender 2.8 compatibility fixes
417-
- Updated mmd_tools
418-
419-
#### 0.12.1
420-
- **General**:
421-
- Fixed an error removing the whole Cats UI
422-
- Fixed an error on Fix Model and other various buttons
423-
- Stopping Pose Mode in Blender 2.8 now selects the Box Selection tool instead of the 3D Cursor
424-
- Updated mmd_tools (improved 2.8 materials)
425-
426410
Read the full changelog [here](https://github.com/michaeldegroot/cats-blender-plugin/releases).
427411

428412

__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'author': 'GiveMeAllYourCats',
3131
'location': 'View 3D > Tool Shelf > CATS',
3232
'description': 'A tool designed to shorten steps needed to import and optimize models into VRChat',
33-
'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!
33+
'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!
3434
'blender': (2, 80, 0),
3535
'wiki_url': 'https://github.com/michaeldegroot/cats-blender-plugin',
3636
'tracker_url': 'https://github.com/michaeldegroot/cats-blender-plugin/issues',
@@ -83,9 +83,10 @@
8383

8484

8585
# How to update mmd_tools:
86-
# Paste mmd_tools folder into project
8786
# Delete mmd_tools_local folder
87+
# Paste mmd_tools folder into project
8888
# Refactor folder name "mmd_tools" to "mmd_tools_local"
89+
# Move mmd_tools_local folder into extern_tools folder
8990
# Search for "show_backface_culling" and set it to False in view.py
9091
# Done
9192

extern_tools/mmd_tools_local/core/camera.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ def removeDrivers(cameraObj):
5656
cameraObj.data.driver_remove('ortho_scale')
5757
cameraObj.driver_remove('rotation_euler')
5858

59+
@staticmethod
60+
def __focus_object_get(cameraObj):
61+
camera = cameraObj.data
62+
data = getattr(camera, 'dof', camera)
63+
return data.focus_object if hasattr(data, 'focus_object') else data.dof_object
64+
65+
@staticmethod
66+
def __focus_object_set(cameraObj, focus):
67+
camera = cameraObj.data
68+
data = getattr(camera, 'dof', camera)
69+
if hasattr(data, 'focus_object'):
70+
data.focus_object = focus
71+
else:
72+
data.dof_object = focus
73+
5974
@staticmethod
6075
def convertToMMDCamera(cameraObj, scale=1.0):
6176
if MMDCamera.isMMDCamera(cameraObj):
@@ -65,7 +80,6 @@ def convertToMMDCamera(cameraObj, scale=1.0):
6580
SceneOp(bpy.context).link_object(empty)
6681

6782
cameraObj.parent = empty
68-
cameraObj.data.dof_object = empty
6983
cameraObj.data.sensor_fit = 'VERTICAL'
7084
cameraObj.data.lens_unit = 'MILLIMETERS' # MILLIMETERS, FOV
7185
cameraObj.data.ortho_scale = 25*scale
@@ -77,6 +91,7 @@ def convertToMMDCamera(cameraObj, scale=1.0):
7791
cameraObj.lock_location = (True, False, True)
7892
cameraObj.lock_rotation = (True, True, True)
7993
cameraObj.lock_scale = (True, True, True)
94+
MMDCamera.__focus_object_set(cameraObj, empty)
8095
MMDCamera.addDrivers(cameraObj)
8196

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

106121
_target_override_func = None
107122
if cameraTarget is None:
108-
_target_override_func = lambda camObj: camObj.data.dof_object or camObj
123+
_target_override_func = lambda camObj: MMDCamera.__focus_object_get(camObj) or camObj
109124

110125
action_name = mmd_cam_root.name
111126
parent_action = bpy.data.actions.new(name=action_name)

extern_tools/mmd_tools_local/core/material.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ def _load_image(self, filepath):
109109
img = bpy.data.images.new(os.path.basename(filepath), 1, 1)
110110
img.source = 'FILE'
111111
img.filepath = filepath
112-
img.use_alpha = (img.depth == 32 and img.file_format != 'BMP')
112+
use_alpha = (img.depth == 32 and img.file_format != 'BMP')
113+
if hasattr(img, 'use_alpha'):
114+
img.use_alpha = use_alpha
115+
elif not use_alpha:
116+
img.alpha_mode = 'NONE'
113117
return img
114118

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

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

409411
def update_sphere_texture_type(self, obj=None):
410412
sphere_texture_type = int(self.material.mmd_material.sphere_texture_type)
413+
is_sph_add = (sphere_texture_type == 2)
414+
411415
if sphere_texture_type not in (1, 2, 3):
412416
self.__update_shader_input('Sphere Tex Fac', 0)
413417
else:
414418
self.__update_shader_input('Sphere Tex Fac', 1)
415-
self.__update_shader_input('Sphere Mul/Add', sphere_texture_type == 2)
416-
self.__update_shader_input('Sphere Tex', (0, 0, 0, 1) if sphere_texture_type == 2 else (1, 1, 1, 1))
419+
self.__update_shader_input('Sphere Mul/Add', is_sph_add)
420+
self.__update_shader_input('Sphere Tex', (0, 0, 0, 1) if is_sph_add else (1, 1, 1, 1))
417421

418422
texture = self.__get_texture_node('mmd_sphere_tex')
419423
if texture:
424+
if hasattr(texture, 'color_space'):
425+
texture.color_space = 'NONE' if is_sph_add else 'COLOR'
426+
elif hasattr(texture.image, 'colorspace_settings'):
427+
texture.image.colorspace_settings.name = 'Linear' if is_sph_add else 'sRGB'
428+
420429
mat = self.material
421430
nodes, links = mat.node_tree.nodes, mat.node_tree.links
422431
if sphere_texture_type == 3:
@@ -526,13 +535,17 @@ def update_is_double_sided(self):
526535
mmd_mat = mat.mmd_material
527536
if hasattr(mat, 'game_settings'):
528537
mat.game_settings.use_backface_culling = not mmd_mat.is_double_sided
538+
elif hasattr(mat, 'use_backface_culling'):
539+
mat.use_backface_culling = not mmd_mat.is_double_sided
529540
self.__update_shader_input('Double Sided', mmd_mat.is_double_sided)
530541

531542
def update_self_shadow_map(self):
532543
mat = self.material
533544
mmd_mat = mat.mmd_material
534545
cast_shadows = mmd_mat.enabled_self_shadow_map if mmd_mat.alpha > 1e-3 else False
535-
if hasattr(mat, 'transparent_shadow_method'):
546+
if hasattr(mat, 'shadow_method'):
547+
mat.shadow_method = 'HASHED' if cast_shadows else 'NONE'
548+
if hasattr(mat, 'transparent_shadow_method'): #XXX
536549
mat.transparent_shadow_method = 'HASHED' if cast_shadows else 'NONE'
537550

538551
def update_self_shadow(self):

0 commit comments

Comments
 (0)