model/blend: bone / path split ends at the first unescaped '"]' (constraint paths kept whole in path)

This commit is contained in:
4DBug committed 2026-11-03 00:57:28 -06:00
1 parent 888ff212c3
commit d64adc978f
10 files changed
+475 -391

No files matched your search

+24 -6
View File
@@ -164325,11 +164325,29 @@ local lo, hi = math.huge, -math.huge
return lo, hi
end
-- RNA path 'kind["name"].rest': name ends at the first unescaped '"]', rest may hold more subscripts
function Anim.split(path)
local kind, name, rest = string.match(path, '^(%w[%w_%.]-)%["(.-)"%]%.([%w_]+)$')
if kind and name and rest then
name = string.gsub(name, '\\(.)', "%1")
return kind, name, rest
local kind, at = string.match(path, '^(%w[%w_%.]-)%["()')
if kind then
local i = at
while true do
local q = string.find(path, '"', i, true)
if not q then
break
end
local bs = 0
while q - bs - 1 >= at and string.byte(path, q - bs - 1) == 92 do
bs =bs+ 1
end
if bs % 2 == 0 then
if string.sub(path, q + 1, q + 2) == "]." and q + 3 <= #path then
local name = string.gsub(string.sub(path, at, q - 1), '\\(.)', "%1")
return kind, name, string.sub(path, q + 3)
end
break
end
i = q + 1
end
end
return nil, nil, path
end
@@ -167618,8 +167636,8 @@ local track = { translation = {}, rotation = {}, scale = {} }
local tracks = {}
local touched = {}
for _, c in __iter(j.curves) do
local kind, who = Anim.split(c.path)
if kind == "pose.bones" and who and info.names[who] then
local kind, who, rest = Anim.split(c.path)
if kind == "pose.bones" and who and info.names[who] and string.find(rest, "^[%w_]+$") then
touched[info.names[who] ] = true
end
end