Plugin

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음

플러그인 은 기본 Studio 위젯, 플러그인 도구 모음, 플러그인 버튼 등을 만드는 주요 개체입니다.Studio에 일반적으로 포함되지 않는 새로운 동작과 기능을 추가하는 사용자 지정 추가 기능입니다.플러그인 개체(플러그인)는 플러그인으로 실행되는 글로벌 참조를 통해 액세스할 수 있습니다.

코드 샘플

The plugin global reference is not passed to ModuleScripts within the plugin. In order to use it in a ModuleScript, you must explicitly pass it as seen in the example below.

Script - Pass the Plugin Global to a ModuleScript

assert(plugin, "This script must be run as a plugin!")
-- Code beyond this point will execute only if the script is run as a plugin
-- Load the module and pass the plugin reference
local pluginModule = require(script.Parent.PluginModule)
pluginModule:Initialize(plugin)
-- Verify if the plugin reference was initialized
pluginModule:CheckForPluginGlobal()
ModuleScript - Receive and Store the Plugin Global

local pluginModule = {}
local plugin -- Local plugin reference
-- Initialize the plugin reference if not already set
function pluginModule:Initialize(pluginReference: Plugin)
if plugin ~= pluginReference then
plugin = pluginReference
else
error("Plugin is already initialized")
end
end
-- Check if the plugin reference is set and print out appropriate info
function pluginModule:CheckForPluginGlobal()
if plugin ~= nil then
print("Plugin reference is set!")
else
warn("Plugin reference is missing!")
end
end
return pluginModule

요약

속성

메서드

  • Activate(exclusiveMouse : boolean):()
    플러그인 보안

    호출 플러그인의 상태를 활성화로 설정합니다.

  • CreatePluginAction(actionId : string,text : string,statusTip : string,iconName : string,allowBinding : boolean):PluginAction
    플러그인 보안

    Roblox Studio에서 일반적인 수행 가능한 작업을 나타내는 개체인 PluginAction 를 생성하여 직접 연결되지 않은 Toolbar 또는 Enum.Button 없이 합니다.

  • 플러그인 보안

    새로운 플러그인 메뉴를 생성합니다.

  • 플러그인 보안

    지정된 이름으로 새 PluginToolbar를 생성합니다.

  • 플러그인 보안

    플러그인을 비활성화합니다.

  • 플러그인 보안

    사용자가 Studio의 모델 탭에서 설정한 Enum.JointCreationMode를 반환합니다.

  • 플러그인 보안

    플러그인이 활성화된 상태에서 사용할 수 있는 Mouse를 반환합니다.

  • 현재 선택된 Enum.RibbonTool를 반환합니다.

  • GetSetting(key : string):Variant
    플러그인 보안

    지정된 키로 이전에 저장된 값을 검색하거나, 지정된 키가 존재하지 않으면 nil 입니다.

  • Intersect(objects : Instances):Instance
    플러그인 보안
  • 플러그인 보안

    이 플러그인이 현재 활성 상태인 경우 Plugin:Activate() 함수를 통해 활성화된 후 true를 반환합니다.

  • 이 플러그인이 현재 특별한 마우스로 활성화되어 있고, Plugin:Activate() 함수를 통해 활성화된 후 독점적인 마우스로 활성화되면 true를 반환합니다.

  • Negate(objects : Instances):Instances
    플러그인 보안

    제공된 부품을 부정하고 결과적인 부정 작업을 반환합니다.

  • OpenScript(script : LuaSourceContainer,lineNumber : number):()
    플러그인 보안

    주어진 스크립트 인스턴스를 편집기 창에서 Roblox 스튜디오에서 지정된 줄에서 열도록 사용됩니다.인수로 라인이 지정되지 않으면 기본값은 1입니다.

  • 플러그인 보안

    컨텍스트 도움말 창을 열어 연결된 위키 페이지로 이동합니다. url

  • 플러그인 보안

    사용자의 현재 선택에 대한 업로드 창을 엽니다.

  • SelectRibbonTool(tool : Enum.RibbonTool,position : UDim2):()
    플러그인 보안

    지정된 Roblox Studio 도구를 활성화합니다.

  • Separate(objects : Instances):Instances
    플러그인 보안

    지정된 UnionOperations를 분리하고 결과 부품을 반환합니다.

  • SetSetting(key : string,value : Variant):()
    플러그인 보안

    지정된 키에서 나중에 사용할 특정 값을 저장합니다. 스튜디오가 닫혀도 값은 유지됩니다.

  • StartDrag(dragData : Dictionary):()
    플러그인 보안

    매개 변수 사전을 제공하여 드래그 작업을 시작합니다.

  • Union(objects : Instances):Instance
    플러그인 보안

    지정된 부품을 결합하고 결과 UnionOperation을 반환합니다.

  • 생성
    플러그인 보안

    생성하는 DockWidgetPluginGui 에게 주어진 DockWidgetPluginGuiInfo .

  • 생성
    플러그인 보안

    사용자에게 에 로드할 수 있는 .fbx 애니메이션 파일을 열도록 요청한 다음 애니메이션을 에 삽입합니다.

  • 생성
    플러그인 보안

    사용자에게 .fbx 파일을 열도록 요청하고, 모델의 개별 구성 요소를 메쉬로 업로드하고, 애니메이션에서 사용할 캐릭터 리그를 생성하여 Workspace에 로드합니다.

  • 생성
    플러그인 보안

    Roblox Studio에서 창을 열어 사용자에게 지정된 assetType에 따라 자산을 선택하도록 요청합니다.선택된 자산ID 또는 창이 닫혔으면 -1을 반환합니다.

  • PromptSaveSelection(suggestedFileName : string):boolean
    생성
    플러그인 보안

    사용자에게 지정된 파일 이름으로 현재 선택 사항을 저장하도록 요청합니다. 사용자가 파일을 저장했는지 여부를 확인하려면 true를 반환합니다.

이벤트

속성

CollisionEnabled

읽기 전용
복제되지 않음
병렬 읽기

사용자가 모델 탭에서 Studio에서 Collisions를 활성화했는지 여부를 반환합니다.

DisableUIDragDetectorDrags

Roblox 스크립트 보안
병렬 읽기

GridSize

읽기 전용
복제되지 않음
병렬 읽기

사용자가 도구 모음의 모델 또는 아바타 탭에서 Studio에서 설정한 그리드 스냅 크기를 반환합니다.이 속성에는 약간의 반올림 오류가 있을 수 있습니다; 예를 들어, 사용자 설정의 경우 또는 사용자 설정의 경우 또는 일 수 있습니다.

IsDebuggable

Roblox 스크립트 보안
병렬 읽기

메서드

Activate

()
플러그인 보안

이 함수는 호출 플러그인의 상태를 활성화로 설정합니다. 플러그인을 활성화하면 Plugin:GetMouse() 메서드를 통해 마우스 제어가 가능해집니다.

지정된 시점에 활성화된 플러그인이 0개 또는 1개뿐입니다.플러그인을 활성화하면 다른 모든 플러그인이 비활성화됩니다(그들은 Plugin.Deactivation 이벤트를 받게 됩니다).

참조하세요:

  • Plugin:IsActivatedWithExclusiveMouse() , 이 플러그인이 현재 독점 마우스로 활성화되어 있고 이 함수를 통해 활성화된 후 이 함수를 통해 활성화되면 진실을 반환합니다
  • Plugin.Unloading , 플러그인이 비활성화되거나 업데이트되어 제거되기 전에 플러그인이 즉시 발사됩니다

매개 변수

exclusiveMouse: boolean

전용 마우스로 플러그인을 활성화할지 여부를 지정하는 부울입니다. 참이면 를 통해 검색할 수 있습니다.

기본값: ""

반환

()

CreatePluginAction

플러그인 보안

이 함수는 Roblox Studio에서 일반적으로 수행 가능한 작업을 나타내는 개체인 PluginAction를 생성하며, 직접 연결되지 않은 Toolbar 또는 Enum.Button 없습니다.Roblox Studio에서는 File → Advanced → Customize Shortcuts… 아래에 키보드 단축키를 할당할 수 있으며, 빠른 액세스 도구 모음에도 추가할 수 있습니다.

액션이 트리거되면 PluginAction.Triggered 이벤트가 신호됩니다.

플러그인 액션이 예상대로 작동하려면 이 함수를 사용하여 생성해야 합니다.

참조하세요:

  • PluginMenu , Studio에 표시되는 플러그인 작업 목록과 하위 메뉴를 지원하는 컨텍스트 메뉴
  • Plugin:CreatePluginMenu() , 플러그인 메뉴를 생성합니다

매개 변수

actionId: string

이 PluginAction을 다른 것과 구별하는 고유한 문자열이어야 합니다.

기본값: ""
text: string

액션의 표시된 이름.

기본값: ""
statusTip: string

액션표시된 설명.

기본값: ""
iconName: string

플러그인을 표시하는 데 사용되는 아이콘의 이름.

기본값: ""
allowBinding: boolean

PluginAction 가 Studio의 바로가기 뷰에서 숨겨지는지 여부. 컨텍스트 작업에 유용합니다. 기본값은 true입니다.

기본값: true

반환

코드 샘플

This code sample visualizes how to create a PluginAction. These must be created using the Plugin:CreatePluginAction() method in order to work.

In order to work as expected, the code block must but pasted into the Command Bar, but only once. Consecutive attempts at executing the code in the Command Bar will result in an error because a plugin cannot create more than one PluginMenu with the same ID.

When the created action is bound and Triggered, it outputs Hello world!.

Creating a PluginAction

local pluginAction = plugin:CreatePluginAction(
"HelloWorldAction",
"Hello World",
"Prints a 'Hello world!'",
"rbxasset://textures/sparkle.png",
true
)
pluginAction.Name = "Test Action"
local function actionTriggered()
print("Hello world!")
end
pluginAction.Triggered:Connect(actionTriggered)

CreatePluginMenu

플러그인 보안

이 함수는 새로운 PluginMenu 를 생성하여 Studio에 표시될 수 있는 컨텍스트 메뉴를 만들고, 목록의 PluginActions 및 하위 메뉴를 지원합니다.

플러그인 메뉴가 예상대로 작동하려면 이 함수를 사용하여 만들어야 합니다.

참조하세요:

매개 변수

id: string

메뉴에 대한 고유 ID.

기본값: ""
title: string

하위 메뉴로 사용할 때 표시되는 텍스트.

기본값: ""
icon: string

하위 메뉴로 사용할 때 표시되는 아이콘.

기본값: ""

반환

코드 샘플

This code sample visualizes how PluginMenus and PluginActions behave when created for a Plugin. Outside of this example, you should not parent the plugin or its functional components to the experience's workspace.

In order to work as expected, the code block must but pasted into the Command Bar, but only once. Consecutive attempts at executing the code in the Command Bar will result in an error because a plugin cannot create more than one PluginMenu with the same ID.

After executing the code, changing the created BoolValue in the experience's workspace opens the plugin's menus. Selecting an action from the menus the function connected to the trigger signal.

Creating a PluginMenu and PluginMenuAction

-- This code can be pasted into the command bar, but only once
local pluginMenu = plugin:CreatePluginMenu(math.random(), "Test Menu")
pluginMenu.Name = "Test Menu"
pluginMenu:AddNewAction("ActionA", "A", "rbxasset://textures/loading/robloxTiltRed.png")
pluginMenu:AddNewAction("ActionB", "B", "rbxasset://textures/loading/robloxTilt.png")
local subMenu = plugin:CreatePluginMenu(math.random(), "C", "rbxasset://textures/explosion.png")
subMenu.Name = "Sub Menu"
subMenu:AddNewAction("ActionD", "D", "rbxasset://textures/whiteCircle.png")
subMenu:AddNewAction("ActionE", "E", "rbxasset://textures/icon_ROBUX.png")
pluginMenu:AddMenu(subMenu)
pluginMenu:AddSeparator()
pluginMenu:AddNewAction("ActionF", "F", "rbxasset://textures/sparkle.png")
local toggle = Instance.new("BoolValue")
toggle.Name = "TogglePluginMenu"
toggle.Parent = workspace
local function onToggled()
if toggle.Value then
toggle.Value = false
local selectedAction = pluginMenu:ShowAsync()
if selectedAction then
print("Selected Action:", selectedAction.Text, "with ActionId:", selectedAction.ActionId)
else
print("User did not select an action!")
end
end
end
toggle.Changed:Connect(onToggled)

