As Hoss illustrated, it's not possible to access the fixturetype by the GetSubfixture
() object:
https://github.com/hossimo/GMA3Pl…xtureDataObject
Has anyone figured on some other way to identify which attributes is available per each fixture?
As Hoss illustrated, it's not possible to access the fixturetype by the GetSubfixture
() object:
https://github.com/hossimo/GMA3Pl…xtureDataObject
Has anyone figured on some other way to identify which attributes is available per each fixture?
The only solution is see at the moment is to grab the fixture name, loop through all fixture types, and compare the name with the fixturetype.shortname (and then store the fixturetype index number, to later be able to use it for fetching fixture specific attributes).
But it is a really ugly solution...
UPDATE: ...and further investigation led me to the conclusion that it's not possible to figure out which attributes each fixture has, even if you have the fixtureType =\
Anyone else that has had any luck regarding this matter?
It's been a while since I looked that GetSubfixture() but I just tried again it no matter what I try I get back an error like "Could not resolve object address for {Type# Type name}" but the actual value returned is always nil.
I've done the same thing, hopefully it will get solved in the next minor version.
However, you can figure out what each fixture type includes, probably an easier way but this works:
local a = 5 -- fixture types
local b = 3 -- fixture type ID you are interested in
local c = 6 -- DMXModes
local d = 1 -- DMX mode you are interested in
local e = 1 -- DMXChannels
local f = 1 -- DMX Channel you are interested in (1 based)
local g = 1 -- Attribute
Echo(Patch()[a][b][c][d][e]:Count()) -- 25
Echo(Patch()[a][b][c][d][e][f][g].name) -- ColorRGB_R
This gives you the same info as if you were to do not sure why I can't do this in one command:
cd 11.10
cd 5.3.6.1.1
List
In my case I have a Mythos patched in FixtureType 3 and you can look at each channel and get it's attribute type.
Ah, thats one way to do it - thanks!
Btw, is your wiki open for additions? (I have investigated some more of the API that could be of service for someone)
Btw... have you figured out some way to get the index of the last created item somehow? (any object)
Btw, is your wiki open for additions? (I have investigated some more of the API that could be of service for someone)
It's not completely open to keep the spammers out, but you can either create an issue. With a little trust I can also add you as a contributor. but even with all of my spelling mistakes I'm a little OCD at times
Btw... have you figured out some way to get the index of the last created item somehow? (any object)
I haven't researched that, but I suspect not since pool items are indexed there may be other ways like looking at the undo queue (if that's even public)
Ok
I've written a standard iterator for dedecting first available ID for now...
Btw, in case you haven't found these helper functions already I'll post them (found them today):
---------------------------------------------------------------------------
help={}
---------------------------------------------------------------------------
-- Prints content of given variable (works with every type, incl. gma3-objects)
function help.dump(o,recursion)
if not recursion and type(o) == 'userdata' then
return help.dumpObj(o);
elseif type(o) == 'table' then
local s = '{\n';
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. ' ['..k..'] = ' .. help.dump(v,true) .. '\n'
end
s = s .. '\n}';
if not recursion then
help.printfWithNewline(s)
end
return s
else
if not recursion then Printf(tostring(o)) end
return tostring(o)
end
end
---------------------------------------------------------------------------
-- Prints content of gma3-object
function help.dumpObj(o)
local s = ''
-- path to object
local path = o.name;
local nextParent = o;
while nextParent:Parent() do
nextParent = nextParent:Parent();
path = nextParent.name .. "/" .. path;
end
s = s .. help.headline('Path','_',50) .. '\n';
s = s .. path .. "\n";
-- child types
local children = o.name;
local nextChild = o;
while (nextChild:Children()[1]) do
nextChild = nextChild:Children()[1];
children = children .. "->" .. nextChild:GetClass();
end
s = s .. help.headline('Children','_',50) .. '\n';
s = s .. "Child types: ".. children .. "\n";
-- list of childs
local content = '';
local i = 1;
while o[i] do
s = s .. '\tChild '..i..': Name="'..o[i].name..'", Index='..o[i].index..'\n';
i = i + 1;
end
s = s .. help.headline('Properties','_',50) .. '\n';
for i = 0, (o:PropertyCount() - 1) do
local type = 'UNKNOWN_TYPE';
local name = 'UNKNOWN_NAME';
local value = 'UNKNOWN_VALUE';
if o:PropertyType(i) then type = tostring(o:PropertyType(i)) end
if o:PropertyName(i) then name = tostring(o:PropertyName(i)) end
if o:Get(o:PropertyName(i)) then value = tostring(o:Get(o:PropertyName(i))) end
s = s .. '['..type..' '..name..'] = ['..value..']\n';
end
help.printfWithNewline(s)
return s;
end
---------------------------------------------------------------------------
-- Creates fixed width headline
function help.headline(headlineString, myFill, size)
local fill1, fill2, fillingChar;
local numberOfChars;
if headlineString then numberOfChars = #headlineString;
else numberOfChars = 0; end
if myFill then
fill1, fill2, fillingChar = myFill,myFill,myFill;
else
fill1, fill2, fillingChar = '_','_','_';
end
local totalWidth = 80;
if size then totalWidth = size end;
local count_fill1 = totalWidth/2 - numberOfChars/2
local count_fill2 = totalWidth - count_fill1 - numberOfChars
for i = 2, count_fill1 do fill1 = fill1 .. fillingChar; end
for i = 2, count_fill2 do fill2 = fill2 .. fillingChar; end
if headlineString then
-- make sure the width is reached
local createdWidth = string.len(fill1) + string.len(headlineString) + string.len(fill2);
if createdWidth < totalWidth then fill2 = fill2 .. fillingChar; end
if createdWidth < totalWidth then fill2 = string.sub(fill2, 1, string.len(fill2)); end
return fill1 .. headlineString .. fill2;
else
return fill1 .. fill2;
end
end
---------------------------------------------------------------------------
-- Convert \n and \t for Printf()
function help.printfWithNewline(str)
-- convert tabs
str = str:gsub("%\t", " ")
-- convert newlines
local line;
for line in tostring(str):gmatch("[^\n]+") do
Printf(line)
end
end
---------------------------------------------------------------------------
-- Create tree-like output of gma3-object
function help.tree(o, maxDepth)
local function printDirectory(dir, prefix, depth)
local i = 1;
if maxDepth then
if (depth > maxDepth) then return; end
end
while dir[i] do
local content = dir[i]
Printf(prefix..'|---'..content.index..': '..content.name)
printDirectory(content,prefix..'| ', depth+1) -- use recursion
i = i + 1;
end
end
printDirectory(o,'',1)
end
Display More
Don’t have an account yet? Register yourself now and be a part of our community!