You don't omit the paremters of the paint brush tool, you simply use a blank Strokes list. If there are no strokes to make the paintbrush won't draw anything. This means you have to approach each tool differently. The PenTool command, for example, doesn't actually draw anything. If you ever record using the pen tool it uses other commands like "CreateDrawingObject" and "NodeOffset" to actually draw with the command. So let's start with ilgk48's question. They called a preset using the RunScript command. But the script they posted was the preset itself. SoHere is how I would do what they wanted.
Code: Select all
from PSPApp import *
def ScriptProperties():
return {}
def Do(Environment):
# .... Default code here
# SelectTool
App.Do( Environment, 'SelectTool', {'Tool':'Pick'})
# RunScript
App.Do( Environment, 'RunScript', {
'FileName': u'C:\\pathtopresets'\
u's\\Preset_PenTool_MyDefault.PspScript',
'ScriptExecutionMode': App.Constants.ExecutionMode.Silent,
'CheckVersion': True,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1)
}
})
# SelectTool
App.Do( Environment, 'SelectTool', {'Tool':'PenTool'})
There does seem to be an odd bug there where I had to run that script twice to get all of the settings to update properly. Not sure why. But it still worked.
Now, for your code.
Code: Select all
def Do(Environment):
#... Other code
# ResetMaterials
App.Do( Environment, 'ResetMaterials', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
# SwapMaterials
App.Do( Environment, 'SwapMaterials', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
# SelectTool - We're selecting the PIck tool in case the PaintBrush tool is already selected
App.Do( Environment, 'SelectTool', {
'Tool': "Pick",
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
# PaintBrush - Run to set the Last Used settings
App.Do( Environment, 'PaintBrush', {
'BrushTip': {
'Shape': App.Constants.BrushShape.Custom,
'CustomBrush': u'Snow',
'Size': 100,
'Hardness': 100,
'Step': 27,
'Density': 100,
'Thickness': 100,
'Rotation': 0,
'BrushVariance': {
'SizeVariance': App.Constants.VarianceMethod.Pressure,
'SizeJitter': 5,
'OpacityVariance': App.Constants.VarianceMethod.None,
'OpacityJitter': 48,
'DensityVariance': App.Constants.VarianceMethod.None,
'DensityJitter': 0,
'ThicknessVariance': App.Constants.VarianceMethod.None,
'ThicknessJitter': 0,
'RotationVariance': App.Constants.VarianceMethod.None,
'RotationJitter': 32,
'ColorBlendVariance': App.Constants.VarianceMethod.None,
'ColorBlendJitter': 0,
'HueVariance': App.Constants.VarianceMethod.None,
'HueJitter': 0,
'SaturationVariance': App.Constants.VarianceMethod.None,
'SaturationJitter': 0,
'LightnessVariance': App.Constants.VarianceMethod.None,
'LightnessJitter': 34,
'PositionJitter': 11,
'UseScaledPositionJitter': False,
'ImpressionsPerStep': 1,
'FadeRate': 100
},
'BrushTrayShow': False
},
'Brush': {
'Opacity': 50,
'ContinuousPaint': False,
'WetLookPaint': False,
'BlendMode': App.Constants.BlendMode.Normal,
'CAMG': None
},
'PrimaryMaterial': App.Constants.MaterialRef.Foreground,
'ForegroundMaterial': None,
'BackgroundMaterial': None,
'Stroke': [], #EMPTY STROKE TO PREVENT DRAWING
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 40873126,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})
# SelectTool PaintBrush - Paint brush should now be selected with the settings you wanted.
App.Do( Environment, 'SelectTool', {
'Tool': 'PaintBrush',
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((17,0,0),1)
}
})