Page 1 of 1

Paint weights, see result in several poses?

Posted: 06 Oct 2016, 18:50
by rray
Is there a way to set up a scene so I can weight paint on a model and see the results in different viewports, using a different pose in each?

I though a live GATOR operator on another model that's differently posed might work, but don't seem to be able to set something like this up, GATOR always copies the original bone assignment.

TY for hints

Re: Paint weights, see result in several poses?

Posted: 06 Oct 2016, 21:15
by Mathaeus
I've used setup that match the definition (if I understood correctly) for sort of crowds, downloadable scene is here. Basically it's ICE envelope on cloned mesh, where original has SI envelope muted, with all weights already applied. So, each clone takes the weights from original, while ICE envelope takes the particular array of transforms.
Don't know how this is feasible for interactive painting, anyway.

P.S. Also, order of deformer members in possible (different) groups should match - I've used modulo shift from point clouds, where matching is granted. In case of different groups, order should be matched by some another way.

Re: Paint weights, see result in several poses?

Posted: 06 Oct 2016, 21:44
by rray
Thanks for your relpy. Clones give me an idea I could use a "real" clone's copyOp to copy the weights instead of GATOR. Then an ICE envelope on top.

I'll try to write a script that makes a new model with a new bone hierarchy and the new clone that takes the weights from the master.

Re: Paint weights, see result in several poses?

Posted: 07 Oct 2016, 01:57
by rray
This worked fine. I can now isolate views on the differently posed models, paint weights on the master and see immediately what effect it has on the different poses. Even modeling/changing topology works. nice workflow :)
Thanks for your hints.

Code: Select all

run()
function run()
{
	sel0 = selection(0);
	if(!sel0 || sel0.Type == "#model" || sel0.Model.Name == "Scene_Root") {
		logmessage("Error: mesh must be selected and under a model", siError);
		return;
	}
		
	SelectDeformersFromEnvelope(null);
	deformers = selection;
	
	if(deformers(0).Model.Name != sel0.Model.Name) {
		logmessage("Error: bones must be under same model as the mesh", siError);
		return;
	}

	model2 = Duplicate("B:"+sel0.Model)(0);
	model2.Name = sel0.Name + "_reference_pose_1";
	
	SelectObj(model2 + "." + sel0.Name);

	tmp = selection(0);
	tmp.Name = "delete_me_later_pls";
	tmpParent = selection(0).Parent;
	
	SelectDeformersFromEnvelope(null);		
	CreateGroupFromObjects("ICE_Bones");
		
	iceTree = Application.ApplyOp("ICETree", sel0, "", "", "", 0)(0);
	iceTree.Name = "ICESavePointPositions";

	setDataNode = AddICECompoundNode("Set Data", iceTree);
	SetValue(setDataNode+".Reference", "self.SavedPointPosition");
	
	getDataNode = AddICENode( "GetDataNode", iceTree);
	SetValue(getDataNode+".Reference", "self.PointPosition");

	ConnectICENodes(setDataNode+".Value", getDataNode+".Value");
	ConnectICENodes(iceTree+".port1", setDataNode+".Execute");

	var clone = Clone(sel0, null, 1, 1, 0, 0, 1, 0, 1, null, null, null, null, null, null, null, null, null, null)(0);
	iceTree = Application.ApplyOp("ICETree", clone, "", "", "", 0)(0);
	iceTree.Name = "ICEMoveToBasePose";

	setDataNode = AddICECompoundNode("Set Data", iceTree);
	SetValue(setDataNode+".Reference", "self.PointPosition");

	getDataNode = AddICENode( "GetDataNode", iceTree);
	SetValue(getDataNode+".Reference", sel0+".SavedPointPosition");

	var switchContextNode = AddICENode("ICENodes\\SwitchContextNode", iceTree);

	ConnectICENodes(switchContextNode+".Value", getDataNode+".Value");
	ConnectICENodes(setDataNode+".Value", switchContextNode+".Result");
	ConnectICENodes(iceTree+".port1", setDataNode+".Execute");

	iceTree = Application.ApplyOp("ICETree", clone, "", "", "", siConstructionModeAnimation)(0);
	iceTree.Name = "ICEEnvelope";
	
	deformerNode = AddICECompoundNode("Dual Quaternion Deformation", iceTree);	
	
	ConnectICENodes(iceTree+".port1", deformerNode+".Execute");
	SetValue(deformerNode+".Deformer_Group_Reference", "this_model.ICE_Bones", null);
	SetValue(deformerNode+".Deformation_Method", 0, null);

	ParentObj(tmpParent, clone);
	
	clone.Name = sel0.Name;
	
	DeleteObj(tmp);
};