Skanky Plugin : where's my build ?

franz's picture

Hi KnM ! I just downloaded the latest Skanky SDK from github. Did a fresh install.sh Started a new Xcode project using the template. Went fine.

Did a dummy "do nothing" plugin. Clicked build.

Build went fine.

But where's my built plugin ? There's no build folder in my project ... I spotlighted my drive to look for the built plugin. Nothing.

What am I doing wrong ? I must admit I'm clueless... any help truly welcome. (note that I could use standard API, but this time I need "allow subpatches" support)

smokris's picture
Re: Skanky Plugin : where's my build ?

@franz: The last Xcode build phase places the compiled plugin into your Quartz Composer Patches folder.

Here's the relevant bit from the "postprocess" script: https://github.com/kineme/QCPatchXcodeTemplate/blob/master/resource/plug...

franz's picture
Re: Skanky Plugin : where's my build ?

thanks for the tip Steve. Now everything is up and running.

One last thing:

I've setup a dummy patch that allows subpatch, set it to renderer type, set the context accordingly in the execute method, but when I place a Sprite inside, nothing renders. (I mimicked a GLtools source...)

Here's my code, am I doing something wrong ? thxxx

+(BOOL)allowsSubpatchesWithIdentifier:(id)identifier
{
   return YES;
}
 
+(int)executionModeWithIdentifier:(id)identifier
{
   return 1;
}
-(BOOL)execute:(QCOpenGLContext*)context time:(double)time arguments:(NSDictionary*)arguments
{
   CGLContextObj cgl_ctx = [context CGLContextObj];   
   return YES;
}

gtoledo3's picture
Re: Skanky Plugin : where's my build ?

I would try listing the execution mode first, and then make the call for subpatches. Other than that, the only thing I can see is that there's no @end , but I'm assuming that didn't make the cut and paste.

Additionally, you could try QCPatchExecutionMode in place of int , and change identifier to fp8 in both places. I don't know if Lion is fussy about that or not. It might be some kind of "optimization" thing, since there are no ports being made on the patch/no initWithIdentifier, patch attributes, and no time mode.

You might try this after allowsSubpatchesWithIdentifier, to declare the timemode.

+ (int)timeModeWithIdentifier:(id)fp8
{
   return 0;
}

...and this before the execute method to set patch attributes.

- (id)attributes
{
   NSMutableDictionary *at = [[[super attributes] mutableCopy] autorelease];
   [at setObject:@"MyCoolPatch" forKey:@"name"];
   return at;
}

...you know, looking again, it's overwhelmingly likely that it's just because you aren't calling[self executeSubpatches:time arguments:arguments]; in your execute. Without that, you wouldn't see anything in there.

gtoledo3's picture
Re: Skanky Plugin : where's my build ?

I woke up this morning and decided to take another look... (when I was answering this last night, I was kind of tired, and a little jet lagged).

It is definitely because you weren't calling [self executeSubpatches:time arguments:arguments] , but that's not to say there couldn't have been some other issue somewhere as well.

I'm attaching a project that makes a consumer macro that does nothing... if anyone kineme feels like chiming in on fine points, or cwright, or anyone really, please feel free. I believe this to be correct though.

In making the project, I also note that you shouldn't have to create a CGLContextObj if the patch is doing nothing... or, at least I believe that to be the case.

The header is going to look like:

//
//  Created by George Toledo on 2/11/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
 
@interface ConsumerMacroPatch : QCPatch
{
//declare ports here
}
+ (int)executionModeWithIdentifier:(id)fp8;
- (id)initWithIdentifier:(id)fp8;
+ (int)timeModeWithIdentifier:(id)fp8;
 
 
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments;
@end

and the implementation is going to look like this more or less...

//
//  Created by George Toledo on 2/11/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
 
#import <OpenGL/CGLMacro.h>
#import "ConsumerMacroPatch.h"
 
 
@implementation ConsumerMacroPatch : QCPatch
 
+ (int)executionModeWithIdentifier:(id)fp8
{
   return 1;
}
 
+ (BOOL)allowsSubpatchesWithIdentifier:(id)fp8
{
   return YES;
}
 
+ (int)timeModeWithIdentifier:(id)fp8
{
   return 0;
}
 
//set initial port values here.
- (id)initWithIdentifier:(id)fp8
{
   self=[super initWithIdentifier:fp8];
 
   if(self)
   {
      //[inputBlah setDoubleValue:0.];   
 
   }
 
 
   return self;
}
 
- (id)attributes
{
   NSMutableDictionary *at = [[[super attributes] mutableCopy] autorelease];
   [at setObject:@"Consumer Macro" forKey:@"name"];
   return at;
}
 
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
 
   //CGLContextObj cgl_ctx = [context CGLContextObj];
 
   [self executeSubpatches:time arguments:arguments];
 
   return YES;
}
 
@end
PreviewAttachmentSize
ConsumerMacroExample.zip16.82 KB

franz's picture
Re: Skanky Plugin : where's my build ?

bingo ! you saved my ass.

[self executeSubpatches:time arguments:arguments] did it.

I owe you a barrel of rhum.

gtoledo3's picture
Re: Skanky Plugin : where's my build ?

Cool!

A vaguely related thought comes to mind of something that may not be obvious; a Consumer macro can render extra geometry along with the objects inside, or just render it's own stuff and not render the objects inside at all. I don't know what the benefit would be of having a Consumer macro that draws stuff and doesn't render objects inside, but I think there's a patch that renders a frame outline in iDVDPatches that does that.

What kind of thing is your patch doing? Top secret?

franz's picture
Re: Skanky Plugin : where's my build ?

madmapper related patch ... ;-)

Good point about adding extra rendering commands in the macro ... !

as a sidenote, while the skanky SDK being uber-kewl, in a perfect world it lacks consistency with the public API. nothing dramatic so far ...

gtoledo3's picture
Re: Skanky Plugin : where's my build ?

Sure, it's not as though it's the QCPlugin API with extra stuff, it's distinct.

Anything in specific popping up?

Also, depending on what you're doing, this may come in handy:

+ (BOOL)supportsOptimizedExecutionForIdentifier:(id)identifier
{
   return NO;
}

Which will keep stuff from "not rendering" when QC gets confused and thinks stuff is offscreen (which can be the case if you're manipulating offscreen vertices so that they should be offscreen, or shuffling stuff around in 3D transforms).

If you're doing stuff to manipulate texture, you can place Image Texturing Property patches in between provider/consumer subpatches inside of your custom macro, set the image, and then manipulating the texture globally via the environment will push around the textures while also tiling.

I'm just that bored this morning that I'm chiming in with this stuff :-) I'm also always interested in another person starting to use the skankySDK/GFPlugin. After having stuff sink in, it's hard to want to deal with QCPlugin. I especially don't like dealing with structures with the QCPlugin api.

On a side note, it would be cool at some point to try to de-skanky the skankySDK and make an actual analog of the private api, maybe by forking on github or something.