DeleteMappingRule

Introduced

v1.0

Categories

animmixer

Description

Deletes a rule from a connection or value mapping template.

Scripting Syntax

DeleteMappingRule( MappingTemplate, Index );

Parameters

Parameter Type Description
MappingTemplate String Mapping template from which the rule is deleted.
Index Integer Specifies the rule to delete.

Default Value: 0

Examples

VBScript Example

' This example illustrates various mapping template commands, in
' particular how to add and remove rules and examine the contents.
NewScene , False
' Create a connection mapping template.
CreateEmptyConnectionMap "Scene_Root", oCnxMap
theRules = Array( Array( "from", "to" ), _
                        Array( "me", "you" ), _
                        Array( "HERE", "THERE" ) )
i = 1
for each rule in theRules
        AddMappingRule oCnxMap, rule(0), rule(1), i
        i = i + 1
next
' Let's take a look at the connection templates at the start.
DumpTemplateInfo oCnxMap
' Delete a couple of rules.
DeleteMappingRule oCnxMap, 0
DeleteMappingRule oCnxMap, 0
' Let's take another look, now that it's been edited.
DumpTemplateInfo oCnxMap
'==================================================
' Helper method to dump some mapping template info.
'==================================================
sub DumpTemplateInfo( in_Templ )
        ' Get the actual object referenced by name in the argument.
        set oTempl = GetValue( in_Templ )
        msg = "Template: " & oTempl.fullname & Chr(10)
        numRules = GetNumMappingRules( in_Templ )
        if oTempl.type = "actionclip" then
                msg = msg & "(Clip acting as value map)" & Chr(10)
                bSupportsActive = true
        else
                bSupportsActive = false
        end if
        for i = 1 to numRules
                GetMappingRule in_Templ, i, param, expr, active
                msg = msg & Chr(9) & "Rule " & i & ": "
                if bSupportsActive then
                        if active then
                                msg = msg & "( active ) "
                        else
                                msg = msg & "(inactive) "
                        end if
                end if
                msg = msg & param & " -> " & expr & Chr(10)
        next
        LogMessage msg 
end sub
' Running this script should log the following:
' ---------------------------------------------
'INFO : "Template: Mixer.MappingTemplate
'       Rule 1: from -> to
'       Rule 2: me -> you
'       Rule 3: HERE -> THERE
'"
'INFO : "Template: Mixer.MappingTemplate
'       Rule 1: HERE -> THERE
'"

See Also

AddMappingRule CreateConnectionMap CreateValueMap GetNumMappingRules GetMappingRule SetMappingRule