Pose morph target
-
On 06/09/2013 at 03:40, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 14
Platform: Windows ;
Language(s) : C++ ;---------
Hello,I need to access ID_CA_POSE_TARGET parameter of individual morphs in CAPoseMorphTag. For now, I can obtain it only for active morph (which I don't know how to set by code) by calling:
tag->GetParameter(DescID(ID_CA_POSE_TARGET), data, DESCFLAGS_GET_0);
Any help will be greatly appreciated.
Thanks. -
On 06/09/2013 at 11:27, xxxxxxxx wrote:
I'm not sure if I'm understanding your question.
But this is an example how to put an object into the posemorph tag's target field:#include "..\..\..\resource\modules\ca\res\description caposemorph.h" BaseObject *obj = doc->GetActiveObject(); //The object the posemorph tag is on BaseTag *pmTag = obj->GetTag(Tposemorph); //Get the posemorph tag //Set the target object field in the posemorph tag BaseObject *target = doc->SearchObject("My Target"); //<--- Your target object pmTag->SetParameter(DescID(ID_CA_POSE_TARGET), GeData(target), DESCFLAGS_SET_0); EventAdd();
That part is easy.
But I cannot for the life of me figure out how to get & change the pose slider's values in C++.
I can do it in python..But not in C++.
There's a sub container with an ID# 4000 that hosts the poses. Which have ID#'s 1101,1201,1301,etc...
No matter what I do. I cannot get the values for these poses in C++. The container is always either NOTOK, or 1.#include "..\..\..\resource\modules\ca\res\description caposemorph.h" BaseObject *obj = doc->GetActiveObject(); //The object the posemorph tag is on BaseTag *pmTag = obj->GetTag(Tposemorph); //Get the tag BaseContainer *tagdata = pmTag->GetDataInstance(); //Gets the tag's container BaseContainer bc = tagdata->GetContainer(4000); //The sub container that holds the list of pose sliders(1101,1201,1301,etc..) GeData pose0 = bc.GetData(1101); //The first pose(pose.0) Real value = tagdata->GetParameter(DescID(4000), pose0); //Always results in 1!!? GePrint(LongToString(value)); EventAdd();
Anyone know how to get at these values?
-ScottA
-
On 06/09/2013 at 12:19, xxxxxxxx wrote:
Just in case it might help.
Here's a working Python example that changes the poses values in a posemorph tag.//This script shows how to change the posemorph tag's poses import c4d def main() : obj = doc.GetFirstObject() #The object with the posemorph tag on it pmTag = obj.GetTag(c4d.Tposemorph) #Gets the pm tag #4000 is the ID# for the sub container in the pm tag #The poses saved inside that container have ID#'s 1101,1201,1301,etc... first = pmTag[4000,1101]= .5 #Sets the value of Pose.0 to 50% second = pmTag[4000,1201]= .5 #Sets the value of Pose.1 to 50% third = pmTag[4000,1301]= .5 #Sets the value of Pose.2 to 50% #etc.... c4d.EventAdd() if __name__=='__main__': main()
How in the heck do we do this in C++?
-ScottA
-
On 06/09/2013 at 12:35, xxxxxxxx wrote:
Hey ScottA,
your example sets it only for active morph (actually selected), while I have to get/set it for all morphs individually one after another.
Your problem is something which I've also struggled earlier. The answer you need is here:
https://developers.maxon.net/forum/topic/6175/6489_converting-morphs-into-camorphs&OB=DESC
Hope it helps!
-
On 06/09/2013 at 13:10, xxxxxxxx wrote:
Ahh. That's the secret.
We have to use the CAPoseMorphTag type.
Thanks for the link.//Requires a CAPoseMorphTag type...Poses can't be changed using the BaseTag type CAPoseMorphTag *pmTag=(CAPoseMorphTag* )doc->GetFirstObject()->GetTag(Tposemorph); //Target the first saved pose by it's ID# DescID id = DescID(ID_CA_POSE_ANIMATE_DATA, 1101); pmTag->SetParameter(id, 0.5, DESCFLAGS_SET_USERINTERACTION); //NOTE: DESCFLAGS_SET_USERINTERACTION is needed when you set the parameter if not in Animate mode.. //When in Edit only a user action is allowed to change the strength. EventAdd();
I'm still not sure what you're asking for though.
ASFAIK. Each posemorph tag only has one target field option. And each pose can be accessed by it's ID#.
So I'm still not understanding what you're trying to do?-ScottA
-
On 06/09/2013 at 14:08, xxxxxxxx wrote:
No, target is set separately for each morph.
The problem is that after import from FBX I get morphs which doesn't have point morph info. Instead target meshes are set and that collides with my other plugin.
What I try to do is to convert morphs from that form (target meshes) into form with explicit point data.
-
On 06/09/2013 at 18:08, xxxxxxxx wrote:
I'm afraid it looks like Maxon did the same thing with this as they did with the CMotion object.
They are using tree gui's that are private. So we have no way to select the tree objects in them. !Angry
[URL-REMOVED]
And without any way to select a poses from the tree gui. The target link never changes to match the pose.-ScottA
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 07/09/2013 at 02:28, xxxxxxxx wrote:
Ouch, I was afraid of so. Thanks for the info! I will have to do it some other way then.