Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygdtf update #1

Open
vanous opened this issue Aug 12, 2023 · 0 comments
Open

pygdtf update #1

vanous opened this issue Aug 12, 2023 · 0 comments

Comments

@vanous
Copy link

vanous commented Aug 12, 2023

Hi, your project is on the GDTF Projects page, very neat!

We have been using and updating the pygdtf library for a while (we also moved it to the Open Stage org).

The td-gdtf uses an old version of the library and i just wanted to point out few improvements which we made: we added proper DMX Channels parsing based on the Geometry tree, support for GeometryReference and also for Break Overwrite, as well as adding more supported Geometries and so on. This results in much better GDTF parsing and provides correct channel layout and so on. This logic for now lives in utility functions, so they can continue to be worked on.

I looked at the GDTFFixture.py in your repo and i think updating it to be able to use this new logic and thus benefit from being able to use more GDTF files and now also with correct DMX channel layout will be pretty simple.

I don't have TD to test this, but here are a few hints:

  • (update to the latest version of pygdtf from master). I presume that after the update, your code should work as it did before... maybe try first.

Parse the file as was done before:

fixture = pygdtf.FixtureType("fixture.gdtf")

To get info about DMX Modes, their names, channel counts and so on, use utils.get_dmx_modes_info:

info=pygdtf.utils.get_dmx_modes_info(fixture)

it returns this list:

[{'mode_id': 0,
  'mode_name': 'Mode 1 - Standard 16 bit',
  'mode_dmx_channel_count': 33,
  'mode_virtual_channel_count': 0},
 {'mode_id': 1,
  'mode_name': 'Mode 2 - Reduced 8 bit',
  'mode_dmx_channel_count': 27,
  'mode_virtual_channel_count': 0}]

To create the dmx modes ID and names, like you did before, via the list comprehension:

modes_ids = [f"{x['mode_id']}" for x in info]
modes_names = [f"{x['mode_name']} {x['mode_dmx_channel_count']}" for x in info]

To get the list of channels, use utils.get_dmx_channels:

channels = pygdtf.utils.get_dmx_channels(s, "Mode 1 - Standard 16 bit")

This now gives you list of channels. Do note, that the list can contain multiple lists, because some fixtures, especially LED panels (might be of an interest for you) can be patched on several universes. See comments in the utils.get_dmx_channels. This called DMX Breaks.

So, a single channel will look like this:

pygdtf.utils.get_dmx_channels(s, "Mode 1 - Standard 16 bit")[0][0]
{'dmx': 1,
 'id': 'Pan',
 'default': 128,
 'geometry': 'Yoke',
 'break': 1,
 'channel_functions': [<pygdtf.ChannelFunction at 0x7fb42a9f4810>]}

This you can now consume in your updateMode function like you did before. The utils function get_dmx_channels also presumes only one logical channel, like you do. Also, there is the utils.get_virtual_channels if TD supported non-DMX channels (pan/tilt for example to position Par fixtures, if the GDTF contains it). What i am not sure about is how you handle 16bit channels, the current get_dmx_info indicates this by adding + to the id: 'id': '+Pan' but for now i think we don't use the fine channels, so you could also skip them, not sure.

There could be more, but this is what i can see from a cursory look. I never used TD so i did not try this... If you have any questions, let me know, i can try to help.

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

No branches or pull requests

1 participant