Hello. I've got an issue with channels in vertex paint. The solution was to swap vertex color channel data with illum channel data. I'm wondering, if there's a script to do such thing for me as there're too many models with this issue. I would also appreciate any advice on how to do this script.
Thanks.
Solved! Go to Solution.
Solved by denisT.MaxDoctor. Go to Solution.
Here is all what you need to swap texture channels.
fn copyChannel node type:3 targetChannel: sourceChannel: clear:off =
(
if meshop.getMapSupport node.mesh targetChannel do
(
if sourceChannel == #new do
(
ChannelInfo.AddChannel node
sourceChannel = (meshop.getnummaps node.mesh) - 1
node.modifiers[1].name = "add CH(" + sourceChannel as string + ")"
)
ChannelInfo.CopyChannel node type targetChannel
ChannelInfo.PasteChannel node type sourceChannel
node.modifiers[1].name = "copy CH(" + targetChannel as string + ")->" + "CH(" + sourceChannel as string + ")"
if clear do
(
ChannelInfo.ClearChannel node targetChannel
node.modifiers[1].name = "clear CH(" + targetChannel as string + ")"
)
sourceChannel
)
)
mapped fn swapChannels node ch_a ch_b collapse:off =
(
if iskindof node GeometryClass and not iskindof node Targetobject do
(
-- suspendEditing()
tempChannel = copyChannel node targetChannel:ch_a sourceChannel:#new
copyChannel node targetChannel:ch_b sourceChannel:ch_a
copyChannel node targetChannel:tempChannel sourceChannel:ch_b clear:on
if collapse do collapsestack node
-- resumeEditing()
)
)
/*
--EXAMPLE 1 -- swap illum channel (-1) and vertex color channel (0) with no collapse for selected geometry nodes:
(
swapChannels $ -1 0 collapse:off
)
*/
/*
--EXAMPLE 2 -- swap illum channel (-1) and vertex color channel (0) with collapse for all geometry node in scene:
(
swapChannels (geometry as array) -1 0 collapse:on
)
*/
in the swapChannels function "suspend" and "resume" editing are commented. You can use "suspend - resume" option for a final version, but it doesn't really make sense for multi nodes editing.
This is how to swap channels in the current scene. For multiple scenes you need to make a "batch" script. But before that, you must provide the rule for which nodes you need “channel swapping”. The script should use this rule to search for processing nodes.
Can't find what you're looking for? Ask the community or share your knowledge.