@quenty/modeltransparencyeffect 11.13.0 → 11.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [11.14.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/modeltransparencyeffect@11.13.0...@quenty/modeltransparencyeffect@11.14.0) (2026-04-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Expand LocalTransparencyModifier support ([1d2bc4d](https://github.com/Quenty/NevermoreEngine/commit/1d2bc4d75a954486c0b8a9c160d06476ca47e2e6))
12
+
13
+
14
+
15
+
16
+
6
17
  # [11.13.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/modeltransparencyeffect@11.12.0...@quenty/modeltransparencyeffect@11.13.0) (2026-02-20)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/modeltransparencyeffect
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/modeltransparencyeffect",
3
- "version": "11.13.0",
3
+ "version": "11.14.0",
4
4
  "description": "Allows a model to have transparent set locally on the client",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -30,6 +30,9 @@
30
30
  "dependencies": {
31
31
  "@quenty/acceltween": "2.7.0",
32
32
  "@quenty/baseobject": "10.12.0",
33
+ "@quenty/enums": "1.2.0",
34
+ "@quenty/hide": "11.35.0",
35
+ "@quenty/instanceutils": "13.28.0",
33
36
  "@quenty/loader": "10.10.0",
34
37
  "@quenty/servicebag": "11.16.0",
35
38
  "@quenty/steputils": "3.6.3",
@@ -38,5 +41,5 @@
38
41
  "publishConfig": {
39
42
  "access": "public"
40
43
  },
41
- "gitHead": "305e70aba3395b2f94f500c731327760984aeb4f"
44
+ "gitHead": "f8273b1b201921976953174e30958440e44e64cb"
42
45
  }
@@ -1,6 +1,6 @@
1
1
  --!nonstrict
2
2
  --[=[
3
- Allows a model to have transparent set locally on the client
3
+ Allows a model to have transparency set locally on the client
4
4
 
5
5
  @client
6
6
  @class ModelTransparencyEffect
@@ -10,6 +10,9 @@ local require = require(script.Parent.loader).load(script)
10
10
 
11
11
  local AccelTween = require("AccelTween")
12
12
  local BaseObject = require("BaseObject")
13
+ local HideUtils = require("HideUtils")
14
+ local ModelTransparencyMode = require("ModelTransparencyMode")
15
+ local RxInstanceUtils = require("RxInstanceUtils")
13
16
  local ServiceBag = require("ServiceBag")
14
17
  local StepUtils = require("StepUtils")
15
18
  local TransparencyService = require("TransparencyService")
@@ -18,15 +21,13 @@ local ModelTransparencyEffect = setmetatable({}, BaseObject)
18
21
  ModelTransparencyEffect.ClassName = "ModelTransparencyEffect"
19
22
  ModelTransparencyEffect.__index = ModelTransparencyEffect
20
23
 
21
- export type TransparencyMode = "SetTransparency" | "SetLocalTransparencyModifier"
22
-
23
24
  export type ModelTransparencyEffect =
24
25
  typeof(setmetatable(
25
26
  {} :: {
26
27
  _serviceBag: ServiceBag.ServiceBag,
27
28
  _transparency: AccelTween.AccelTween,
28
29
  _transparencyService: TransparencyService.TransparencyService,
29
- _transparencyServiceMethodName: TransparencyMode,
30
+ _transparencyServiceMethodName: ModelTransparencyMode.ModelTransparencyMode,
30
31
  _parts: { [Instance]: boolean },
31
32
  _startAnimation: (self: ModelTransparencyEffect) -> (),
32
33
  },
@@ -43,7 +44,7 @@ export type ModelTransparencyEffect =
43
44
  function ModelTransparencyEffect.new(
44
45
  serviceBag: ServiceBag.ServiceBag,
45
46
  adornee: Instance,
46
- transparencyServiceMethodName: TransparencyMode?
47
+ transparencyServiceMethodName: ModelTransparencyMode.ModelTransparencyMode?
47
48
  ): ModelTransparencyEffect
48
49
  assert(adornee, "Bad adornee")
49
50
 
@@ -52,14 +53,14 @@ function ModelTransparencyEffect.new(
52
53
  self._serviceBag = assert(serviceBag, "No serviceBag")
53
54
 
54
55
  assert(
55
- type(transparencyServiceMethodName) == "string" or transparencyServiceMethodName == nil,
56
+ ModelTransparencyMode:IsValue(transparencyServiceMethodName) or transparencyServiceMethodName == nil,
56
57
  "Bad transparencyServiceMethodName"
57
58
  )
58
59
 
59
60
  self._transparencyService = self._serviceBag:GetService(TransparencyService :: any)
60
61
 
61
62
  self._transparency = AccelTween.new(20)
62
- self._transparencyServiceMethodName = transparencyServiceMethodName or "SetTransparency"
63
+ self._transparencyServiceMethodName = transparencyServiceMethodName or ModelTransparencyMode.TRANSPARENCY
63
64
 
64
65
  self._startAnimation, self._maid._stop = StepUtils.bindToRenderStep(self._update)
65
66
 
@@ -155,32 +156,36 @@ function ModelTransparencyEffect._setupParts(self: ModelTransparencyEffect)
155
156
 
156
157
  self._parts = {}
157
158
 
158
- if self._obj:IsA("BasePart") or self._obj:IsA("Decal") then
159
- self._parts[self._obj] = true
160
- end
159
+ local transparencyServiceMethod = self._transparencyService[self._transparencyServiceMethodName]
161
160
 
162
- for _, part in self._obj:GetDescendants() do
163
- if part:IsA("BasePart") or part:IsA("Decal") then
164
- self._parts[part] = true
165
- end
161
+ local function canHide(part: Instance): boolean
162
+ return if (self._transparencyServiceMethodName == ModelTransparencyMode.LOCAL_TRANSPARENCY)
163
+ then HideUtils.hasLocalTransparencyModifier(part)
164
+ else (part:IsA("BasePart") or part:IsA("Decal"))
166
165
  end
167
166
 
168
- self._maid:GiveTask(self._obj.DescendantAdded:Connect(function(child)
169
- if child:IsA("BasePart") or child:IsA("Decal") then
170
- self._parts[child] = true
171
- self:_startAnimation()
172
- end
173
- end))
167
+ if canHide(self._obj) then
168
+ self._parts[self._obj] = true
169
+ end
174
170
 
175
- self._maid:GiveTask(self._obj.DescendantRemoving:Connect(function(child)
176
- if self._transparencyService:IsDead() then
171
+ self._maid:GiveTask(RxInstanceUtils.observeDescendantsBrio(self._obj, canHide):Subscribe(function(brio)
172
+ if brio:IsDead() then
177
173
  return
178
174
  end
179
175
 
180
- if self._parts[child] then
181
- self._parts[child] = nil
182
- self._transparencyService[self._transparencyServiceMethodName](self._transparencyService, self, child, nil)
183
- end
176
+ local maid, part = brio:ToMaidAndValue()
177
+
178
+ self._parts[part] = true
179
+ self:_startAnimation()
180
+
181
+ maid:GiveTask(function()
182
+ if self._transparencyService:IsDead() or not self._parts[part] then
183
+ return
184
+ end
185
+
186
+ self._parts[part] = nil
187
+ transparencyServiceMethod(self._transparencyService, self, part, nil)
188
+ end)
184
189
  end))
185
190
 
186
191
  self._maid:GiveTask(function()
@@ -188,8 +193,8 @@ function ModelTransparencyEffect._setupParts(self: ModelTransparencyEffect)
188
193
  return
189
194
  end
190
195
 
191
- for part, _ in self._parts do
192
- self._transparencyService[self._transparencyServiceMethodName](self._transparencyService, self, part, nil)
196
+ for part in self._parts do
197
+ transparencyServiceMethod(self._transparencyService, self, part, nil)
193
198
  end
194
199
  end)
195
200
  end
@@ -0,0 +1,15 @@
1
+ --!strict
2
+ --[=[
3
+ @class ModelTransparencyMode
4
+ ]=]
5
+
6
+ local require = require(script.Parent.loader).load(script)
7
+
8
+ local SimpleEnum = require("SimpleEnum")
9
+
10
+ export type ModelTransparencyMode = "SetTransparency" | "SetLocalTransparencyModifier"
11
+
12
+ return SimpleEnum.new({
13
+ TRANSPARENCY = "SetTransparency" :: "SetTransparency",
14
+ LOCAL_TRANSPARENCY = "SetLocalTransparencyModifier" :: "SetLocalTransparencyModifier",
15
+ })