QUOTE(dawn3 @ 09/28/06, 11:22 PM) [snapback]248767[/snapback]
I looked up the selection constraints but i did not find an option to select faces that are within a certain angle from the projection camera.
It doees, but you need to clone tha cameras position to the constraints first! its not select camera and bam, its till nonetheless there. Sometimes what you understand to see is not whats there.
Its the visibility opion is enough, but combined with orientation it makes for a quite perfect.
Anyway this does it quite well it dos not bound to the camera angle but it does only select facing faces of ewhatever you had selected besed on whetever camera view you heve active.
CODE
//quick example for perpective camera views only
if (!catchQuiet($camera=modelPanel -q -camera (getPanel("-withFocus"))
)){
$pos=getAttr ($camera+".translate");
//adjust -va 90 to something smaller if you wish not have all visible
polySelectConstraint -m 3 -t 0x0008 -v on -va 90
-vp $pos[0] $pos[1] $pos[2];
polySelectConstraint -m 0 -v off; // reset the setting.
}
else print "no modelpanel"
as i said earlier you can easilyadd a few other constraits to realy stop this to the viewport, this would use the samekind of shard as duncans script but with the -orentation flag + the v flag. Altough granted maya has another feature that does the same. Anyway theres plugin that can sort out vsibility by blocking too. Wich neither scripts do
duncan123uk's solution is okay its just that since mel is not designed for normal programmability in mind thsi is much slower than using selection constraints. And therefore you should avoid programming loops like he does because its potenttialy very slow on large sets. Also its kindof extra work since maya allready knows how to do this. So yes you can bruteforce i in mel but thets not good use of mel, wuch is why maya experience makes for much better api workers than mere programming skill wich is very easy to find. (even if the method is algorithmicaly sane for a c program its not good idea to do mel in this fasion, same applies to maya api, you must think in maya).
So its okay if you want to take a extra speedhit of 100*times what is should be. same applies to random by the way, wich is also avialable in constraints. Wich beacuse it owrks on the allready sorted dataset works wery fast.
So if you relay intend to learn programming iin maya you shoudl give some deep toughts about why i said what i said, its important youll get mcuh more out of maya thatway.
Ps. still suggest you use magic light.