Skip to content

Conversation

@jamesdeschenes
Copy link

@jamesdeschenes jamesdeschenes commented Oct 24, 2023

This is small addition to the Fusion Cryptomatte plug-in to allow it to use asterisks (*) to make matches more flexible. We have been using it internally for awhile and found it pretty useful. It would be nice if it was natively included so we don't have to port it over for every update :)

This would let you write expressions such as:

  • "prp_*" to match all objects beginning with "prp_".
  • "chr_*_eye_*" to match everything that starts with "chr_" and contains "_eye_".
  • "col_setcitybig:setcitybig_object_light_segement_*_CShape" to easily match a series of things like 001, 002, 003, etc...

@jamesdeschenes jamesdeschenes changed the title Added basic support for using * to match matte IDs Added basic support for using * to match matte IDs in Fusion Oct 24, 2023
Comment on lines +912 to +922
if string.match(matte_name, "*") then
wildcard = string.gsub(matte_name, "*", ".*.?")
for crypto_name, __ in pairs(manifest) do
wildcard_match = string.match(crypto_name, wildcard)
if wildcard_match == crypto_name then
matte_id = manifest[crypto_name]
local matte_value = module._hex_to_float(matte_id)
matte_values[matte_value] = true
end
end
end
Copy link
Collaborator

@cedricduriau cedricduriau Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jamesdeschenes

Looks like a solid idea you got there!

My only comment would be to isolate this wildcard solving logic and call it before using this function. Primary reason is to split responsibilities and keep things simple. One function to solve wildcards to their matched absolute results, and this function can stay as is considering the matte_names argument.

-- step #1: read matte list input
-- step #2: parse matte list input to proper list
-- step #3: solve wildcards
-- step #4: use existing code as is, enjoy life, proceed

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants