I have an SVG that I imported to my project. This shape has an outline that I would like to change the width and color of based on a custom property. I can change the width no problem, but how would I change the color of the line using this script?
I know that I can use the style customer to change the color based off a custom property. However, I would like to implement this to dozens of other templates that I’m using. Copy/pasting a script is faster than me copy/pasting a script AND setting up the Style Customizer.
logger = system.util.getLogger("Valve Template")
startLogging = system.tag.read("[Client]InfoDebug").value
# manual mode has been set.
if event.propertyName == "manual":
if event.source.manual == True:
from java.awt import BasicStroke
lineWidth = 2
if startLogging: logger.info("Property: %s" % event.propertyName)
event.source.setStrokeStyle(BasicStroke(lineWidth))
if event.source.manual == False:
from java.awt import BasicStroke
lineWidth = 0.582
if startLogging: logger.info("Property: %s" % event.propertyName)
event.source.setStrokeStyle(BasicStroke(lineWidth))