Conversation
…y language ID or by supplying an inventory item as a template.
There was a problem hiding this comment.
Pull request overview
This PR updates the viewer’s script-creation flow so it can tell the simulator which default script template/language to use (LSL vs Lua) when creating a new script, removing the prior “create then immediately overwrite code” workaround.
Changes:
- Extend the
RezScriptmessage with an optionalNewScriptInfoblock containing script language and optional template item ID. - Update viewer script creation paths (task inventory + agent inventory) to pick Lua defaults when
LuaScriptsEnabledis advertised by simulator features. - Cherry-pick fix to ensure the login connect button is wired/defaulted earlier during
LLPanelLoginconstruction.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/messages/message_template.msg.sha1 |
Updates message template hash to reflect protocol change. |
scripts/messages/message_template.msg |
Adds NewScriptInfo block to RezScript message definition. |
indra/newview/llviewerobject.h |
Updates LLViewerObject::saveScript() signature to accept language/template parameters; switches header guard to #pragma once. |
indra/newview/llviewerobject.cpp |
Sends NewScriptInfo when creating a brand-new script (null asset UUID). |
indra/newview/llviewerinventory.h |
Introduces LANG_ID_LSL/LANG_ID_LUA constants and moves NO_INV_SUBTYPE to constexpr. |
indra/newview/llviewerinventory.cpp |
Removes Lua “post-create upload hack”; uses subtype to request Lua default script when supported. |
indra/newview/lltooldraganddrop.cpp |
Updates saveScript() call site to new signature. |
indra/newview/llpreviewscript.h |
Switches header guard to #pragma once. |
indra/newview/llpanellogin.cpp |
Moves connect button wiring/default-button setup earlier (cherry-picked fix). |
indra/newview/llpanelcontents.cpp |
Updates “New Script” (task inventory) creation to request correct language/template via saveScript(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e coroutine. This would trigger an attempt to get a mutex which will fail in a coro. Instead post the cleanup back to the mainthread.
| LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); | ||
|
|
||
| // -------------------------------------------------------------------------------------------------- | ||
| // Begin hack |
| asset_type, | ||
| inv_type, | ||
| NO_INV_SUBTYPE, | ||
| subtype, |
There was a problem hiding this comment.
Is there anywhere else that uses wearabletype this way outside of wearables themselves?
There was a problem hiding this comment.
Yes, subtype is also used for settings (Skies, Water, Day Cycles).
As a bonus, the viewer does check this subtype when drawing wearables and settings items and could display a different icon based on script type.
Thinking about it, I'm make a change to the metadata branch that I have which will switch the subtype on a successful compile when it updates the inventory item.
|
|
||
| constexpr U8 NO_INV_SUBTYPE{ 0 }; | ||
| constexpr U8 LANG_ID_LSL = 0; | ||
| constexpr U8 LANG_ID_LUA = 1; |
There was a problem hiding this comment.
If scripts are created as one type, does that constrain the types of compile options you can use for the script once it's created? Is that something the viewer needs to be aware of?
There was a problem hiding this comment.
No. It does not.
Description
The viewer may now indicate to the server which default script to use when creating a new script in either task or agent inventory.
Optionally the viewer may also provide the ID of a script in the agent's inventory, this script will be used instead of the default script.
Future Work
Default script choice is determined by what the server supports. If it supports SLua it will use the lua default, otherwise it will select the LSL default.
We should provide some sort of user option to select which default to use. There is also no interface at this time for selecting an alternate default template from inventory, this would be useful to provide as well.
Related Issues
Simulator: https://github.com/secondlife/server/pull/2344
Message Template: secondlife/master-message-template#4
Additional Notes
This also cherry picks the
updateLoginButtonsfix.