object name -> edit text box show

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

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fajar's picture

Name Tools

(
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's picture

Press "E"(EditMode)

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)
)

barigazy

barigazy's picture

You looking for this


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)
)

barigazy

dussla's picture

thank you but...

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's picture

For what reason? do you want

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

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

dussla's picture

yes

my purpose is to study simple text box only

barigazy's picture

You need rename tool, right?

You need rename tool, right?

barigazy

dussla's picture

i would like to apply many other script

first of all, my first script is rename tool

barigazy's picture

i would like to apply many

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

    barigazy

    dussla's picture

    okay i see

    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 ?

    Comment viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.