GH_UpgradeUtil

public class GH_UpgradeUtil
Exposes several utility functions for migrating parameters and wires between components useful while upgrading components.

Methods

MigrateInputParameters

#
public static bool MigrateInputParameters(IGH_Component source, IGH_Component target, int[] index0, int[] index1)
Migrate a bunch of input parameters.
source (IGH_Component)Source component.
target (IGH_Component)Target component.
index0 (int[])List of input indices to migrate.
index1 (int[])Matching list of target indices.
True on success, false on failure.

MigrateInputParameters

#
public static bool MigrateInputParameters(IGH_Component source, IGH_Component target)
Migrate all input parameters.
source (IGH_Component)Source component.
target (IGH_Component)Target component.
True on success, false on failure.

MigrateOutputParameters

#
public static bool MigrateOutputParameters(IGH_Component source, IGH_Component target, int[] index0, int[] index1)
Migrate a bunch of output parameters.
source (IGH_Component)Source component.
target (IGH_Component)Target component.
index0 (int[])List of output indices to migrate.
index1 (int[])Matching list of target indices.
True on success, false on failure.

MigrateOutputParameters

#
public static bool MigrateOutputParameters(IGH_Component source, IGH_Component target)
Migrate all output parameters.
source (IGH_Component)Source component.
target (IGH_Component)Target component.
True on success, false on failure.

MigrateRecipients

#
public static int MigrateRecipients(IEnumerable<IGH_Param> recipients, IGH_Param target)
Utility method for bulk assigning a bunch of sources.
recipients (IEnumerable<IGH_Param>)
target (IGH_Param)

MigrateRecipients

#
public static int MigrateRecipients(IGH_Param from, IGH_Param to)
Migrate all recipients from A to B, while maintaining order.
from (IGH_Param)Parameter to move recipients from.
to (IGH_Param)Parameter to move recipients to.
Number of recipients migrated.

MigrateSources

#
public static int MigrateSources(IEnumerable<IGH_Param> sources, IGH_Param target)
Utility method for bulk assigning a bunch of sources.
sources (IEnumerable<IGH_Param>)
target (IGH_Param)

MigrateSources

#
public static int MigrateSources(IGH_Param from, IGH_Param to)
Migrate all sources from A to B, while maintaining order.
from (IGH_Param)Parameter to move sources from.
to (IGH_Param)Parameter to move sources to.
Number of sources migrated.

ReplaceInputParameters

#
public static void ReplaceInputParameters(IGH_Component source, IGH_Component target)
Move all input parameters from one component to another. Only use this function if the target component can handle the input layout of the source component.
source (IGH_Component)Component to move parameters from.
target (IGH_Component)Component to move parameters to.

ReplaceOutputParameters

#
public static void ReplaceOutputParameters(IGH_Component source, IGH_Component target)
Move all output parameters from one component to another. Only use this function if the target component can handle the output layout of the source component.
source (IGH_Component)Component to move parameters from.
target (IGH_Component)Component to move parameters to.

SwapComponents

#
public static bool SwapComponents(IGH_Component oldComponent, IGH_Component newComponent, bool migrateParameters)
Replace an existing component with a different one. All parameters (input and output) will be migrated.
oldComponent (IGH_Component)Component current in a GH_Document.
newComponent (IGH_Component)Component to swap.
migrateParameters (bool)If true, all parameters will be moved from old to new.
True on success, false on failure.

SwapComponents

#
public static bool SwapComponents(IGH_Component oldComponent, IGH_Component newComponent)
Replace an existing component with a different one. All parameters (input and output) will be migrated.
oldComponent (IGH_Component)Component current in a GH_Document.
newComponent (IGH_Component)Component to swap.
True on success, false on failure.

SwapComponents

#
public static IGH_Component SwapComponents(IGH_Component oldComponent, Guid newComponentGuid, bool migrateParameters)
Replace an existing component with a different one. All parameters (input and output) will be migrated.
oldComponent (IGH_Component)Component current in a GH_Document.
newComponentGuid (Guid)ComponentGuid of the component to add.
migrateParameters (bool)If true, all parameters will be moved from old to new.
Component that was added.

SwapComponents

#
public static IGH_Component SwapComponents(IGH_Component oldComponent, Guid newComponentGuid)
Replace an existing component with a different one. All parameters (input and output) will be migrated.
oldComponent (IGH_Component)Component current in a GH_Document.
newComponentGuid (Guid)ComponentGuid of the component to add.
Component that was added.