Coder Social home page Coder Social logo

qcplugincreationassistant's Introduction

QCPluginCreationAssistant

Chris Birch 14/01/2013

Command line app to automatically generate port code for Quartz Composer plugins.

Given a PList file, will generate repetitive port code for QC plugins.

See ExamplePorts.plist for information on how to structure the input property list.

The generated code is outputted to the console and also to the specified text file.

Once generated its up to the developer to copy and paste the code into appropriate sections.

Generates code for:

*Objective C properties and @dynamic declarations
*+(NSDictionary *)attributesForPropertyPortWithKey:(NSString *)key
*- (BOOL)execute:(id )context atTime:(NSTimeInterval)time withArguments:(NSDictionary *)arguments

Usage:

QCPluginCreationHelper InputPList OutputTextFile

The input PList should be created with the following structure:

<array>
	<dict>
		<key>Name</key>
		<string></string>
		<key>FriendlyName</key>
		<string></string>
		<key>Type</key>
		<string></string>
		<key>DefaultValue</key>
		<string></string>
		<key>Comment</key>
		<string></string>
		<key>IsInput</key>
		<true/>
		<key>ValueChangedTarget</key>
		<string></string>
		<key>ValueChangedBody</key>
		<string></string>
	</dict>
	<dict />
	<dict />
	<dict />
</array>

For each input or output port you wish to create, copy the Dict structure from above into your plist.

Explanation of the properties:

Both input and output ports:

Name
The name of the ObjectiveC property
FriendlyName
the name of the port as it will appear in Quartz Composer. This param is optional, if not supplied the Name is used instead.
Type
can be one of the following: int, double, string, bool, array, dictionary
Comment
a brief comment about what the port is (this will be outputted in the generated code). This param is optional.
IsInput
a bool value that dictates whether or not this port is an input(true) or an output(false).

Input ports Only:

DefaultValue
The default value used by input ports. This param is optional.
ValueChangedTarget
describes a property or field that should be set when the input port value changes. This param is optional
ValueChangedBody
(overrides ValueChangedTarget). Describes a snippet of code that will be run when the value of an input port changes. This param is optional. NB: A #warning directive will be created for each port that specifies this property. This is warn that potentially old code is being pasted into the project

Example.

Here is an example PList file and the generated output created by running the console app.

Input

See An Example Plist file

Output

#######################################################################
#
# Auto generated code created using QC Plugin Assistant by Chris Birch
#
#######################################################################




###################################
# Place in the plugin .h file
###################################


//Port Defines

//An example Input port using ValueChangedTarget
#define INPUT_PORTA @"inputPortA"
//An example Input port using ValueChangedBody
#define INPUT_PORTB @"inputPortB"
//An example output port
#define OUTPUT_PORTC @"outputPortC"


//Port Properties

@property (assign) BOOL inputPortA;
@property (assign) BOOL inputPortB;
@property (assign) double outputPortC;



###################################
# Place in the plugin .m file
###################################


//Port Synthesizes

@dynamic inputPortA;
@dynamic inputPortB;
@dynamic outputPortC;

//Port Attributes

//An example Input port using ValueChangedTarget
if([key isEqualToString:INPUT_PORTA])
    return [NSDictionary dictionaryWithObjectsAndKeys:
            @"Port A", QCPortAttributeNameKey,
            [NSNumber numberWithBool:YES], QCPortAttributeDefaultValueKey,
            nil];
//An example Input port using ValueChangedBody
else if([key isEqualToString:INPUT_PORTB])
    return [NSDictionary dictionaryWithObjectsAndKeys:
            @"Port B", QCPortAttributeNameKey,
            [NSNumber numberWithBool:YES], QCPortAttributeDefaultValueKey,
            nil];
//An example output port
else if([key isEqualToString:OUTPUT_PORTC])
    return [NSDictionary dictionaryWithObjectsAndKeys:
            @"Port C", QCPortAttributeNameKey,
            nil];

//Port Value Changed code

//An example Input port using ValueChangedTarget
if ([self didValueForInputKeyChange:INPUT_PORTA])
{
    myInstance.myProperty = self.inputPortA;
}
//An example Input port using ValueChangedBody
if ([self didValueForInputKeyChange:INPUT_PORTB])
{
#warning This code could be out of date as it was read in from Ports PList
myInstance.myProperty = inputPortB; foo();
}


qcplugincreationassistant's People

Stargazers

Chris Beiser avatar

Forkers

annovae

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.