Scripts
I’ve been learning how to script for a few months now and the hardest part has been thinking of finding a way to use what I’ve been learning. Not being a programmer or having any kind of formal training in that field, it’s been very interesting since I didn’t know where to begin, but it was still a fascinating thing to me to be able to make things that help the process, that automate things. So I just want to post two little things that I managed to make and learn from.
This first script flips/mirrors the selected objects position in world space.
I made a little thing that goes through the steps of mirroring an objects position, and then I started asking well what if I wanted a choice to duplicate it or not, and also what if I wanted to mirror across a different axis. So that’s what this script does organized in a window. It’s very simple but handy, to me at least.
This next script is extremely simple, but it was really confusing to understand as I was just starting to learn this stuff. For awhile I had tried making For Loops for arrays, but kept getting errors. Then I found something someone posted stating the obvious that made sense.
My error was that I was trying to do something like this
//store selection
$sel = `ls -sl`;
//run for loop renaming objects
for ($obj in $sel){
rename ($sel + “something”);
}
When I should’ve done it like this
//store selection
$sel = `ls -sl`;
//run for loop renaming objects
//using $obj, not $sel
for ($obj in $sel){
rename $obj ($obj+ “something”);
}
This script takes your selected objects, runs a for loop through the selection that self-groups each object, and renames it appropriately. Like selecting a circle, grouping it, renaming the group “grp_circle”.
Leave a Reply