CreateToolbar

플러그인 보안

CreateToolbar 함수는 지정된 이름으로 새로운 를 생성합니다. 그런 다음 도구 모음을 사용하여 플러그인 버튼을 만들 수 있습니다.

매개 변수

name: string

도구 모음의 가시적 텍스트로, 내부에 버튼 그룹을 식별합니다.

기본값: ""

반환

코드 샘플

This code creates a toolbar with the name "ExampleToolbar".

Plugin:CreateToolbar

plugin:CreateToolbar("ExampleToolbar")

Deactivate

()
플러그인 보안

플러그인을 비활성화합니다. 활성화되었다면 연결된 PluginMouse를 분리합니다

참조하세요:

  • Plugin:Activate() , 호출 플러그인의 상태를 활성화로 설정
  • Plugin.Deactivation , 플러그인이 비활성화될 때 발생
  • Plugin.Unloading , 플러그인이 비활성화되거나 업데이트되어 제거되기 전에 플러그인이 즉시 발사됩니다

반환

()
플러그인 보안

사용자가 Studio의 모델 탭에서 설정한 Enum.JointCreationMode를 반환합니다.


반환

GetMouse

플러그인 보안

GetMouse 는 플러그인이 활성화된 상태에서 사용할 수 있는 PluginMouse를 반환합니다. while 플러그인은 활성화된 상태에서 사용할 수 있는 Plugin:Activate()입니다.


반환

코드 샘플

This code would print Button 1 pressed from PluginMouse each time the mouse's left button was clicked.

Plugin:GetMouse

local mouse = plugin:GetMouse()
local function button1Down()
print("Button 1 pressed from PluginMouse")
end
mouse.Button1Down:Connect(button1Down)

GetSelectedRibbonTool

플러그인 보안

GetSelectedRibbonTool은 현재 선택된 Enum.RibbonTool를 반환합니다.특정 도구에 해당하는 Enum을 반환합니다.이는 도구가 Plugin:SelectRibbonTool()를 통해 수동으로 선택되었는지 프로그래밍 방식으로 선택되었는지 여부를 반환합니다.


반환

코드 샘플

This code must be run from a plugin. This code selects the move tool, checks which tool is selected, then prints out to the console which tool is selected. SelectRibbonTool will not return the value until the next frame.

Plugin:GetSelectedRibbonTool

plugin:SelectRibbonTool(Enum.RibbonTool.Move, UDim2.new())
task.wait() -- wait for next frame
local selectedRibbonTool = plugin:GetSelectedRibbonTool()
print("The selected RibbonTool is", selectedRibbonTool)

GetSetting

Variant
플러그인 보안

지정된 키로 이전에 저장된 값을 검색하거나, 지정된 키가 존재하지 않으면 nil 입니다.

동일한 플러그인의 여러 인스턴스가 동시에 실행될 수 있기 때문에(예를 들어, 여러 Studio 창이 열려 있으면) 이 값이 시간이 지남에 동일하게 유지되는 것에 의존해서는 안 됩니다.다른 플러그인 인스턴스는 언제든지 설정을 업데이트할 수 있습니다.

이 호출은 동일한 플러그인의 여러 인스턴스가 데이터를 읽고 쓰는 경우 조용히 실패하고 nil 반환할 수 있습니다.플러그인이 자주 설정에 쓰기를 예상하는 경우, 잠시 후에 이 호출에서 반환된 값을 확인하여 일시적으로 사용할 수 없는 설정과 존재하지 않는 설정을 구분해야 합니다.

매개 변수

key: string
기본값: ""

반환

Variant

코드 샘플

The below example would print the value saved to the key FirstTime. If the key doesn't exist, it would print nil.

Plugin:GetSetting

local RAN_BEFORE_KEY = "RanBefore"
local didRunBefore = plugin:GetSetting(RAN_BEFORE_KEY)
if didRunBefore then
print("Welcome back!")
else
plugin:SetSetting(RAN_BEFORE_KEY, true)
print("Welcome! Thanks for installing this plugin!")
end

