Page 1 of 1

Check when a channel is from the camera?

Posted: Tue Aug 28, 2018 1:01 pm
by Víctor Paredes
Hi, I just received this question and it would be great if you could help me with it:
I'm iterating through all the channels in the document. Is there any way to check whether a channel is a camera channel or not?

Thank you very much!

Re: Check when a channel is from the camera?

Posted: Tue Aug 28, 2018 4:36 pm
by synthsin75

Code: Select all

	local chanCnt = moho.layer:CountChannels()-1
	local ch = MOHO.MohoLayerChannel:new_local()
	for i=0, chanCnt do
		moho.layer:GetChannelInfo(i, ch)
		if (string.match(ch.name:Buffer(), "(Camera).+")) then
			print(ch.name:Buffer())
		end
	end

Re: Check when a channel is from the camera?

Posted: Tue Aug 28, 2018 4:48 pm
by hayasidist
or check channelID for one of the global constants

CHANNEL_CAMERA_PANTILT
CHANNEL_CAMERA_ROLL
CHANNEL_CAMERA_TRACK
CHANNEL_CAMERA_ZOOM

e.g.

Code: Select all

for i = 0, numCh - 1 do
		local chInfo = MOHO.MohoLayerChannel:new_local()
		moho.layer:GetChannelInfo(i, chInfo)
		if chInfo.channelID  == CHANNEL_CAMERA_ROLL then ...

Re: Check when a channel is from the camera?

Posted: Tue Aug 28, 2018 6:05 pm
by Víctor Paredes
Thank you very very much to both! (again!)
I think this is what we were looking for.