Skip to content

Commit

Permalink
Fixed bone-rotation import issues, Updated to latest Daz Bridge Libra…
Browse files Browse the repository at this point in the history
…ry v2.2
  • Loading branch information
danielbui78 committed Sep 7, 2022
1 parent cd3035f commit b390ca9
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp
@@ -1,7 +1,7 @@
DZBRIDGE_VERSION_MAJOR = 2022
DZBRIDGE_VERSION_MINOR = 1
DZBRIDGE_VERSION_REVISION = 11
DZBRIDGE_VERSION_BUILD = 23
DZBRIDGE_VERSION_MINOR = 2
DZBRIDGE_VERSION_REVISION = 12
DZBRIDGE_VERSION_BUILD = 24
DZBRIDGE_VERSION_STRING = "v%s.%s.%s.%s" % (DZBRIDGE_VERSION_MAJOR, DZBRIDGE_VERSION_MINOR, DZBRIDGE_VERSION_REVISION, DZBRIDGE_VERSION_BUILD)
##
## DazToC4D
Expand Down
50 changes: 29 additions & 21 deletions Cinema 4D/appdir_common/plugins/DazToC4D/lib/CustomImports.py
Expand Up @@ -139,28 +139,36 @@ def genesis_import(self, file_path, dtu, sss_value, normal_value, bump_value):
pose.store_offset(dtu)
is_posed = pose.checkIfPosed()
is_anim = anim.check_animation_exists(var.c_joints)
clear_pose = False
if is_posed:
clear_pose = gui.QuestionDialog(
"Importing Posed Figure is currently not fully supported\nWould you like to try to fix bone orientation?",
)
if clear_pose:
pose.clear_pose(var.c_joints)
pose.fix_offset(var.c_joints, var.c_skin_data)

if is_anim == False or clear_pose:
jnt_fixes.store_joint_orientations(dtu)
jnt_fixes.fix_joints(var.c_skin_data, var.c_joints, var.c_meshes)
c4d.EventAdd()
dzc4d.deselect_all()
if is_posed:
pose.restore_pose(var.c_joints)
make_tpose = gui.QuestionDialog(
"Would you like to Convert\nthe Base Pose to a T-Pose?",
)
if make_tpose:
pose.preAutoIK()
fix_bone_rotations = False
override_pose = False
## DB 2022-Aug-31: disabled code below because the clear_pose() function is not fully working, leading to even greater problems
## when fix_joints() is called because fix_joints clears and resets the bind pose, assuming the character is already correctly
## posed in the bind pose position.
# if is_anim == False and is_posed:
# override_pose = gui.QuestionDialog(
# "Importing Posed Figure is currently not fully supported\nWould you like to try to fix bone orientation?",
# )
# if override_pose:
# pose.clear_pose(var.c_joints)
# pose.fix_offset(var.c_joints, var.c_skin_data)

if (is_anim == False and is_posed == False) or override_pose:
fix_bone_rotations == gui.QuestionDialog(
"Would you like to fix bone orientations?",
)
if fix_bone_rotations:
jnt_fixes.store_joint_orientations(dtu)
jnt_fixes.fix_joints(var.c_skin_data, var.c_joints, var.c_meshes)
c4d.EventAdd()
dzc4d.deselect_all()
if is_posed:
pose.restore_pose(var.c_joints)
make_tpose = gui.QuestionDialog(
"Would you like to Convert\nthe Base Pose to a T-Pose?",
)
if make_tpose:
pose.preAutoIK()
c4d.EventAdd()

else:
gui.MessageDialog(
Expand Down
2 changes: 2 additions & 0 deletions Cinema 4D/appdir_common/plugins/DazToC4D/lib/DtC4DPosing.py
Expand Up @@ -152,6 +152,7 @@ def enable_skin_data(self, c_skin_data):
c4d.EventAdd()

def clear_pose(self, joints):
print("DEBUG: clear_pose() called")
for joint in joints:
jnt_data = self.get_pose_data(joint)
if jnt_data:
Expand All @@ -167,6 +168,7 @@ def clear_pose(self, joints):
joint.SetMg(matrix)

def fix_offset(self, joints, c_skin_data):
print("DEBUG: fix_offset() called")
self.disable_skin_data(c_skin_data)
for joint in joints:
jnt_data = self.get_pose_data(joint)
Expand Down
3 changes: 2 additions & 1 deletion Cinema 4D/appdir_common/plugins/DazToC4D/lib/Materials.py
Expand Up @@ -15,7 +15,8 @@
try:
import redshift

except:
except Exception as e:
print("DazToC4D: ERROR: Unable to load redshift module. Redshift conversions will not work: " + str(e))
pass


Expand Down
4 changes: 2 additions & 2 deletions DazStudioPlugin/DzC4DDialog.cpp
Expand Up @@ -67,9 +67,9 @@ the tutorials or videos below to install and enable the Cinema 4D Plugin for the
<li><a href=\"https://github.com/daz3d/DazToC4D/releases\">Download latest updates and bugfixes (Github)</a></li>\
<li><a href=\"https://github.com/daz3d/DazToC4D#2-how-to-install\">How To Install and Configure the Bridge (Github)</a></li>\
<li><a href=\"https://www.daz3d.com/cinema-4d-bridge#faq\">Daz To Cinema 4D FAQ (Daz 3D)</a></li>\
<li><a href=\"https://youtu.be/26en6WHPXnY\">How To Install Daz To Cinema 4D Bridge (Youtube)</a></li>\
<li><a href=\"https://youtu.be/SMDbwSjLLDY\">How To Install Daz To Cinema 4D Bridge (Youtube)</a></li>\
<li><a href=\"https://support.maxon.net/hc/en-us/articles/1500006433061-Where-do-I-install-plugins-\">Where Do I Install Plugins? (Maxon Knowledge Base)</a></li>\
<li><a href=\"https://www.daz3d.com/forums/discussion/574851/official-daztocinema4d-bridge-2022-what-s-new-and-how-to-use-it\">What's New and How To Use It (Daz 3D Forums)</a></li>\
<li><a href=\"https://www.daz3d.com/forums/discussion/574851/official-daztocinema4d-bridge-2022-what-s-new-and-how-to-use-it/p1\">What's New and How To Use It (Daz 3D Forums)</a></li>\
</ul>\
Once the maya plugin is enabled, please add a Character or Prop to the Scene to transfer assets using the Daz To Cinema 4D Bridge.<br><br>\
To find out more about Daz Bridges, go to <a href=\"https://www.daz3d.com/daz-bridges\">https://www.daz3d.com/daz-bridges</a><br>\
Expand Down
Binary file modified DazStudioPlugin/Resources/c4dplugin.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions DazStudioPlugin/version.h
Expand Up @@ -3,8 +3,8 @@

// Version number for dzBridge-C4D
#define PLUGIN_MAJOR 2022
#define PLUGIN_MINOR 1
#define PLUGIN_REV 11
#define PLUGIN_BUILD 23
#define PLUGIN_MINOR 2
#define PLUGIN_REV 12
#define PLUGIN_BUILD 24

#define PLUGIN_VERSION DZ_MAKE_VERSION( PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD )

0 comments on commit b390ca9

Please sign in to comment.