Intersect

플러그인 보안

매개 변수

objects: Instances
기본값: ""

반환

IsActivated

플러그인 보안

이 함수는 이 플러그인이 현재 활성화된 경우 Plugin:Activate() 함수를 통해 활성화된 후 true를 반환합니다.


반환

플러그인이 현재 활성인지를 나타내는 부울입니다.

IsActivatedWithExclusiveMouse

플러그인 보안

이 함수는 이 플러그인이 현재 전용 마우스로 활성화되어 있고, Plugin:Activate() 함수를 통해 활성화된 후에 이 플러그인이 독점적으로 활성화되면 true를 반환합니다.이것이 참으로 반환되면 PluginMouse를 통해 Plugin:GetMouse()에서 검색할 수 있습니다.

참조하세요:

  • Plugin.Deactivation , 플러그인이 비활성화될 때 발생
  • Plugin.Unloading , 플러그인이 비활성화되거나 업데이트되어 제거되기 전에 플러그인이 즉시 발사됩니다

반환

이 플러그인이 현재 독점 마우스로 활성화되었는지 여부.

Negate

Instances
플러그인 보안

제공된 부품을 부정하고 결과적인 부정 작업을 반환합니다.

매개 변수

objects: Instances
기본값: ""

반환

Instances

OpenScript

()
플러그인 보안

주어진 스크립트 인스턴스를 편집기 창에서 Roblox 스튜디오에서 지정된 줄에서 열도록 사용됩니다.인수로 라인이 지정되지 않으면 기본값은 1입니다.

매개 변수

기본값: ""
lineNumber: number
기본값: 1

반환

()

코드 샘플

The following would open a newly created Script in Workspace, assuming the variable "Plugin" was already declared.

Plugin:OpenScript

local newScript = Instance.new("Script")
newScript.Parent = workspace
plugin:OpenScript(newScript)

OpenWikiPage

()
플러그인 보안

컨텍스트 도움말 창을 열어 연결된 위키 페이지로 이동합니다. url

매개 변수

url: string
기본값: ""

반환

()

코드 샘플

The following, when executed in a plugin, will open the BasePart API page in the context help.

Plugin:OpenWikiPage

plugin:OpenWikiPage("API:Class/BasePart")

SaveSelectedToRoblox

()
플러그인 보안

사용자의 현재 선택에 대한 업로드 창을 엽니다.


반환

()

SelectRibbonTool

()
플러그인 보안

지정된 Roblox Studio 도구를 활성화합니다. 도구가 창을 열면 위치 매개 변수가 화면에 표시될 위치를 지정합니다.

참고:

  • 이것이 올바르게 작동하려면 개체를 선택해야 합니다.
  • position 속성의 규모 필드를 변경하면 대화 상자에 영향을 주지 않습니다.

매개 변수

기본값: ""
position: UDim2
기본값: ""

반환

()

Separate

Instances
플러그인 보안

지정된 UnionOperations를 분리하고 결과 부품을 반환합니다.

매개 변수

objects: Instances
기본값: ""

반환

Instances

SetSetting

()
플러그인 보안

지정된 키에서 나중에 사용할 특정 값을 저장합니다.값은 Roblox Studio가 닫혀도 유지됩니다.이러한 설정은 문자열 키가 있는 맵으로 JSON 형식으로 저장됩니다.숫자 키를 먼저 문자열로 변환하여 배열이 자동으로 맵으로 변환됩니다. Arrays are automatically converted to maps by converting the numeric keys to strings first.

