Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistake in Morphs.py #41

Open
brucek5 opened this issue Sep 14, 2022 · 4 comments
Open

Mistake in Morphs.py #41

brucek5 opened this issue Sep 14, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@brucek5
Copy link

brucek5 commented Sep 14, 2022

The bridge is not removing linked mesh morphs resulting in large file size. Making the below change made a Cinema 4D file go from 263MB to 19MB, plus animation and UI performance was much faster.

In the file Morphs.py, line 28:
if type(pm_tag) != "c4d.modules.character.CAPoseMorphTag":

should be (qoutes removed):
if type(pm_tag) != c4d.modules.character.CAPoseMorphTag:

@danielbui78 danielbui78 self-assigned this Sep 14, 2022
@danielbui78 danielbui78 added the bug Something isn't working label Sep 14, 2022
@danielbui78
Copy link
Contributor

Thanks, very much!

@brucek5
Copy link
Author

brucek5 commented Sep 14, 2022

Hi danielbui78,
I found the mistake while making a standalone script that “bakes” the linked mesh morphs into the Morph tag when importing a FBX file. In my script, I created a null called “Removed Morph Meshes” at the top of the project, and rather than deleting the meshes, I simply moved them to the null after the conversions. If I don’t need the meshes, then I delete the null and the meshes with it. Rather than re-inventing the wheel, I used your Morph.py code, hence how I found the mistake.

I also removed the two lines:
if "Default:" in morph_name:
continue
The default pose doesn’t need to be a linked mesh.

Another change I made was to change the morph tag to just points:
pm_tag[c4d.ID_CA_POSE_POINTS] = True
pm_tag[c4d.ID_CA_POSE_P] = False
pm_tag[c4d.ID_CA_POSE_R] = False
pm_tag[c4d.ID_CA_POSE_S] = False

Position, Rotation and Scale are for using the tag as a “Correctional PSR Morph” where each morph strength is automatically driven by the Position, Rotation and Scale of a linked joint (which the Bridge isn’t using). I my script, it works fine, but if I make the same change to the Bridge code, for some reason I haven’t figure out, none of the morphs don’t do anything. So since having Position, Rotation and Scale in the Bridge doesn’t add much memory, I left it as is.

Bruce

@danielbui78
Copy link
Contributor

Sorry, I'm not fully understanding your last message. Can you give a test case scenario with step-by-step instructions which I can run before and after making your proposed code modifications to understand the effects? Also, I am assuming you propose to add the additional instructions here?

pm_tag[c4d.ID_CA_POSE_POINTS] = True

@brucek5
Copy link
Author

brucek5 commented Sep 24, 2022

danielbui78,

Just ignore my last message, doesn't hurt anything leaving it the way it is and the extra memory is very, very small.

FYI - The Pose P, R, S settings being "True" (a PSR Morph Tag) is for when you want Cinema 4D to perform joint correction for you based on the position, scale, and rotation of a supplied joint (or object). Since the Bridge is not providing links to joints, it's only using Points. If the DAZ3D JCM morphs where a linear function (which they're not) to joint rotation, this would be a preferred means to control the morph strength because the morph tag itself would be performing the tasks that all the joint pythons scripts are doing. You'll see in the Morph Tag they're extra PSR variables being shown for variables that normally are not shown when using the tag for just user defined and controlled morphs like the Bridge is using it for. In addition, if you make them all false, then the morph tag will clear all it's memory (because it's a very different type of Morph tag) requiring all the morphs to be re-installed into the tag. That's why when I modify the Bridge code to what I posted above, the morphs stopped working because the morphs we're already populated.

Bruce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants