ScriptSpot

Forum topic · Scripts Wanted

object name -> edit text box show

By dussla · 2012-06-14

Description

if i select object , i would like to be showed object name in editbox
is that possible ?

Comments (14)

Name Tools

fajar · 2012-07-25


(
global reNman
global objinSel

try (destroyDialog reNman) catch()	
rollout reNman "Rename Tools" width:156 height:46
(
	editText edt_InText "" pos:[0,3] width:151 height:19 enabled:false
	button btn_ren "Rename Object" pos:[4,25] width:150 height:19 enabled:false
	
	fn objInSel=
	(
		if selection.count ==1 then
		(
			edt_InText.enabled =true
			btn_ren.enabled =true
			edt_InText.text=$.name
		)
		else if selection.count>=2 then
		(
			edt_InText.text=""
			edt_InText.enabled =true
			btn_ren.enabled =true	
			edt_InText.text=selection[1].name
		)
		else if selection.count==0 do
		(
			edt_InText.enabled =false
			btn_ren.enabled=false
			edt_InText.text=""
		)
	)
	
	on btn_ren pressed do 
	(
		undo "rename my object" on
		(
			for i in selection where selection.count!=0 do
			(
				i.name = uniquename (edt_InText.text+" ")
			)
		)
	)
	
	on reNman close do
	(
		callbacks.removeScripts #selectionSetChanged id:#ObjNameCall
	)
	
	on reNman open do
	(
		callbacks.addScript #selectionSetChanged "renman.objInSel()" id:#ObjNameCall
	)
	
)
createDialog reNman
 
)

it's little bit oto , see the script....its use callback to call the name of object, theres 3 action, if none selection, if selection==1 , and if selection +2 or more....

barigazy · 2012-06-15

Press "E"(EditMode) checkbutton if you want to change name of selection.
Press Enter Key to assigne new unique name to selection.
This is the "Renamer" script

try (destroyDialog ::test) catch()
(
rollout test " Renamer"
(
edittext et "" pos:[-2,2] fieldwidth:146 height:17
checkbutton chb "E" pos:[151,2] width:17 height:17 tooltip:"Edit Mode"
timer checkSel "" interval:200
on checkSel tick do
(
if selection.count == 0 then (et.enabled = false ; et.text = "") else
(
et.enabled = true
if selection.count == 1 then et.text = selection[1].name else et.text = "Selected Objects: "+ selection.count as string
)
)
on chb changed state do
if state then checkSel.active = false else checkSel.active = true
on et entered txt do (for o in selection do o.name = uniquename et.text)
)
createdialog test 170 21 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)

You looking for this

barigazy · 2012-06-14


try (destroyDialog ::test) catch()
(
rollout test " test"
(
edittext et "" pos:[-2,2] fieldwidth:146 height:17 readonly:true
timer checkSel "" interval:200
on checkSel tick do
(
if selection.count != 0 do
(
if selection.count == 1 then et.text = selection[1].name else et.text = "Selected Objects: "+ selection.count as string
)
)
)
createdialog test 150 21 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)

thank you but...

dussla · 2012-06-15

thank you for good answer
some more ask...

in text box , i can see object name
i have to modfiy that text little -> apply modify name to other object
but that is only read mode ?

can you understand ? sorry my poor english

JokerMartini · 2012-06-14

For what reason? do you want to chance the name of it or something?

yes

dussla · 2012-06-15

my purpose is to study simple text box only

barigazy · 2012-06-15

You need rename tool, right?

i would like to apply many other script

dussla · 2012-06-15

first of all, my first script is rename tool

barigazy · 2012-06-15

  • i would like to apply many other script
  • Not understand your question

    okay i see

    dussla · 2012-06-15

    if i select 1 object , that name is showed
    but i can see only , i cant edit that text

    example )

    seleted object name : used-car-model
    wanted object name : used-car-new

    if i edit text-box , only i deleted - model and add - new
    but if i do not eidt text-box , i have to write all letter

    do you understand ?

    barigazy · 2012-06-15

    not quite entirely :)
    Send a screenshot to see what do you want exactly

    sorry i seen edit mode script now

    dussla · 2012-06-15

    sorry

    i seen now

    dussla · 2012-06-15

    i seen edit mode script
    that is perpect
    you are sun
    you are genius

    very very very very thank you

    barigazy · 2012-06-15

    We finally understand each other :)