PDA

View Full Version : nodeOutliner, get a weight of a Blendshape Problem


danielkenobi
06-26-2012, 08:53 PM
Hi I am working on the interface of a custom connect attributes I am developing but I can't Make this to work properly.

The scene is a box with a BlendShape node and 3 diferent blendshapes on it.
Select The box, then the blendshape node, and run the script

The script supose to print the nodes that are selected on the nodeOutliner, but if I select the blendshape weights no matter witch one, the printed value is weight. But I need a way to diferenciate them.
Any Ideas?
Did I make myself clear?




proc ButtonAction_LinkAttributes (string $LeftOutliner,string $RightOutliner)
{
string $RightSelection[]=`nodeOutliner -q -cs $RightOutliner`;
string $LeftSelection[]=`nodeOutliner -q -cs $LeftOutliner`;

string $Displayed[]=`nodeOutliner -q -nd $LeftOutliner`;
print $LeftSelection;
print $RightSelection;
print $Displayed;

}

string $mywindow = `window`;
string $myform = `formLayout -numberOfDivisions 100`;
// Create an outliner that will print the name of
// every object added to it to history pane of the
// script editor, then display all available input
// plugs on the node.
string $LeftOutliner = `nodeOutliner
-showOutputs true
-ms true
-mmo false
-addCommand "print(\"%node \\n\")"`;
string $RightOutliner = `nodeOutliner
-showOutputs true
-ms true
-mmo false
-addCommand "print(\"%node \\n\")"`;

button -label "Button 1" -command "ButtonAction_LinkAttributes $LeftOutliner $RightOutliner";
// Attach the nodeOutliner to the layout
formLayout -edit
-attachForm $LeftOutliner "top" 50
-attachForm $LeftOutliner "left" 5
-attachForm $LeftOutliner "bottom" 5
-ap $LeftOutliner "right" 0 50
$myform;
formLayout -edit
-attachForm $RightOutliner "top" 50
-ap $RightOutliner "left" 0 50
-attachForm $RightOutliner "bottom" 5
-attachForm $RightOutliner "right" 5
$myform;
// Display the window with the node Outliner
showWindow $mywindow;

// Have the outliner display the last 2 selected Objects

string $CurrentSel[]=`ls -sl`;
nodeOutliner -e -a $CurrentSel[0] $LeftOutliner;
nodeOutliner -e -a $CurrentSel[1] $RightOutliner;

danielkenobi
06-27-2012, 03:33 AM
Ok Here is an update to explain what doesnt work


nodeOutliner -q -currentSelection $LeftOutliner

allways return blendShape1.weight no matter witch weight I select


I try this

string $cmd = "nodeOutliner -q -lastClickedNode " + $nodeOutliner;

and this returns
blendShape1.pCube2
blendShape1.pCube3
blendShape1.pCube4

if I select the pCubeX wight

I need that the -currentselection flag reflects this.

Any Idea?

/****************************************************************/
Update,
I try to make the same script with python and got the same result :S it must be me who is doing something wrong.
In the scene should exist a blendshape node called blendshape1 with some blendshapes.


import maya.cmds as cmds

mywindow = cmds.window()
myform = cmds.formLayout( numberOfDivisions=100 )

# Create an outliner that will print the name of
# every object added to it to history pane of the
# script editor, then display all available input
# plugs on the node.

def onAddNode(name):
print name


myoutliner = cmds.nodeOutliner( showOutputs=True,ms = True, addCommand=onAddNode)

# Attach the nodeOutliner to the layout
cmds.formLayout( myform, edit=True, attachForm=((myoutliner, 'top', 20), (myoutliner, 'left', 5), (myoutliner, 'bottom', 5), (myoutliner, 'right', 5)) )
cmds.button( label='Button 1', command="cmds.nodeOutliner ( myoutliner, q = True,cs=True)")
#cmds.button(label='printSelection', command = " cmds.nodeOutliner (nodeoutliner,q=True,cs=True);")

# Display the window with the node Outliner
cmds.showWindow( mywindow )
objectName = 'blendShape1'

# Have the outliner display the sphere
cmds.nodeOutliner (myoutliner, e=True, a=objectName )

CGTalk Moderation
06-27-2012, 03:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.