Skip to content

Commit

Permalink
Merge pull request #4 from anasrar/development
Browse files Browse the repository at this point in the history
improve bake and update readme
  • Loading branch information
anasrar authored Nov 2, 2020
2 parents 35bc469 + 7631d55 commit afdb997
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- No worry about bone orientation and scale.
- The purpose is to retarget animation and clean up action with **NLA Editor**

## Current Version : 0.0.1
## Current Version : 0.1.0


## Feature
Expand All @@ -30,7 +30,12 @@ Retarget system originally from my previous project **[Blender UE4 Workspace](ht

## Installation

Edit 🡆 Preferences 🡆 Add-ons 🡆 Install 🡆 Select **ReNimNode.zip** 🡆 Install Add-ons.
- Edit.
- Preferences.
- Add-ons.
- Install.
- Select **ReNimNode.zip**.
- Install Add-ons.

## How To Use

Expand All @@ -52,20 +57,29 @@ Change editor type to **Retarget Animation Node**.

### Mapping Bone

New 🡆 Add 🡆 Object 🡆 **Target And Source Object** 🡆 Fill Target And Source 🡆 Select Target And Source Armature 🡆 Change Mode To **Pose** 🡆 Select The Bone Target First And Then Select The Source Bone 🡆 **Create Bone Node From Selected Bones** 🡆 Change Mode To **Object** 🡆 **BIND**.
- New.
- Add.
- Object.
- **Target And Source Object**.
- Fill Target And Source.
- Select Target And Source Armature.
- Change Mode To **Pose**.
- Select The Bone Target And Select The Source Bone.
- **Create Bone Node From Selected Bones**.
- **BIND**.

**NOTE** : You can mapping bone when the object node is binding.

![ReNim Node Mapping Bone](doc_assets/mappingbone.gif)

### Bake Action

Change Mode To **Object** 🡆 **BAKE ACTION**
**BAKE ACTION**

**NOTE** :

- You can add additional bone to bake
- You need **UNBIND** to view baked action
- You can add additional bone to bake.
- You need **UNBIND** to view baked action.

![ReNim Node Bake](doc_assets/bake.gif)

Expand Down
26 changes: 26 additions & 0 deletions ReNimNode/production/editorType_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,21 @@ def execute(self, context):
target_object = socket_node.target_object
source_object = socket_node.source_object

# store current mode
old_mode = 'OBJECT'

# store current active object
old_active_object = context.active_object

# change mode to object if current mode is not object
if bpy.context.mode != "OBJECT":
# overide current mode if not object
old_mode = context.active_object.mode if context.active_object else context.mode
bpy.ops.object.mode_set(mode='OBJECT')

# store selected object for seamless binding
selected_objects = context.selected_objects

# deselect all objects
bpy.ops.object.select_all(action='DESELECT')

Expand Down Expand Up @@ -441,6 +456,17 @@ def execute(self, context):
# change to pose mode
bpy.ops.object.mode_set(mode='OBJECT')

# restore selected objects
for obj in selected_objects:
obj.select_set(True)

# change active object to old object
context.view_layer.objects.active = old_active_object

# change to old mode if not object
if old_mode != "OBJECT":
bpy.ops.object.mode_set(mode=old_mode)

if self.unbind_after_bake:
# unnbind after bake its true
bpy.ops.renim.bind(node_tree_name=self.node_tree_name, node_object_name=self.node_object_name)
Expand Down

0 comments on commit afdb997

Please sign in to comment.