  | | | optionVar string arrays? | optionVar string arrays? 2003-11-29 - By Robert Rusick
Back Thanks for the quick response.
I think the impulse to clean up the code by gathering the related optionVars into an array was a good one...
but I'm thinking the overhead of accessing them, not so much the time it will take the computer to process them, as the loss of clarity in the function of the code, weighs against it.
Unless there is some limit on the total number of optionVars I ought to be concerned about... --- Robert
Bryan Ewert wrote:
> You are correct; access to array optionVars is a bit limited.
> To access the n'th item in an optionVar:
> int $byIndex = 3; > string $indexed = "";
> string $vars[] = `optionVar -q stringArrayOptionVar`; > if ( ( $byIndex >= 0 ) && ( $byIndex < `size $vars` ) ) > { > $indexed = $vars[$byIndex]; > }
> To set the n'th item requires rebuilding the optionVar:
> string $vars[] = `optionVar -q stringArrayOptionVar`; > if ( ( $byIndex >= 0 ) && ( $byIndex < `size $vars` ) ) > { > $vars[$byIndex] = "value"; > }
> optionVar -clearArray stringArrayOptionVar; > // <or> optionVar -remove stringArrayOptionVar;
> for ( $item in $vars ) > { > optionVar -sva stringArrayOptionVar $item; > }
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- List-help: <mailto:listar@(protected)?Subject=help> List-archive: <http://www.highend3d.com/maya/devarchive/>
|
|
 |