View Full Version : Search and delete hypergraph node?
kungfuelmosan 09-06-2006, 02:24 AM Hey i cant seem to find a script or a tool in maya that can search for and delete a node on the selected object such as a smooth node on a poly?
Mainly i just want a script that will delete the smooth node from my selected object or even all of my objects?
Is there some way you could write a script that finds all nodes from a selection containing " " and deletes them?
thnx
|
|
dbsmith
09-06-2006, 10:38 PM
global proc deleteFromSelected(string $toDelete){
string $objs[] = `ls -sl`;
select $objs[0];
string $dgNodes[] = `listHistory`;
for($node in $dgNodes){
if(`gmatch $node $toDelete`){
delete $node;
}
}
};
//Example use - select polygonal object first
deleteFromSelected("*Smooth*");
//May screw things up if this node is an intermediate node between two other nodes
kungfuelmosan
09-09-2006, 09:21 AM
awesome ill give it a burl!
ashishdantu
09-09-2006, 12:19 PM
hi,
try this too :
to delete all the polysmooth nodes in ur scene:
select `ls -type "polySmooth"`;
// delete; // uncomment this line to delete these nodes directly
// or to delete them directly >>
delete `ls -type "polySmooth"`;
-rgds,
kungfuelmosan
09-10-2006, 09:31 AM
awesome thanks - so what does the 'ls' part mean (mel noob i am)
kungfuelmosan
09-10-2006, 09:39 AM
hi,
try this too :
to delete all the polysmooth nodes in ur scene:
select `ls -type "polySmooth"`;
// delete; // uncomment this line to delete these nodes directly
// or to delete them directly >>
delete `ls -type "polySmooth"`;
-rgds,
Btw it only works if you do polySmoothFace not polySmooth - thanks heaps
ashishdantu
09-10-2006, 08:44 PM
hi,
yup... u r right.. it is 'polySmoothFace' not just polySmooth.. that was just a fast reply ..n i forgot the node name...bad on me :D
the ' ls ' command is list command .. check the mel command reference ..and in search type ls and check its help page.. this is very useful command.. i use it almost allllll the time .
its like u can ask maya to list objects for you ..who r polygons,or selected orbjs, or who are of a particular type .. (like ur smooth nodes etc)..
general use is , say you want to get the names of the currently selected objects :
/*
ls lists all objects, with -sl flag , which means current selected and
stores them into the string variable $selObjs.. ls command returns
a list of objects, so kinda remember ..it returns more than one result..
so you always store it in an array...
*/
string $selObjs[]=`ls -sl`;
// now print the contents of the array >which will print the names of all the items you have selected
print $selObjs;
hope this helps... and go through the mel command help ....
any further doubts, shout !! (< uum.. doubts..n..shout !! rhymming poetry ?!?! ) :D
-rgds,
scorpion007
09-12-2006, 09:25 AM
if you've ever used unix or linux you'll know what ls means.
Robert Bateman
09-12-2006, 11:52 AM
if you've ever used unix or linux you'll know what ls means.
it lists all the files in the current directory? are you sure :p
kungfuelmosan
09-12-2006, 09:55 PM
it lists all the files in the current directory? are you sure :p
yes thats what i thought ls interminal (mac) is list directory contents - although i spose that would make sense - ls to list all objects in a scene.
scorpion007
09-17-2006, 05:41 AM
its still a listing command, just in a slightly different context, with - tags to modify the output.
CGTalk Moderation
09-17-2006, 05:41 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.