AtrusDni
12-26-2006, 07:11 PM
Hi so this is what im going to be doing . . . I have the code to find active rigid bodies in the scene:
// Find all Rigid Body Nodes in the scene
string $rigidBodyNodes[] = `ls -type rigidBody`;
// Check if the Rigid Body is Active
select -cl;
for ($i=0;$i<size($rigidBodyNodes);$i++)
{
string $activeRigidBody = `rigidBody -q -act $rigidBodyNodes[$i]`;
if($activeRigidBody == "true")
{
//add to array
select -tgl $rigidBodyNodes[$i];
}
}
//Populate activeRigidBodies list
string $activeRigidBodies[] = `ls -sl`;
so now i have $activeRigidBodies[] list and i want to go through and add a "arb_" prefix (Active Rigid Body) in front of the objects name so it will look like this:
arb_objectName
But I also need to check if it already has that prefix, so it doesnt name it arb_arb_objectName . . . .
Is there a way to check the first 4 characters of a string if they are equal to arb_ if so, dont do anything but if it doesnt equal arb_ to add it to the front of the objects name? Any info would be much appreciated. Thanks guys.
// Find all Rigid Body Nodes in the scene
string $rigidBodyNodes[] = `ls -type rigidBody`;
// Check if the Rigid Body is Active
select -cl;
for ($i=0;$i<size($rigidBodyNodes);$i++)
{
string $activeRigidBody = `rigidBody -q -act $rigidBodyNodes[$i]`;
if($activeRigidBody == "true")
{
//add to array
select -tgl $rigidBodyNodes[$i];
}
}
//Populate activeRigidBodies list
string $activeRigidBodies[] = `ls -sl`;
so now i have $activeRigidBodies[] list and i want to go through and add a "arb_" prefix (Active Rigid Body) in front of the objects name so it will look like this:
arb_objectName
But I also need to check if it already has that prefix, so it doesnt name it arb_arb_objectName . . . .
Is there a way to check the first 4 characters of a string if they are equal to arb_ if so, dont do anything but if it doesnt equal arb_ to add it to the front of the objects name? Any info would be much appreciated. Thanks guys.