JSON 형식에는 설정 파일을 손상시킬 수 있는 다음 문자를 포함하여 추가 제한이 적용됩니다:

  • 특히 키나 값에서 백슬래시(\)와 따옴표 탈출(\")이 특히 발생합니다.
  • 키에서 새 줄( \n )입니다.
  • 키에서 인용구( " )입니다.
  • 키에서 기간( . )입니다.

동일한 플러그인의 여러 인스턴스가 데이터를 읽고 쓰는 동안 침묵적으로 이 호출이 실패할 수 있습니다.플러그인이 자주 설정에 쓰기를 예상하는 경우 Plugin:GetSetting()를 호출하여 데이터가 올바르게 기록되었는지 확인할 수 있습니다.

매개 변수

key: string
기본값: ""
value: Variant
기본값: ""

반환

()

코드 샘플

This code sample demonstrates use of the Plugin:GetSetting() and Plugin:SetSetting() functions. They detect if a plugin is running for the first time by setting a key. If the key is true, it prints a "welcome back" message; otherwise it prints a "first run" message and sets the key to true.

Plugin:GetSetting and Plugin:SetSetting

local RAN_BEFORE_KEY = "RunBefore"
local hasRunBefore = plugin:GetSetting(RAN_BEFORE_KEY)
if hasRunBefore then
print("Welcome back!")
else
print("Thanks for installing this plugin!")
plugin:SetSetting(RAN_BEFORE_KEY, true)
end

StartDrag

()
플러그인 보안

StartDrag 는 매개 변수 사전을 사용하여 드래그 작업을 시작합니다. 매개 변수는 다음과 같습니다.


<th>유형</th>
<th>기본</th>
<th>설명</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>발신자</b></td><td>문자열</td><td><code>""</code></td>
<td>
드래그 작업의 원본을 드롭 대상으로 식별
</td>
</tr>
<tr>
<td><b>MimeType</b></td><td>문자열</td><td><code>""</code></td>
<td>
MIME <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types">유형의</a><b>데이터</b>.
</td>
</tr>
<tr>
<td><b>데이터</b></td><td>문자열</td><td><code>""</code></td>
<td>
예를 들어 끌어지는 항목에 대한 드래그 액션정보. 드롭 대상에서 사용해야 합니다.
</td>
</tr>
<tr>
<td><b>마우스 아이콘</b></td><td><code>데이터 유형.콘텐츠</code> ></td><td><code>""</code> ></td>
<td>
드래그 중에 마우스 커서로 사용할 아이콘입니다. 비어 있으면 기본 커서를 사용합니다.
</td>
</tr>
<tr>
<td><b>아이콘 끌기</b></td><td><code>데이터 유형.콘텐츠</code> ></td><td><code>""</code> ></td>
<td>
드래그 중에 마우스 커서 아래에 렌더링되는 이미지. 이것은 드래그되는 아이템을 나타내야 합니다.
</td>
</tr>
<tr>
<td><b>핫스팟</b></td><td><code>데이터 유형.Vector2</code></td><td><code>데이터 유형.Vector2.new(0, 0)</code> ></td>
<td>
커서가 <b>드래그 아이콘</b>을 "유지"해야 하는 왼쪽 상단의 픽셀 오프셋.
</td>
</tr>
</tbody>
이름

참조하세요:

매개 변수

dragData: Dictionary
기본값: ""

반환

()

코드 샘플

This code sample creates two plugin widget windows: a drag source and a drop target. In the source window, the script creates a TextBox and TextButton to allow the user to begin a plugin drag action. The drop target window will display the MimeType of whatever is dragged into it using a TextLabel. If the MimeType is text/plain, it will display the plain text data instead.

To run this code sample as a plugin, paste it into a Script. Then, right-click the script in the Explorer window and choose "Save as Local Plugin".

Plugin Drag and Drop

assert(plugin, "This script must be run as a Studio plugin")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGui("Drag Source", widgetInfo)
dragSourceWidget.Title = "Drag Source"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hello, plugin drags"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Edit the text above, then start drag here"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- This widget will receive drops
local dragTargetWidget = plugin:CreateDockWidgetPluginGui("Drop Target", widgetInfo)
dragTargetWidget.Title = "Drop Target"
-- This TextLabel will display what was dropped
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Drop here..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)
플러그인 보안

지정된 부품을 결합하고 결과 UnionOperation을 반환합니다.

매개 변수

objects: Instances
기본값: ""

반환

CreateDockWidgetPluginGui

생성
플러그인 보안

CreateDockWidgetPluginGui 는 지정된 DockWidgetPluginGui 에서 새로운 DockWidgetPluginGuiInfo 를 생성합니다.첫 번째 매개 변수, pluginGuiId ,는 고유하고 일관된 문자열이어야 합니다.위젯의 도크 상태와 기타 내부 세부 정보를 저장하는 데 사용됩니다.

매개 변수

pluginGuiId: string

위젯의 도크 상태 및 기타 내부 세부 정보를 저장하는 데 사용되는 고유하고 일관된 식별자.

기본값: ""
dockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo

생성하기 위한 DockWidgetPluginGui 를 설명합니다(초기 상태, 크기 등).

기본값: ""

반환

코드 샘플

This code, when ran inside a Plugin, creates a DockWidgetPluginGui with a simple TextButton.

Widget GUI Text Button

-- Create new 'DockWidgetPluginGuiInfo' object
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float, -- Widget will be initialized in floating panel
true, -- Widget will be initially enabled
false, -- Don't override the previous enabled state
200, -- Default width of the floating window
300, -- Default height of the floating window
150, -- Minimum width of the floating window (optional)
150 -- Minimum height of the floating window (optional)
)
-- Create new widget GUI
local testWidget = plugin:CreateDockWidgetPluginGui("TestWidget", widgetInfo)
local testButton = Instance.new("TextButton")
testButton.BorderSizePixel = 0
testButton.TextSize = 20
testButton.TextColor3 = Color3.new(1, 0.2, 0.4)
testButton.AnchorPoint = Vector2.new(0.5, 0.5)
testButton.Size = UDim2.new(1, 0, 1, 0)
testButton.Position = UDim2.new(0.5, 0, 0.5, 0)
testButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
testButton.Text = "Click Me"
testButton.Parent = testWidget

