www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Next Generation Level Editor

Reply
 
Thread Tools
Old 14-09-19, 17:40   #1
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 961
Default A reminder to plugin writers: critical issue with renaming custom objects

Hi all!

I have to report there's a critical issue in NGLE which is related to custom objects written in plugins.

As you know, it is completely forbidden to edit slot names in OBJECTS.H file (although Paolone nevertheless did it and renamed FISH to LOCUST_EMITTER):


I will explain the reason, if it's not clear: winroomedit uses object names from OBJECTS.H to internally link items to triggers and vice versa. If object names are changed in OBJECTS.H, project files created before renaming that object won't be parsed correctly:


As Paolone probably became aware of that by the time he wrote plugin support into TRNG, he implemented a way to VISUALLY rename objects in winroomedit (in all buttons, labels, trigger tooltips etc) by using OBJ_RENAME# tag. However, it doesn't work as intended, and OBJ_RENAME# tag also renames objects internally in actual project files. This can eventually cause serious issues with parsing prj files with different renamed custom object combinations. Right now it already causes problems with importing old winroomedit prjs which utilize classic rollingball plugin into TE. Fortunately, classic rollingball is the only renamed custom object so far, so we will add a workaround for that into TE.

So here is VERY IMPORTANT reminder: DO NOT use OBJ_RENAME# tag provided by TRNG to rename your custom objects! It will potentially prevent your project from importing into Tomb Editor, if you decide to do so. However, it doesn't mean you can't use custom objects natively, the problem will only arise in case of importing old prj files.

Last edited by Lwmte; 14-09-19 at 17:50.
Lwmte is offline   Reply With Quote
Old 14-09-19, 19:00   #2
Krystian
Explorer
 
Join Date: May 2010
Posts: 881
Default

Thank you for the heads up, Lwmte!

I suppose it should be also worth mentioning that plugin makers are not limited to hardcoding slots for new objects when making plugins. As an alternative, the plugin creator can provide OBJ_ constants for new objects. The OBJ_ constants can be linked inside plugin code to particular object's functionalities (collison procedures, drawing procedures, interactions etc.), after which they can be used in the AssignSlot script command to assign that object to a particular slot. This gives the builders the ability to choose for themselves which slots will be used for the new object. In this case, no renaming is necessary, as the builder can then manage slot properties on their own accord.

IMO this is a much better approach in the end, because it is certain to avoid conflicting slots between plugins. Also, as slots themselves are a limited resource, hypothetically assuming every plugin maker would choose different slot numbers each time for objects to avoid conflict, we could run out of available slots at some point. Object functions and OBJ constants, on the other hand (within reasonable considerations) aren't limited. Therefore plugin creators should be encouraged to use this method instead of hardcoding slots to particular properties.

Last edited by Krystian; 14-09-19 at 22:41.
Krystian is offline   Reply With Quote
Old 15-09-19, 06:57   #3
TokyoSU
Historian
 
TokyoSU's Avatar
 
Join Date: Mar 2019
Location: France, Caen
Posts: 334
Default

i already use this way to choose a slot, my new plugin use it but in a different way, i'm using customize to do it :x
__________________
"Life is Dream, just a dream"
TokyoSU is online now   Reply With Quote
Old 15-09-19, 11:15   #4
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 3,667
Default

Quote:
Originally Posted by Lwmte View Post
(although Paolone nevertheless did it and renamed FISH to LOCUST_EMITTER)
Is it also fixed for TE, anyway?
AkyV is offline   Reply With Quote
Old 15-09-19, 14:54   #5
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 961
Default

Yes, next revision will provide fixes for both, and also in worst-case scenario you will be able to provide several names for same object. It will identify all versions correctly and use last one in the list for UI.
Lwmte is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 10:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.