logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Finding an object by full name (Read 152 times)
Masterkent
Developer Team
Offline



Posts: 864
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Finding an object by full name
Sep 6th, 2017 at 4:00pm
Print Post  
Core.Object has function

Code
Select All
native(600) final function Object FindObject( Class<Object> ObjClass, string ObjectName ); 


which finds an object matching ObjectName. The matching is not guaranteed to be complete. For example,

Code
Select All
FindObject(class'Property', "Package1.PropertyX") 


may return an object whose name is 'PropertyX' and the Outer object's name differs from 'Package1' if no object with the given name and the Outer object's name can be found. Maybe such a behavior can be useful in some rare cases, but usually it leads to the necessity to use wrappers like this:

Code
Select All
function Object FindObj(class<Object> ObjClass, string ObjectName)
{
	local Object Obj;
	Obj = FindObject(ObjClass, ObjectName);
	if (ObjectName ~= string(Obj))
		return Obj;
	return none;
} 


(recently I had to use such a wrapper in UMenu code)

I'm suggesting to add optional 3rd parameter bMatchFullName in FindObject so that when the value of bMatchFullName is true, only an object whose all outer names correspondingly match the ones specified in ObjectName could be returned.

For example, if there exists an object whose full name is X.Y.Z and there is no any object whose full name would be Y, Z, X.Z, Y.Z, or W.X.Y.Z, then the following conditions should hold:

FindObject(class'Object', "X.Y.Z", true) != none
FindObject(class'Object', "X", true) != none (there exists package X)
FindObject(class'Object', "Y", true) == none
FindObject(class'Object', "Z", true) == none
FindObject(class'Object', "X.Y", true) != none (object X.Y.Z has outer object X.Y)
FindObject(class'Object', "X.Z", true) == none
FindObject(class'Object', "Y.Z", true) == none
FindObject(class'Object', "W.X.Y.Z", true) == none
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7531
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Finding an object by full name
Reply #1 - Sep 8th, 2017 at 4:57am
Print Post  
Should be rather easy to implement.
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo