Skip to content

Commit

Permalink
Improve popup message, add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Sep 5, 2024
1 parent c649c67 commit 6f054d2
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ def findGroupUuidDuplicates(uuid):

temp_data = bpy.context.window_manager.dmx
if not hide_gobo_message:
message = "This show file has been made in older version of BlenderDMX. Check gobos, most likely you need to re-patch fixtures from GDTF files to re-load gobo images."
message = "This show file has been made in older version of BlenderDMX. Check gobos, most likely you need to re-edit fixtures: Fixtures → Edit, uncheck Re-address only"
temp_data.migration_message = message
ShowMessageBox( message=message,title="Updating info!",icon="ERROR")

Expand Down
2 changes: 2 additions & 0 deletions fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,7 @@ def update_iris(self, iris, current_frame):
if "gobo" in obj.get("geometry_type", ""):
material = self.gobo_materials[obj.name].material
mix = material.node_tree.nodes.get("Iris Size")
DMX_Log.log.debug(("found iris", material, mix))
iris_size = mix.inputs[3]
iris_size.default_value = iris

Expand Down Expand Up @@ -1436,6 +1437,7 @@ def set_gobo_slot(self, n, index=-1, current_frame=None):
if "gobo" in obj.get("geometry_type", ""):
material = self.gobo_materials[obj.name].material
texture = material.node_tree.nodes.get(f"Gobo{n}Texture")
DMX_Log.log.debug(("Found gobo nodes:", n, material, texture))
if texture.image is None:
texture.image = gobos.image
texture.image.source = "SEQUENCE"
Expand Down
8 changes: 6 additions & 2 deletions panels/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import shutil
from bpy.types import Operator, Panel
from ..material import getVolumeScatterMaterial
from ..util import getSceneRect
from ..util import getSceneRect, split_text_on_spaces
from ..gdtf import DMX_GDTF
from ..panels import profiles as Profiles
from .. import blender_utils as blender_utils
Expand Down Expand Up @@ -353,7 +353,11 @@ def draw(self, context):

if len(message)>0:
row = layout.row()
row.label(text=message, icon="ERROR")
lines = split_text_on_spaces(message, 30)
row.label(text="Important!", icon="ERROR")
for line in lines:
row = layout.row()
row.label(text=line)

if not dmx.collection:
if not bpy.app.version >= (3, 4):
Expand Down
138 changes: 136 additions & 2 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,33 @@ def xyY2rgba(xyz):

def ShowMessageBox(message="", title="Message Box", icon="INFO"):
def draw(self, context):
self.layout.label(text=message)
lines = split_text_on_spaces(message, 30)
for line in lines:
self.layout.label(text=line)

bpy.context.window_manager.popup_menu(draw, title=title, icon=icon)


def split_text_on_spaces(text, max_line_length):
words = text.split()
lines = []
current_line = ""

for word in words:
if len(current_line) + len(word) + 1 <= max_line_length:
if current_line:
current_line += " "
current_line += word
else:
lines.append(current_line)
current_line = word

if current_line:
lines.append(current_line)

return lines


def clamp(n, small=0, large=255):
return max(small, min(n, large))

Expand Down Expand Up @@ -246,4 +268,116 @@ def create_unique_fixture_name(name):


# https://andi-siess.de/rgb-to-color-temperature/
kelvin_table = { 1000: (255, 56, 0), 1100: (255, 71, 0), 1200: (255, 83, 0), 1300: (255, 93, 0), 1400: (255, 101, 0), 1500: (255, 109, 0), 1600: (255, 115, 0), 1700: (255, 121, 0), 1800: (255, 126, 0), 1900: (255, 131, 0), 2000: (255, 138, 18), 2100: (255, 142, 33), 2200: (255, 147, 44), 2300: (255, 152, 54), 2400: (255, 157, 63), 2500: (255, 161, 72), 2600: (255, 165, 79), 2700: (255, 169, 87), 2800: (255, 173, 94), 2900: (255, 177, 101), 3000: (255, 180, 107), 3100: (255, 184, 114), 3200: (255, 187, 120), 3300: (255, 190, 126), 3400: (255, 193, 132), 3500: (255, 196, 137), 3600: (255, 199, 143), 3700: (255, 201, 148), 3800: (255, 204, 153), 3900: (255, 206, 159), 4000: (255, 209, 163), 4100: (255, 211, 168), 4200: (255, 213, 173), 4300: (255, 215, 177), 4400: (255, 217, 182), 4500: (255, 219, 186), 4600: (255, 221, 190), 4700: (255, 223, 194), 4800: (255, 225, 198), 4900: (255, 227, 202), 5000: (255, 228, 206), 5100: (255, 230, 210), 5200: (255, 232, 213), 5300: (255, 233, 217), 5400: (255, 235, 220), 5500: (255, 236, 224), 5600: (255, 238, 227), 5700: (255, 239, 230), 5800: (255, 240, 233), 5900: (255, 242, 236), 6000: (255, 243, 239), 6100: (255, 244, 242), 6200: (255, 245, 245), 6300: (255, 246, 247), 6400: (255, 248, 251), 6500: (255, 249, 253), 6600: (254, 249, 255), 6700: (252, 247, 255), 6800: (249, 246, 255), 6900: (247, 245, 255), 7000: (245, 243, 255), 7100: (243, 242, 255), 7200: (240, 241, 255), 7300: (239, 240, 255), 7400: (237, 239, 255), 7500: (235, 238, 255), 7600: (233, 237, 255), 7700: (231, 236, 255), 7800: (230, 235, 255), 7900: (228, 234, 255), 8000: (227, 233, 255), 8100: (225, 232, 255), 8200: (224, 231, 255), 8300: (222, 230, 255), 8400: (221, 230, 255), 8500: (220, 229, 255), 8600: (218, 229, 255), 8700: (217, 227, 255), 8800: (216, 227, 255), 8900: (215, 226, 255), 9000: (214, 225, 255), 9100: (212, 225, 255), 9200: (211, 224, 255), 9300: (210, 223, 255), 9400: (209, 223, 255), 9500: (208, 222, 255), 9600: (207, 221, 255), 9700: (207, 221, 255), 9800: (206, 220, 255), 9900: (205, 220, 255), 10000: (207, 218, 255), 10100: (207, 218, 255), 10200: (206, 217, 255), 10300: (205, 217, 255), 10400: (204, 216, 255), 10500: (204, 216, 255), 10600: (203, 215, 255), 10700: (202, 215, 255), 10800: (202, 214, 255), 10900: (201, 214, 255), 11000: (200, 213, 255), 11100: (200, 213, 255), 11200: (199, 212, 255), 11300: (198, 212, 255), 11400: (198, 212, 255), 11500: (197, 211, 255), 11600: (197, 211, 255), 11700: (197, 210, 255), 11800: (196, 210, 255), 11900: (195, 210, 255), 12000: (195, 209, 255), }
kelvin_table = {
1000: (255, 56, 0),
1100: (255, 71, 0),
1200: (255, 83, 0),
1300: (255, 93, 0),
1400: (255, 101, 0),
1500: (255, 109, 0),
1600: (255, 115, 0),
1700: (255, 121, 0),
1800: (255, 126, 0),
1900: (255, 131, 0),
2000: (255, 138, 18),
2100: (255, 142, 33),
2200: (255, 147, 44),
2300: (255, 152, 54),
2400: (255, 157, 63),
2500: (255, 161, 72),
2600: (255, 165, 79),
2700: (255, 169, 87),
2800: (255, 173, 94),
2900: (255, 177, 101),
3000: (255, 180, 107),
3100: (255, 184, 114),
3200: (255, 187, 120),
3300: (255, 190, 126),
3400: (255, 193, 132),
3500: (255, 196, 137),
3600: (255, 199, 143),
3700: (255, 201, 148),
3800: (255, 204, 153),
3900: (255, 206, 159),
4000: (255, 209, 163),
4100: (255, 211, 168),
4200: (255, 213, 173),
4300: (255, 215, 177),
4400: (255, 217, 182),
4500: (255, 219, 186),
4600: (255, 221, 190),
4700: (255, 223, 194),
4800: (255, 225, 198),
4900: (255, 227, 202),
5000: (255, 228, 206),
5100: (255, 230, 210),
5200: (255, 232, 213),
5300: (255, 233, 217),
5400: (255, 235, 220),
5500: (255, 236, 224),
5600: (255, 238, 227),
5700: (255, 239, 230),
5800: (255, 240, 233),
5900: (255, 242, 236),
6000: (255, 243, 239),
6100: (255, 244, 242),
6200: (255, 245, 245),
6300: (255, 246, 247),
6400: (255, 248, 251),
6500: (255, 249, 253),
6600: (254, 249, 255),
6700: (252, 247, 255),
6800: (249, 246, 255),
6900: (247, 245, 255),
7000: (245, 243, 255),
7100: (243, 242, 255),
7200: (240, 241, 255),
7300: (239, 240, 255),
7400: (237, 239, 255),
7500: (235, 238, 255),
7600: (233, 237, 255),
7700: (231, 236, 255),
7800: (230, 235, 255),
7900: (228, 234, 255),
8000: (227, 233, 255),
8100: (225, 232, 255),
8200: (224, 231, 255),
8300: (222, 230, 255),
8400: (221, 230, 255),
8500: (220, 229, 255),
8600: (218, 229, 255),
8700: (217, 227, 255),
8800: (216, 227, 255),
8900: (215, 226, 255),
9000: (214, 225, 255),
9100: (212, 225, 255),
9200: (211, 224, 255),
9300: (210, 223, 255),
9400: (209, 223, 255),
9500: (208, 222, 255),
9600: (207, 221, 255),
9700: (207, 221, 255),
9800: (206, 220, 255),
9900: (205, 220, 255),
10000: (207, 218, 255),
10100: (207, 218, 255),
10200: (206, 217, 255),
10300: (205, 217, 255),
10400: (204, 216, 255),
10500: (204, 216, 255),
10600: (203, 215, 255),
10700: (202, 215, 255),
10800: (202, 214, 255),
10900: (201, 214, 255),
11000: (200, 213, 255),
11100: (200, 213, 255),
11200: (199, 212, 255),
11300: (198, 212, 255),
11400: (198, 212, 255),
11500: (197, 211, 255),
11600: (197, 211, 255),
11700: (197, 210, 255),
11800: (196, 210, 255),
11900: (195, 210, 255),
12000: (195, 209, 255),
}

0 comments on commit 6f054d2

Please sign in to comment.