GH_ComponentParamServer

References
Wraps all members and functions needed for GH_Component to manage its input and output parameters.

Properties

Input

#
public List<IGH_Param> Input { get; }
Gets or sets the input list of parameters. Do not insert or remove parameters from this list, use the dedicated functions instead.

InputWidth

#
public float InputWidth { get; }
Gets the width of the largest input parameter.

OnlyTreeAndListParameters

#
public bool OnlyTreeAndListParameters { get; }
Returns True if every input parameter is either a list or a tree parameter.

OnlyTreeParameters

#
public bool OnlyTreeParameters { get; }
Returns True if every input parameter is a tree parameter.

Output

#
public List<IGH_Param> Output { get; }
Gets or sets the output list of parameters. Do not insert or remove parameters from this list, use the dedicated functions instead.

OutputWidth

#
public float OutputWidth { get; }
Gets the width of the largest output parameter.

Owner

#
public IGH_Component Owner { get; }
Gets the owner component of this instance

Methods

AccessCount

#
public int AccessCount(GH_ParamAccess access)
Returns the total number of input parameters that match the access mask.
access (GH_ParamAccess)Access flag mask.

Clear

#
public void Clear()
Removes all input and output parameters.

Clear

#
public void Clear(bool isolate)
Removes all input and output parameters.
isolate (bool)If true, parameters that are removed will be isolated from sources and recipients.

CreateDuplicate

#
public static IGH_Param CreateDuplicate(IGH_Param original)
Attempts to duplicate a parameter. Attributes will be ignored. Warning! The duplicate will have the same ID as the original!
original (IGH_Param)Parameter to duplicate.
A dupicate of the original or null on failure.

EmitSyncObject

#
public GH_ComponentParamServer.IGH_SyncObject EmitSyncObject()
Create a synch object that stores a shallow representation of this server. Cache this object if you're planning to make sweeping changes to this param-server. Then, once you are finished call the Sync() function to perform cleanup of removed parameters. This is a utility function and you can choose to perform cleanup yourself.

Find

#
public IGH_Param Find(Guid id)
Find the parameter that has the given InstanceGuid.
id (Guid)InstanceID to search for.
The parameter with the matching ID or null on failure.

GetEnumerator

#
public IEnumerator<IGH_Param> GetEnumerator()
Gets a customized enumerator which iterates over all (both input and output) parameters.

GetEnumerator1

#
[EditorBrowsable(EditorBrowsableState.Never)] public IEnumerator GetEnumerator1()
Gets a customized enumerator which iterates over all (both input and output) parameters.

GetHashCode

#
public Guid GetHashCode(GH_ParamHashFields fields)
Creates a SHA1 hash from the parameter data.
fields (GH_ParamHashFields)Fields to include.
A Guid representing a SHA hash of the parameter fields.

GetHashCode

#
public override int GetHashCode()

GetParam

#
public IGH_Param GetParam(string name, GH_ParameterSide side)
Finds the parameter that matches the specified search mask.
name (string)Name to search for.
side (GH_ParameterSide)
The the parameter, or null if no parameter was found to match

IndexOfInputParam

#
public int IndexOfInputParam(Guid id)
Finds the index of the input parameter that matches the specified search mask.
id (Guid)ID to search for
The index of the parameter, or -1 if no parameter was found to match

IndexOfInputParam

#
public int IndexOfInputParam(string name)
Finds the index of the input parameter that matches the specified search mask.
name (string)Name to search for.
The index of the parameter, or -1 if no parameter was found to match

IndexOfOutputParam

#
public int IndexOfOutputParam(Guid id)
Finds the index of the output parameter that matches the specified search mask.
id (Guid)ID to search for.
The index of the parameter, or -1 if no parameter was found to match

IndexOfOutputParam

#
public int IndexOfOutputParam(string name)
Finds the index of the output parameter that matches the specified search mask.
name (string)Name to search for.
The index of the parameter, or -1 if no parameter was found to match

InventUniqueNickname

#
public static string InventUniqueNickname(string allowedChars, IEnumerable<IGH_Param> existingNames)
Create a new, unique parameter nickname.
allowedChars (string)Allowed character set for naming logic.
existingNames (IEnumerable<IGH_Param>)A collection of parameter names to avoid.
The first name combination that doesn't occur in the existingNames collection.

InventUniqueNickname

#
public static string InventUniqueNickname(string allowedChars, IEnumerable<string> existingNames)
Create a new, unique parameter nickname.
allowedChars (string)Allowed character set for naming logic.
existingNames (IEnumerable<string>)A collection of parameter names to avoid.
The first name combination that doesn't occur in the existingNames collection.

IsInputParam

#
public bool IsInputParam(IGH_Param param)
Returns True if this parameter is an input child of the component
param (IGH_Param)Parameter to test.

IsOutputParam

#
public bool IsOutputParam(IGH_Param param)
Returns True if this parameter is an output child of the component
param (IGH_Param)Parameter to test.

IsParam

#
public bool IsParam(IGH_Param param)
Returns True if this parameter is a child of the component
param (IGH_Param)Parameter to test.

OnParametersChanged

#
public void OnParametersChanged()
Call this function when you change input/output parameter lists or types. This function will wipe all caches that are potentially invalid. PerformLayout on the component attributes will be called.

Read

#
public bool Read(GH_IReader reader)
Read all parameter data from an IO archive.
reader (GH_IReader)Object to read with.
True on success, false on failure.
Read

ReadAllParameterData

#
[EditorBrowsable(EditorBrowsableState.Never)] public bool ReadAllParameterData(GH_IReader reader)
Deserialize all possible parameter data. You can only use this method if the archive was made using the WriteAllParameterData() method.
reader (GH_IReader)Reader object to deserialize from.
True on success, false on failure.

