QCPatch Methods

From QuartzCompositions.com the central source for Quartz Composer :: wiki

When implementing Custom Patches, the developer has the option to perform self-operations on a subclass of QCPatch.


Table of contents

Pausing and Resuming Notifications

[self pauseNotifications];

  • Pause notifications before creating/deleting input/output ports.

[self resumeNotifications];

  • Resume notifications after input/output port creation/deletion is complete.


Creating and Deleting Input and Output Ports

[self createInputWithPortClass:portclass forKey:key attributes:0x0];

  • adds key to the input ports list
  • portclass should be the "class" method of a class derived from QCPort. For example: [QCNumberPort class]
  • key should be an arbitrary NSString, unique to this patch instance. For example: @"controller_0"
  • attributes is possibly used to specify enum lists

[self deleteInputForKey:key];

  • removes key from the input ports list

[self createOutputWithPortClass:portclass forKey:key attributes:0x0];

  • adds key to the output ports list
  • portclass should be the "class" method of a class derived from QCPort. For example: [QCNumberPort class]
  • key should be an arbitrary NSString, unique to this patch instance. For example: @"controller_0"
  • attributes is possibly used to specify enum lists
  • Consumer patches (executionMode() == 1) cannot have output ports.

[self deleteOutputForKey:key];

  • removes key from the output ports list


Logging

[self logMessage:@"foo"];

  • Logs a message to the system console.
  • Logs a message to the Viewer Log Drawer.
  • Puts the patch in Debug mode.

NSLog(@"foo");

  • Logs a message to the system console (without logging to the Viewer Log Drawer or putting the patch in Debug Mode.