ImportFbxAnimation

생성
플러그인 보안

이 함수는 사용자에게 에 로드할 수 있는 .fbx 애니메이션 파일을 열도록 요청하고, 그런 다음 애니메이션을 에 삽입합니다.

매개 변수

rigModel: Instance
기본값: ""
isR15: boolean
기본값: true

반환

ImportFbxRig

생성
플러그인 보안

사용자에게 .fbx 파일을 열도록 요청하고, 모델의 개별 구성 요소를 메쉬로 업로드하고, 애니메이션에서 사용할 캐릭터 리그를 생성하여 Workspace에 로드합니다.

매개 변수

isR15: boolean
기본값: true

반환

PromptForExistingAssetId

생성
플러그인 보안

Roblox Studio에서 창을 열어 사용자에게 지정된 assetType에 따라 자산을 선택하도록 요청합니다.선택된 자산ID 또는 창이 닫혔으면 -1을 반환합니다.

매개 변수

assetType: string
기본값: ""

반환

PromptSaveSelection

생성
플러그인 보안

사용자에게 지정된 파일 이름으로 현재 선택 사항을 저장하도록 요청합니다. 사용자가 파일을 저장했는지 여부를 확인하려면 true를 반환합니다.

매개 변수

suggestedFileName: string
기본값: ""

반환

이벤트

Deactivation

플러그인 보안

Plugin 가 비활성화되면 해고됩니다.이는 플러그인 코드가 Plugin:Deactivate()를 호출하거나, 다른 플러그인이 Plugin:Activate()을 호출하여 모든 다른 플러그인이 활성 상태를 잃게 되는 경우에 발생합니다.

참조하세요:

  • Plugin.Unloading , 플러그인이 비활성화되거나 업데이트되어 제거되기 전에 플러그인이 즉시 발사됩니다

Unloading

플러그인 보안

이 이벤트는 중지하기 전에 즉시 Plugin 실행이 중지되기 전에 발생합니다.플러그인은 비활성화, 제거, 업데이트 예정 또는 장소가 닫힐 때 로드가 해제됩니다.

스크립트 실행이 중지되기 전에 플러그인이 자신을 정리할 수 있도록 합니다(예:불필요한 인스턴스를 DataModel에서 제거하려면.플러그인이 제대로 정리되지 않으면 이전 복사본이 남아 있습니다.이런 일이 발생하면 사용자는 나쁜 사용자 경험인 장소를 닫고 다시 열도록 강요받을 수 있습니다.

플러그인과 관련된 인스턴스(PluginToolbarButtons, DockWidgetPluginGuis, PluginGuis)는 플러그인이 로드되지 않을 때 자동으로 정리되므로 제거할 필요가 없습니다.