Notifications
Clear all

[Closed] User Select objects via edittext

I want to use and edittext box for the user to type an object’s prefix in and feed the output to a collection.

In the following I use – Objs = for o in $Zip_L* collect o – to collect object with a predefined name.

Any help would be gratefully received

simplified version of the script is below

rollout RLT_selectTest “Select and move an object set”
(
group “Set Up”
(
edittext prefixMyObjs “Name prefix:” fieldWidth:50 text: “Zip_L_”
)
button BTN_moveUs “Move Us”
on BTN_moveUs pressed do
(
Objs = for o in $Zip_L* collect o
for o in Objs do
(
FirstFrame = 1
SecndFrame = 10
addnewkey o.pos.controller FirstFrame
addnewkey o.pos.controller SecndFrame
o.pos.controller.Z_Position.controller.keys[1].value = (random 0 500)
)
)

)

createDialog RLT_selectTest width:250 height:75
6 Replies

Change “Objs = for o in $Zip_L* collect o” to “Objs = for o in objects where matchPattern o.name pattern:(prefixMyObjs.text + “*”) collect o”.

That should get the objects whose names start with whatever is typed in the editText field, if I understand what you’re trying to do correctly.

Thanks JHaywood I’ll give it a blast

(execute (“$’” + prefixMyObjs.text + “’*”)) as array

for large scenes it’s much faster then do it through a loop…

2 Replies
(@craigpmiller)
Joined: 11 months ago

Posts: 0

Took this newby a few seconds to realise I had to arrange it like this –

Objs = (execute (“$’” + prefixMyObjs.text + “’*”)) as array
for o in Objs do ()

But now it looks obvious.

Thanks again

(@ahmedsheeraz)
Joined: 11 months ago

Posts: 0

works gr8 for me too. thanx buddy.

thanks denisT

I’ve tried JHaywood’s solution and it works just fine.

But I’ll give your version a try anyway just for good practice

Cheers