AffectChannelMod - superclass: modifier; super-superclass:MAXWrapper - classID: #(1453030689L, 987447227L)The Affect Channel modifier (shown in the modifier list as Affect Channel, in the Points category) edits the per-point channel data of a point object through a stack of operations. Operations run in order from first to last. Each one picks a set of target points and reads an optional input channel. It then combines that input with a source coefficient (a constant value, another channel, or a sampled field) using an arithmetic operation or a condition, and writes the result to an output channel. The output channel is created if it does not already exist.
Available in 3ds Max 2027.3 and higher.
Each operation's settings are stored in its own parameter block, not as properties of the modifier. Use the affectChannelInterface methods to add, delete, rename, reorder and look up operations. GetOperationParams() returns an operation's parameter block, whose properties are listed under Operation parameters below.
The operation stack starts empty. A default operation named "Operation 1" is added the first time the modifier is evaluated or its rollup is displayed.
AffectChannelMod...NOTE
Do not modify the
operationParamsmodifier property or the per-operationoperationNameproperty directly. Changing them directly can cause significant problems. Use theaffectChannelInterfacemethods, such asAddOperation(),SetOperationName()andGetOperationParams(), instead.
These properties drive the Display and Rendering rollup, which is the standard point object display rollup hosted on the modifier. They are also saved with presets.
<AffectChannelMod>.displayIcon BooleanClass default: true -- booleanSpecifies whether the point object's icon is displayed.
<AffectChannelMod>.iconSize Float default: 10.0 -- worldUnitsGets/sets the display size of the icon, in world units. Range: 0.0 to 1.0E+09.
<AffectChannelMod>.displayPoints BooleanClass default: true -- booleanSpecifies whether points are displayed in the viewports.
<AffectChannelMod>.pointSize Float default: 5.0 -- worldUnitsGets/sets the display size of points. Range: 0.0 to 1.0E+09.
<AffectChannelMod>.instanceDisplay BooleanClass default: true -- booleanSpecifies whether instance geometry assigned to points is displayed.
<AffectChannelMod>.displayLimit Integer default: 500 -- integerGets/sets the maximum number of instances to display. Range: 0 to 1000000000.
<AffectChannelMod>.instanceDisplayType Integer default: 1 -- integerGets/sets how displayed instances are drawn:
The following properties belong to each per-operation parameter block (AffectChannelOperationParams) returned by affectChannelInterface.GetOperationParams(). They are not properties of the modifier itself. Read and set them directly on the returned block, for example op = m.GetOperationParams 1; op.affectStrength = 0.5.
<operationParams>.isOperationActive BooleanClass default: true -- booleanSpecifies whether the operation is evaluated. Inactive operations are skipped. This is the checkbox on each entry in the operation list.
<operationParams>.targetType Integer default: 0 -- integerGets/sets which points the operation affects:
targetSoftSelectionTol.targetNamedSelection.targetColor within targetColorTol.<operationParams>.isInvertedTarget BooleanClass default: false -- booleanWhen true, the inverse of the specified target set is used.
<operationParams>.targetSoftSelectionTol Float default: 0.5 -- animatable; floatGets/sets the soft selection threshold used when targetType is 2. Range: 0.0 to 1.0.
<operationParams>.targetNamedSelection String default: "" -- stringGets/sets the name of the named selection used when targetType is 5.
<operationParams>.targetColor Color default: (color 0 0 0) -- animatable; colorGets/sets the reference color used when targetType is 6.
<operationParams>.targetColorTol Float default: 10.0 -- animatable; floatGets/sets the color matching tolerance, as a percentage, used when targetType is 6. Range: 0.0 to 100.0.
<operationParams>.useTargetColorHue BooleanClass default: true -- boolean
<operationParams>.useTargetColorSaturation BooleanClass default: false -- boolean
<operationParams>.useTargetColorValue BooleanClass default: false -- booleanSpecify which HSV components (H, S, V) are compared when matching against targetColor.
<operationParams>.inputChannelName String default: "" -- stringGets/sets the short name of the channel the operation reads its input values from. New operations created by AddOperation() set this to the localized string "None", which means no input channel. When no input channel is specified, the values stored in the output channel at the beginning of the operation evaluation take the place of the input channel values. If a name is given and that channel does not exist on the incoming point object, the operation is skipped.
<operationParams>.affectSourceType Integer default: 0 -- integerGets/sets where the operation's source coefficient comes from:
affectValueType and the matching affectValue* property.affectChannelName. The operation is skipped if that channel does not exist.affectField at each point's position. Its strength is also taken from the field. The operation is skipped if no field is assigned.<operationParams>.affectOperationType Integer default: 1 -- integerGets/sets the operation category:
conditionType.The UI drop-down shows Dot Product before Condition. The values above are the ones stored in the parameter.
<operationParams>.affectStrength Float default: 1.0 -- animatable; floatGets/sets the strength of the operation for Value and Channel sources. It applies only to arithmetic operations (not Condition). Range: -1.0E+09 to 1.0E+09.
<operationParams>.affectValueType Integer default: 1 -- integerGets/sets the data type of the constant source value when affectSourceType is 1 (Value):
affectValueInteger.affectValueFloat.affectValuePointX/Y/Z.affectValueColor.<operationParams>.affectValueInteger Integer default: 0 -- animatable; integerGets/sets the constant source value when affectValueType is 0. Range: -1000000000 to 1000000000.
<operationParams>.affectValueFloat Float default: 0.0 -- animatable; floatGets/sets the constant source value when affectValueType is 1. Range: -1.0E+09 to 1.0E+09.
<operationParams>.affectValuePointX Float default: 0.0 -- animatable; float
<operationParams>.affectValuePointY Float default: 0.0 -- animatable; float
<operationParams>.affectValuePointZ Float default: 0.0 -- animatable; floatGet/set the X, Y and Z components of the constant source value when affectValueType is 2. Range: -1.0E+09 to 1.0E+09.
<operationParams>.affectValueColor Color default: (color 255 255 255) -- animatable; colorGets/sets the constant source value when affectValueType is 3.
<operationParams>.affectChannelName String default: "" -- stringGets/sets the short name of the source channel when affectSourceType is 2 (Channel). New operations set this to the localized string "None".
<operationParams>.affectField UndefinedClass default: undefined -- nodeGets/sets the field helper node sampled when affectSourceType is 3 (Field).
<operationParams>.affectFieldMultiplier Float default: 1.0 -- animatable; floatGets/sets the multiplier applied to values sampled from affectField. Range: -1.0E+09 to 1.0E+09.
<operationParams>.conditionType Integer default: 0 -- integerGets/sets the comparison used when affectOperationType is 5 (Condition):
conditionTolerance.<operationParams>.conditionTolerance Float default: 0.0 -- animatable; floatGets/sets the tolerance for the range (+/-) condition. Range: 0.0 to 1.0E+09.
<operationParams>.useConditionPointX BooleanClass default: true -- boolean
<operationParams>.useConditionPointY BooleanClass default: true -- boolean
<operationParams>.useConditionPointZ BooleanClass default: true -- booleanWhen the source is a constant Point3 value (affectSourceType 1 and affectValueType 2), specify which of the X, Y and Z components the condition compares. With a vector-valued source channel, all components are compared.
<operationParams>.outputChannelName String default: "MyChannel" -- stringGets/sets the short name of the channel the operation writes to. If the name matches a standard channel, that standard channel is used along with its standard description. Otherwise, a channel that does not exist yet is created with the full name Autodesk User <name> (Autodesk User Default if the name is empty), using outputChannelType and the matching default value.
<operationParams>.outputChannelType Integer default: 1 -- integerGets/sets the data type of a newly created output channel:
It is ignored when the output channel already exists and isOutputChannelReplaced is false.
<operationParams>.isOutputChannelReplaced BooleanClass default: false -- booleanWhen true, a pre-existing output channel is deleted and recreated before the operation runs. Every point's entry is reset to the specified default value, and the channel uses outputChannelType.
<operationParams>.isOutputChannelInternal BooleanClass default: false -- booleanWhen true, a newly created output channel is used only inside this modifier (for example, as an intermediate result for later operations) and is not passed up the stack. This applies only to channels that did not already exist. For a pre-existing channel, its existing internal status is kept.
<operationParams>.outputChannelDefaultInteger Integer default: 0 -- animatable; integer
<operationParams>.outputChannelDefaultFloat Float default: 0.0 -- animatable; float
<operationParams>.outputChannelDefaultPointX Float default: 0.0 -- animatable; float
<operationParams>.outputChannelDefaultPointY Float default: 0.0 -- animatable; float
<operationParams>.outputChannelDefaultPointZ Float default: 0.0 -- animatable; float
<operationParams>.outputChannelDefaultColor Color default: (color 255 255 255) -- animatable; colorGet/set the default value of a newly created output channel. Only the property matching outputChannelType is used. Integer range: -1000000000 to 1000000000. Float/Point3 range: -1.0E+09 to 1.0E+09.
A mixin interface (FP_MIXIN) on the modifier. Its methods can be called directly on the modifier (for example, m.AddOperation()) or through the interface (for example, m.affectChannelInterface.AddOperation()). All operation indices are 1-based.
Because a default "Operation 1" can be added as soon as the modifier is evaluated or displayed, do not assume the stack is empty after addModifier. Use the index returned by AddOperation(), or GetOperationIndex, rather than a hard-coded index. The default operation also writes its own output channel (Autodesk User MyChannel) unless you delete or change it.
Point IDs returned by the Editable Point interface (for example by GetActiveIds) are 0-based, unlike MAXScript array indices.
Methods
<index>AddOperation()Appends a new operation, with default parameters and a unique default name of the form "Operation N", to the end of the operation stack. Returns the 1-based index of the new operation.
<boolean>DeleteOperation <index>indexOperationDeletes the operation at indexOperation. Later operations move up by one. Returns true if the index was valid and the operation was deleted.
<boolean>SetOperationName <string>operationName <index>indexOperationRenames the operation at indexOperation. If the name is already used by another operation in the stack, an integer is appended to make it unique. Returns false if the index is invalid or operationName is an empty string.
<index>UpdateOperationOrder <index>indexOperationInit <integer>deltaOperationMoves the operation at indexOperationInit by deltaOperation positions. Positive values move it later in the stack (evaluated later), negative values move it earlier. The other operations keep their relative order. The move is clamped to the ends of the stack. Returns the operation's new 1-based index. If indexOperationInit is invalid, the stack is unchanged and indexOperationInit is returned.
<integer>GetNumberOfOperations()Returns the number of operations in the stack.
<index>GetOperationIndex <string>operationNameReturns the 1-based index of the operation named operationName. Operation names are unique within the stack.
<maxObject>GetOperationParams <index>indexOperationReturns the parameter block for the operation at indexOperation (see Operation parameters), or undefined if the index is invalid. The returned value is a ParamBlock2.
<string>GetOperationName <index>indexOperationReturns the name of the operation at indexOperation, or an empty string if the index is invalid.
<boolean>LoadPreset <string>nameLoads the named preset, replacing the whole operation stack and the Display and Rendering settings. Returns true on success. Presets are .affectChannelPreset files in an AffectChannelPresets folder. 3ds Max looks in both the factory location (the plugin bundle's Contents\Presets\AffectChannelPresets) and the user location (...\User Settings\AffectChannelPresets). If a user preset has the same name as a factory preset, the user preset wins.
3ds Max 2027 ships with these factory presets:
Add_GaussianSplat_ChannelsColor_From_Field_ColorField_Disable_PointsField_Replace_GS-OpacityField_to_Selection_Change_ColorField_to_Selection_Shift_Points_ZLow_Opacity_DisableSmall_Scale_DisableSwap_Instance_with_Field<boolean>SavePreset <string>nameSaves the current operation stack and Display and Rendering settings as a preset with the given name in the user preset folder. Returns true on success.
<boolean>DeletePreset <string>nameDeletes the named preset. Returns true if the preset was found and deleted.
FOR EXAMPLE
-- Create a point sphere and add an Affect Channel modifier ps = PointSphere radius:50 count:500 acm = AffectChannelMod() addModifier ps acm -- Add an operation that writes the constant 0.25 into a new float channel "Weight" on every point idx = acm.AddOperation() acm.SetOperationName "SetWeight" idx op = acm.GetOperationParams idx op.targetType = 3 -- All points op.affectSourceType = 1 -- Value op.affectOperationType = 0 -- Replace op.affectValueType = 1 -- Float op.affectValueFloat = 0.25 op.outputChannelName = "Weight" op.outputChannelType = 1 -- Float -- Check the result on a collapsed copy chk = copy ps convertTo chk Editable_Point names = #() chk.GetAllChannelNames &names names chId = 0 chk.GetChannelId "Autodesk User Weight" &chId ids = #() chk.GetActiveIds &ids val = 0.0 chk.GetChannelValue chId ids[1] &val valOUTPUT:
#("Autodesk User Weight", "3dsMax Point Positions") 0.25