GH_ComponentParamServer
ReferencesWraps all members and functions needed for GH_Component to manage its input and output parameters.
Properties
Input
#Gets or sets the input list of parameters. Do not insert or remove parameters from this list, use the dedicated functions instead.
OnlyTreeAndListParameters
#Returns True if every input parameter is either a list or a tree parameter.
Output
#Gets or sets the output list of parameters. Do not insert or remove parameters from this list, use the dedicated functions instead.
Methods
AccessCount
#Returns the total number of input parameters that match the access mask.
Parameters:
| access (GH_ParamAccess) | Access flag mask. |
Clear
#Removes all input and output parameters.
Parameters:
| isolate (bool) | If true, parameters that are removed will be isolated from sources and recipients. |
CreateDuplicate
#Attempts to duplicate a parameter. Attributes will be ignored. Warning! The duplicate will have the same ID as the original!
Parameters:
| original (IGH_Param) | Parameter to duplicate. |
Returns: A dupicate of the original or null on failure.
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
#Find the parameter that has the given InstanceGuid.
Parameters:
| id (Guid) | InstanceID to search for. |
Returns: The parameter with the matching ID or null on failure.
GetEnumerator
#Gets a customized enumerator which iterates over all (both input and output) parameters.
GetEnumerator1
#Gets a customized enumerator which iterates over all (both input and output) parameters.
GetHashCode
#Creates a SHA1 hash from the parameter data.
Parameters:
| fields (GH_ParamHashFields) | Fields to include. |
Returns: A Guid representing a SHA hash of the parameter fields.
GetParam
#Finds the parameter that matches the specified search mask.
Parameters:
| name (string) | Name to search for. |
| side (GH_ParameterSide) |
Returns: The the parameter, or null if no parameter was found to match
IndexOfInputParam
#Finds the index of the input parameter that matches the specified search mask.
Parameters:
| id (Guid) | ID to search for |
Returns: The index of the parameter, or -1 if no parameter was found to match
IndexOfInputParam
#Finds the index of the input parameter that matches the specified search mask.
Parameters:
| name (string) | Name to search for. |
Returns: The index of the parameter, or -1 if no parameter was found to match
IndexOfOutputParam
#Finds the index of the output parameter that matches the specified search mask.
Parameters:
| id (Guid) | ID to search for. |
Returns: The index of the parameter, or -1 if no parameter was found to match
IndexOfOutputParam
#Finds the index of the output parameter that matches the specified search mask.
Parameters:
| name (string) | Name to search for. |
Returns: 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.
Parameters:
| allowedChars (string) | Allowed character set for naming logic. |
| existingNames (IEnumerable<IGH_Param>) | A collection of parameter names to avoid. |
Returns: The first name combination that doesn't occur in the existingNames collection.
InventUniqueNickname
#Create a new, unique parameter nickname.
Parameters:
| allowedChars (string) | Allowed character set for naming logic. |
| existingNames (IEnumerable<string>) | A collection of parameter names to avoid. |
Returns: The first name combination that doesn't occur in the existingNames collection.
IsInputParam
#Returns True if this parameter is an input child of the component
Parameters:
| param (IGH_Param) | Parameter to test. |
IsOutputParam
#Returns True if this parameter is an output child of the component
Parameters:
| param (IGH_Param) | Parameter to test. |
IsParam
#Returns True if this parameter is a child of the component
Parameters:
| 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
#Read all parameter data from an IO archive.
Parameters:
| reader (GH_IReader) | Object to read with. |
Returns: True on success, false on failure.
Implements: Read
ReadAllParameterData
#Deserialize all possible parameter data. You can only use this method if the archive was made using the WriteAllParameterData() method.
Parameters:
| reader (GH_IReader) | Reader object to deserialize from. |
Returns: True on success, false on failure.
RegisterInputParam
#Add a parameter at the specific index of the input list.
RegisterOutputParam
#Add a parameter at the specific index of the output list.
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
#Attempt to fix all proxy params. Returns false if a single one fails.
Parameters:
| document (GH_Document) | Document that contains potential proxy targets. |
SortInput
#Sort the input parameter order based on a numeric key array.
Parameters:
| keys (double[]) | Array of double precision numbers to function as sorting keys. |
SortInput
#Sort the input parameter order based on a numeric key array.
Parameters:
| keys (float[]) | Array of single precision numbers to function as sorting keys. |
SortInput
#Sort the input parameter order based on a numeric key array.
Parameters:
| keys (int[]) | Array of integer precision numbers to function as sorting keys. |
SortOutput
#Sort the input parameter order based on a numeric key array.
Parameters:
| keys (double[]) | Array of double precision numbers to function as sorting keys. |
SortOutput
#Sort the output parameter order based on a numeric key array.
Parameters:
| keys (float[]) | Array of single precision numbers to function as sorting keys. |
SortOutput
#Sort the output parameter order based on a numeric key array.
Parameters:
| keys (int[]) | Array of integer precision numbers to function as sorting keys. |
Sync
#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.
Parameters:
| 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
#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.
Parameters:
| sync_data (GH_ComponentParamServer.IGH_SyncObject) | Sync object. Should be obtained by calling EmitSyncObject() |
Sync
#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.
Parameters:
| sync_data (object) | Sync object. Should be obtained by calling EmitSyncObject() |
UnregisterInputParameter
#Removes the specified parameter from this component.
UnregisterInputParameter
#Removes the specified parameter from this component.
Parameters:
| param (IGH_Param) | Parameter to remove |
UnregisterOutputParameter
#Removes the specified parameter from this component.
UnregisterOutputParameter
#Removes the specified parameter from this component.
Parameters:
| param (IGH_Param) | Parameter to remove |
UnregisterParameter
#Removes the specified parameter from this component.
UnregisterParameter
#Removes the specified parameter from this component.
Parameters:
| param (IGH_Param) | Parameter to remove |
Write
#Write all parameter data to an IO archive.
Parameters:
| writer (GH_IWriter) | Object to write with. |
Returns: True on success, false on failure.
Implements: Write
WriteAllParameterData
#Serialize all possible parameter data. This is a sledge-hammer approach, do not use unless you're desperate.
Parameters:
| writer (GH_IWriter) | Writer object to serialize to. |
Returns: 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.
Parameters:
| 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.