Skip to content

Commit

Permalink
Merge pull request #68 from michaeldegroot/development
Browse files Browse the repository at this point in the history
0.11.2
  • Loading branch information
absolute-quantum authored Oct 12, 2018
2 parents ce887f2 + c0ada8b commit 3a45088
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cats Blender Plugin (0.11.1)
# Cats Blender Plugin (0.11.2)

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 @@ -335,6 +335,10 @@ It checks for a new version automatically once every day.

## Changelog

#### 0.11.2
- **Model**:
- Fix: Joints and Rigidbodies now get deleted correctly

#### 0.11.1
- **Export**:
- Embed Textures is not longer enabled by default, but can now be enabled in the settings
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
'author': 'GiveMeAllYourCats',
'location': 'View 3D > Tool Shelf > CATS',
'description': 'A tool designed to shorten steps needed to import and optimize MMD models into VRChat',
'version': [0, 11, 1], # Only change this version and the dev branch var right before publishing the new update!
'version': [0, 11, 2], # Only change this version and the dev branch var right before publishing the new update!
'blender': (2, 79, 0),
'wiki_url': 'https://github.com/michaeldegroot/cats-blender-plugin',
'tracker_url': 'https://github.com/michaeldegroot/cats-blender-plugin/issues',
Expand Down
16 changes: 12 additions & 4 deletions tools/armature.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def execute(self, context):
tools.common.delete_hierarchy(mesh)

# Reset to default
tools.common.set_default_stage()
armature = tools.common.set_default_stage()

# Set better bone view
armature.data.draw_type = 'OCTAHEDRAL'
Expand All @@ -216,9 +216,17 @@ def execute(self, context):
context.area.spaces[0].show_backface_culling = False

# Remove Rigidbodies and joints
for obj in bpy.data.objects:
if 'rigidbodies' in obj.name or 'joints' in obj.name:
tools.common.delete_hierarchy(obj)
to_delete = []
for child in tools.common.get_top_parent(armature).children:
if 'rigidbodies' in child.name or 'joints' in child.name:
to_delete.append(child.name)
continue
for child2 in child.children:
if 'rigidbodies' in child2.name or 'joints' in child2.name:
to_delete.append(child2.name)
continue
for obj_name in to_delete:
tools.common.delete_hierarchy(bpy.data.objects[obj_name])

# Remove objects from different layers and things that are not meshes
for child in armature.children:
Expand Down
26 changes: 14 additions & 12 deletions tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,18 @@ def get_armature_objects():
return armatures


def unhide_all(everything=False):
armature = get_armature()
def get_top_parent(child):
if child.parent:
return get_top_parent(child.parent)
return child


def unhide_all(everything=False, obj_to_unhide=None):
if not obj_to_unhide:
obj_to_unhide = get_armature()

if version_2_79_or_older():
if everything or not armature:
if everything or not obj_to_unhide:
for obj in bpy.data.objects:
obj.hide = False
else:
Expand All @@ -88,15 +96,9 @@ def unhide_children(parent):
child.hide = False
unhide_children(child)

def unhide_parents(child):
parent = child.parent
if parent:
parent.hide = False
unhide_parents(parent)

armature.hide = False
unhide_children(armature)
unhide_parents(armature)
top_parent = get_top_parent(obj_to_unhide)
top_parent.hide = False
unhide_children(top_parent)
else:
for obj in bpy.data.collections:
obj.hide_viewport = False
Expand Down

0 comments on commit 3a45088

Please sign in to comment.