RegisterInputParam

#
public bool RegisterInputParam(IGH_Param new_param, int at_index)
Add a parameter at the specific index of the input list.
new_param (IGH_Param)
at_index (int)

RegisterInputParam

#
public bool RegisterInputParam(IGH_Param new_param)
Add a parameter to the end of the input list.
new_param (IGH_Param)

RegisterOutputParam

#
public bool RegisterOutputParam(IGH_Param new_param, int at_index)
Add a parameter at the specific index of the output list.
new_param (IGH_Param)
at_index (int)

RegisterOutputParam

#
public bool RegisterOutputParam(IGH_Param new_param)
Add a parameter to the end of the output list.
new_param (IGH_Param)

RepairParamAssociations

#
public void RepairParamAssociations()
Makes sure all parameter attributes are a-ok. If you stick to regular functions, you shouldn't have to call this.

RepairProxyParams

#
public bool RepairProxyParams(GH_Document document)
Attempt to fix all proxy params. Returns false if a single one fails.
document (GH_Document)Document that contains potential proxy targets.

SortInput

#
public void SortInput(double[] keys)
Sort the input parameter order based on a numeric key array.
keys (double[])Array of double precision numbers to function as sorting keys.

SortInput

#
public void SortInput(float[] keys)
Sort the input parameter order based on a numeric key array.
keys (float[])Array of single precision numbers to function as sorting keys.

SortInput

#
public void SortInput(int[] keys)
Sort the input parameter order based on a numeric key array.
keys (int[])Array of integer precision numbers to function as sorting keys.

SortOutput

#
public void SortOutput(double[] keys)
Sort the input parameter order based on a numeric key array.
keys (double[])Array of double precision numbers to function as sorting keys.

SortOutput

#
public void SortOutput(float[] keys)
Sort the output parameter order based on a numeric key array.
keys (float[])Array of single precision numbers to function as sorting keys.

SortOutput

#
public void SortOutput(int[] keys)
Sort the output parameter order based on a numeric key array.
keys (int[])Array of integer precision numbers to function as sorting keys.

Sync

#
public void Sync(IGH_SyncObject sync_data, ref int cleanup_count)
Sync changes from a prerecorded state. All param references in the sync object which are no longer present in the current server will be properly deleted. The sync object will be reset in the process, so you can only call this function with a specific Sync object once.
sync_data (GH_ComponentParamServer.IGH_SyncObject)Sync object. Should be obtained by calling EmitSyncObject()
cleanup_count (ref int)Number of parameters that were cleaned up.

Sync

#
public void Sync(IGH_SyncObject sync_data)
Sync changes from a prerecorded state. All param references in the sync object which are no longer present in the current server will be properly deleted. The sync object will be reset in the process, so you can only call this function with a specific Sync object once.
sync_data (GH_ComponentParamServer.IGH_SyncObject)Sync object. Should be obtained by calling EmitSyncObject()

Sync

#
public void Sync(object sync_data)
Sync changes from a prerecorded state. All param references in the sync object which are no longer present in the current server will be properly deleted. The sync object will be reset in the process, so you can only call this function with a specific Sync object once.
sync_data (object)Sync object. Should be obtained by calling EmitSyncObject()

UnregisterInputParameter

#
public bool UnregisterInputParameter(IGH_Param param, bool isolate)
Removes the specified parameter from this component.
param (IGH_Param)Parameter to remove
isolate (bool)If true, parameters that are removed will be isolated from sources and recipients.

UnregisterInputParameter

#
public bool UnregisterInputParameter(IGH_Param param)
Removes the specified parameter from this component.
param (IGH_Param)Parameter to remove

UnregisterOutputParameter

#
public bool UnregisterOutputParameter(IGH_Param param, bool isolate)
Removes the specified parameter from this component.
param (IGH_Param)Parameter to remove
isolate (bool)If true, parameters that are removed will be isolated from sources and recipients.

UnregisterOutputParameter

#
public bool UnregisterOutputParameter(IGH_Param param)
Removes the specified parameter from this component.
param (IGH_Param)Parameter to remove

UnregisterParameter

#
public bool UnregisterParameter(IGH_Param param, bool isolate)
Removes the specified parameter from this component.
param (IGH_Param)Parameter to remove
isolate (bool)If true, parameters that are removed will be isolated from sources and recipients.

UnregisterParameter

#
public bool UnregisterParameter(IGH_Param param)
Removes the specified parameter from this component.
param (IGH_Param)Parameter to remove

Write

#
public bool Write(GH_IWriter writer)
Write all parameter data to an IO archive.
writer (GH_IWriter)Object to write with.
True on success, false on failure.
Write

WriteAllParameterData

#
[EditorBrowsable(EditorBrowsableState.Never)] public bool WriteAllParameterData(GH_IWriter writer)
Serialize all possible parameter data. This is a sledge-hammer approach, do not use unless you're desperate.
writer (GH_IWriter)Writer object to serialize to.
True on success, false on failure.

WriteParamHashData

#
public static void WriteParamHashData(BinaryWriter writer, IGH_Param param, GH_ParamHashFields fields)
Write parameter data to a binary writer.
Remarks: This is useful for hashing purposes, there is no way to deserialize data written with this method.
writer (BinaryWriter)Writer to write with.
param (IGH_Param)Parameter to serialize.
fields (GH_ParamHashFields)Fields of parameter to serialize.

Events

ParameterChanged

#
Raised whenever there is a change to any parameter. If you only care about NickName or Source changes, handle the ParameterNickNameChanged or ParameterSourcesChanged events instead.

ParameterNickNameChanged

#
Raised whenever a parameter nickname change is accepted.

ParameterSourcesChanged

#
Raised whenever the source list of an input parameter is changed.