Skip to content

Commit

Permalink
Figured out logic for lower-arm
Browse files Browse the repository at this point in the history
  • Loading branch information
nightcycle committed Aug 4, 2024
1 parent 3cd6fa1 commit 86c5c79
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 73 deletions.
Binary file modified editable-clothing-util.rbxl
Binary file not shown.
40 changes: 30 additions & 10 deletions src/Tuner.story.luau
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local Maid = require(game:GetService("ReplicatedStorage"):WaitForChild("Packages
-- Class
return function(frame: Frame)
local maid = Maid.new()
local isAlive = true
task.spawn(function()
local Util = require(script.Parent)
local character: Model? = workspace:WaitForChild("Rig", 10) :: Model
Expand All @@ -33,6 +34,7 @@ return function(frame: Frame)
displayImage.Parent = display
return display
end
-- displayImage(clothingImage)

do
local function renderTextureImage(bodyPart: Enum.BodyPartR15, tint: Color3?)
Expand All @@ -56,15 +58,15 @@ return function(frame: Frame)
display.ImageTransparency = 0.3
display.ImageColor3 = tint or Color3.new(1, 1, 1)
end
-- do
-- renderTextureImage(Enum.BodyPartR15.RightUpperArm, Color3.new(1, 0, 0))
-- renderTextureImage(Enum.BodyPartR15.RightLowerArm, Color3.new(0, 1, 0))
-- renderTextureImage(Enum.BodyPartR15.RightHand, Color3.new(0, 0, 1))
-- end
do
renderTextureImage(Enum.BodyPartR15.UpperTorso, Color3.new(1, 0, 0))
renderTextureImage(Enum.BodyPartR15.LowerTorso, Color3.new(0, 1, 0))
-- renderTextureImage(Enum.BodyPartR15.RightUpperArm, Color3.new(1, 0, 0))
-- renderTextureImage(Enum.BodyPartR15.RightLowerArm, Color3.new(0, 1, 0))
-- renderTextureImage(Enum.BodyPartR15.RightHand, Color3.new(0, 0, 1))
end
-- do
-- renderTextureImage(Enum.BodyPartR15.UpperTorso, Color3.new(1, 0, 0))
-- renderTextureImage(Enum.BodyPartR15.LowerTorso, Color3.new(0, 1, 0))
-- end
end

do
Expand All @@ -73,6 +75,23 @@ return function(frame: Frame)
assert(appliedImage)
maid:GiveTask(appliedImage)

local surfaceAppearance = maid:GiveTask(Instance.new("SurfaceAppearance"))
surfaceAppearance.Color = tint or Color3.new(1, 1, 1)
surfaceAppearance.Parent = appliedImage.Parent
local part = surfaceAppearance.Parent
task.spawn(function()
while isAlive do
if surfaceAppearance.Parent then
surfaceAppearance.Parent = nil
else
surfaceAppearance.Parent = part
end
task.wait(0.2)
end
end)

appliedImage.Parent = surfaceAppearance

local display = displayImage(appliedImage)
display.Name = `{bodyPart}`
display.ImageTransparency = 0.6
Expand All @@ -81,9 +100,9 @@ return function(frame: Frame)
Util.bakeSkinTone(appliedImage, Color3.new(1, 0, 0))
end
-- do
-- renderAppliedImage(Enum.BodyPartR15.RightUpperArm, Color3.new(1, 0, 0))
-- renderAppliedImage(Enum.BodyPartR15.RightLowerArm, Color3.new(0, 1, 0))
-- renderAppliedImage(Enum.BodyPartR15.RightHand, Color3.new(0, 0, 1))
renderAppliedImage(Enum.BodyPartR15.RightUpperArm, Color3.new(1, 0, 0))
renderAppliedImage(Enum.BodyPartR15.RightLowerArm, Color3.new(0, 1, 0))
-- -- renderAppliedImage(Enum.BodyPartR15.RightHand, Color3.new(0, 0, 1))
-- end
-- do
-- renderAppliedImage(Enum.BodyPartR15.UpperTorso, Color3.new(1, 0, 0))
Expand All @@ -92,6 +111,7 @@ return function(frame: Frame)
end
end)
return function()
isAlive = false
maid:Destroy()
end
end
105 changes: 42 additions & 63 deletions src/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,42 @@ type TranslationRegistry = { [Enum.BodyPartR15]: { [Enum.NormalId]: TranslationD
-- local TEXTURE_SIZE = Vector2.new(585, 559)
local TRANSLATIONS: TranslationRegistry = {}
do
local TEXTURE_LOWER_ARM_HEIGHT_EXTENSION = 36
local UV_SCALE = 2

local TEXTURE_ARM_GAP_WIDTH = 2
local TEXTURE_ARM_WIDTH = 64
local TEXTURE_LOWER_ARM_HEIGHT = 36 + TEXTURE_LOWER_ARM_HEIGHT_EXTENSION

local TEXTURE_RIGHT_ARM_LEFT_START_X = 19
local TEXTURE_RIGHT_ARM_LEFT_END_X = TEXTURE_RIGHT_ARM_LEFT_START_X + TEXTURE_ARM_WIDTH

local TEXTURE_RIGHT_ARM_BACK_START_X = TEXTURE_RIGHT_ARM_LEFT_END_X + TEXTURE_ARM_GAP_WIDTH
local TEXTURE_RIGHT_ARM_BACK_END_X = TEXTURE_RIGHT_ARM_BACK_START_X + TEXTURE_ARM_WIDTH

local TEXTURE_RIGHT_ARM_RIGHT_START_X = TEXTURE_RIGHT_ARM_BACK_END_X + TEXTURE_ARM_GAP_WIDTH
local TEXTURE_RIGHT_ARM_RIGHT_END_X = TEXTURE_RIGHT_ARM_RIGHT_START_X + TEXTURE_ARM_WIDTH

local TEXTURE_RIGHT_ARM_FRONT_START_X = TEXTURE_RIGHT_ARM_RIGHT_END_X + TEXTURE_ARM_GAP_WIDTH
local TEXTURE_RIGHT_ARM_FRONT_END_X = TEXTURE_RIGHT_ARM_FRONT_START_X + TEXTURE_ARM_WIDTH

local TEXTURE_LOWER_ARM_START_Y = 408
local TEXTURE_LOWER_ARM_END_Y = TEXTURE_LOWER_ARM_START_Y + TEXTURE_LOWER_ARM_HEIGHT

local UV_ARM_WIDTH = 142
local UV_GAP_HEIGHT = 1
local UV_LOWER_ARM_HEIGHT = (TEXTURE_LOWER_ARM_HEIGHT * UV_SCALE) - UV_GAP_HEIGHT

local UV_ARM_BACKRIGHT_CORNER_X = 5
local UV_ARM_FRONTRIGHT_CORNER_X = UV_ARM_BACKRIGHT_CORNER_X + UV_ARM_WIDTH
local UV_LOWER_ARM_START_Y = 234
local UV_LOWER_ARM_END_Y = UV_LOWER_ARM_START_Y + UV_LOWER_ARM_HEIGHT

local TEXTURE_UPPER_ARM_START_Y = 355
local TEXTURE_UPPER_ARM_END_Y = 419
local TEXTURE_UPPER_ARM_TOP_START_Y = 289
local TEXTURE_UPPER_ARM_TOP_END_Y = 352

local TEXTURE_LOWER_ARM_START_Y = 417
local TEXTURE_LOWER_ARM_END_Y = 468

local TEXTURE_HAND_FRONT_START_Y = TEXTURE_LOWER_ARM_END_Y - 2
local TEXTURE_HAND_FRONT_END_Y = 483
local TEXTURE_HAND_BOTTOM_START_Y = TEXTURE_HAND_FRONT_END_Y + 2
Expand All @@ -35,15 +63,6 @@ do
local TEXTURE_LOWER_TORSO_START_Y = 170
local TEXTURE_LOWER_TORSO_END_Y = 201

local TEXTURE_RIGHT_ARM_FRONT_START_X = 217
local TEXTURE_RIGHT_ARM_FRONT_END_X = 281
local TEXTURE_RIGHT_ARM_RIGHT_START_X = 151
local TEXTURE_RIGHT_ARM_RIGHT_END_X = 215
local TEXTURE_RIGHT_ARM_BACK_START_X = 85
local TEXTURE_RIGHT_ARM_BACK_END_X = 149
local TEXTURE_RIGHT_ARM_LEFT_START_X = 19
local TEXTURE_RIGHT_ARM_LEFT_END_X = 83

local TEXTURE_TORSO_FRONT_START_X = 231
local TEXTURE_TORSO_FRONT_END_X = 358

Expand All @@ -56,11 +75,6 @@ do
local UV_RIGHT_UPPER_ARM_TOP_START_Y = 4
local UV_RIGHT_UPPER_ARM_TOP_END_Y = 130

local UV_RIGHT_LOWER_ARM_FRONTRIGHT_START_Y = 255 - 3
local UV_RIGHT_LOWER_ARM_FRONTRIGHT_END_Y = 349
local UV_RIGHT_LOWER_ARM_BACKLEFT_START_Y = 255
local UV_RIGHT_LOWER_ARM_BACKLEFT_END_Y = 349

local UV_RIGHT_HAND_FRONTLEFT_START_Y = 428
local UV_RIGHT_HAND_FRONTLEFT_END_Y = 461
local UV_RIGHT_HAND_FRONTLEFT_CORNER_X = 289
Expand Down Expand Up @@ -302,12 +316,7 @@ do
TEXTURE_RIGHT_ARM_FRONT_END_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
UV_X_2,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_START_Y,
UV_X_3,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_END_Y
),
UVArea = Rect.new(UV_X_2, UV_LOWER_ARM_START_Y, UV_X_3, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Right] = {
TextureArea = Rect.new(
Expand All @@ -317,10 +326,10 @@ do
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
UV_X_1,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_START_Y,
UV_X_2,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_END_Y
UV_ARM_BACKRIGHT_CORNER_X,
UV_LOWER_ARM_START_Y,
UV_ARM_FRONTRIGHT_CORNER_X,
UV_LOWER_ARM_END_Y
),
},
[Enum.NormalId.Back] = {
Expand All @@ -330,12 +339,7 @@ do
TEXTURE_RIGHT_ARM_BACK_END_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
430,
UV_RIGHT_LOWER_ARM_BACKLEFT_START_Y - 1,
572 + 1,
UV_RIGHT_LOWER_ARM_BACKLEFT_END_Y
),
UVArea = Rect.new(430, UV_LOWER_ARM_START_Y - 1, 572 + 1, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Left] = {
TextureArea = Rect.new(
Expand All @@ -344,12 +348,7 @@ do
TEXTURE_RIGHT_ARM_LEFT_END_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
289,
UV_RIGHT_LOWER_ARM_BACKLEFT_START_Y,
430,
UV_RIGHT_LOWER_ARM_BACKLEFT_END_Y
),
UVArea = Rect.new(289, UV_LOWER_ARM_START_Y, 430, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Top] = {
UVArea = Rect.new(5, 359, 75, 421),
Expand All @@ -366,12 +365,7 @@ do
TEXTURE_RIGHT_ARM_LEFT_END_X + TEXTURE_LEFT_ARM_OFFSET_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
UV_X_2,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_START_Y,
UV_X_3,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_END_Y
),
UVArea = Rect.new(UV_X_2, UV_LOWER_ARM_START_Y, UV_X_3, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Right] = {
TextureArea = Rect.new(
Expand All @@ -380,12 +374,7 @@ do
TEXTURE_RIGHT_ARM_FRONT_END_X + TEXTURE_LEFT_ARM_OFFSET_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
UV_X_1,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_START_Y,
UV_X_2,
UV_RIGHT_LOWER_ARM_FRONTRIGHT_END_Y
),
UVArea = Rect.new(UV_X_1, UV_LOWER_ARM_START_Y, UV_X_2, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Back] = {
TextureArea = Rect.new(
Expand All @@ -394,12 +383,7 @@ do
TEXTURE_RIGHT_ARM_RIGHT_END_X + TEXTURE_LEFT_ARM_OFFSET_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
430,
UV_RIGHT_LOWER_ARM_BACKLEFT_START_Y - 1,
572 + 1,
UV_RIGHT_LOWER_ARM_BACKLEFT_END_Y
),
UVArea = Rect.new(430, UV_LOWER_ARM_START_Y - 1, 572 + 1, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Left] = {
TextureArea = Rect.new(
Expand All @@ -408,12 +392,7 @@ do
TEXTURE_RIGHT_ARM_BACK_END_X + TEXTURE_LEFT_ARM_OFFSET_X,
TEXTURE_LOWER_ARM_END_Y
),
UVArea = Rect.new(
289,
UV_RIGHT_LOWER_ARM_BACKLEFT_START_Y,
430,
UV_RIGHT_LOWER_ARM_BACKLEFT_END_Y
),
UVArea = Rect.new(289, UV_LOWER_ARM_START_Y, 430, UV_LOWER_ARM_END_Y),
},
[Enum.NormalId.Top] = {
UVArea = Rect.new(5, 359, 75, 421),
Expand Down

0 comments on commit 86c5c79

Please sign in to comment.