Skip to content

Commit

Permalink
Update the Blender driver syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Dec 27, 2023
1 parent 38cab76 commit 5763076
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,12 +1388,12 @@ def onLoadFile(scene):
DMX_Zeroconf.disable()

# register a "bdmxX" namespace to get current value of a DMX channel,
# the syntax is #bdmxX(universe, address), where X is c or f (coarse, fine)
# for example: #bdmxc(1,1)
data_get_coarse = DMX_Data.get_coarse
data_get_fine = DMX_Data.get_fine
bpy.app.driver_namespace['bdmxc'] = data_get_coarse
bpy.app.driver_namespace['bdmxf'] = data_get_fine
# the syntax is #bdmxX(universe, address), where X is 8 or 16 (8bit or 16bit)
# for example: #bdmx8(1,1)
data_get_8 = DMX_Data.get_value_8
data_get_16 = DMX_Data.get_value_16
bpy.app.driver_namespace['bdmx8'] = data_get_8
bpy.app.driver_namespace['bdmx16'] = data_get_16

@bpy.app.handlers.persistent
def onUndo(scene):
Expand Down
8 changes: 4 additions & 4 deletions data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def setup(universes):
print("DMX", "Universe Allocated: ", u)

@staticmethod
def get_coarse(universe, addr):
"""Used for the namespace bdmxc function
def get_value_8(universe, addr):
"""Used for the namespace bdmx8 function
Returns single 8bit value """
return DMX_Data.get(universe, addr, 1)[0]

@staticmethod
def get_fine(universe, addr):
"""Used for the namespace bdmxf function
def get_value_16(universe, addr):
"""Used for the namespace bdmx16 function
Returns single 16bit value"""
data = DMX_Data.get(universe, addr, 2)
return data[0]*256+data[1]
Expand Down

0 comments on commit 5763076

Please sign in to comment.