Game Development Community

World Editor

by Caylo Gypsyblood · in Torque Game Engine · 09/22/2006 (1:11 pm) · 1 replies

From EditorGui.cs I wish to make function TSStatic::create(%shapeName) auto name each new shape as %shapeName.

I use this:
%obj = new TSStatic(%shapeName)
{
shapeName = %shapeName;
};

And it seems to name all TSstatic just fine, until next reload of mission, at what time the name reload wrong. The TSStatic have the right names when I reading from the .mis mission file- so i know they are saved the way i wish. Is there some part i am missing?

Also would changing the worldEditor.cc file to use TSStatic 'shapeName' be an option? If so, where would i do this? All i wish is to see the DTS shape name when in world edit mode...

#1
09/23/2006 (1:01 pm)
I think i have it working:
In the file 'EditorGui.cs' FIND function TSStatic::create(%shapeName)
and make it look like this....

function TSStatic::create(%shapeName)
{
//Replace the *PROJECT* with your project name
%name = strreplace(%shapeName , "*PROJECT*/data/shapes/" , ""); //remove path from string
%name = strreplace(%name , ".dts", ""); // no more .dts
%name = strreplace(%name , "/", ""); // can not have '/'
%name = strreplace(%name , "_", ""); // dont want the '_'
%name = strreplace(%name , " ", ""); // take any space out
%name = stripMLControlChars( %name ); // make sure we have no MLcontrol

//make the TSStatic with a name....
%obj = new TSStatic(%name)
{
shapeName = %shapeName;
};

return(%obj);
}

The 'strreplace' command REPLACE unwanted string char with "", one may find the need to remove Other char as well but the above seems to work for me...