opps not sure if i replied to all..

original message

I like to use OSC to send and receive information but thats just me. Chris
would be better at answering this question than me. Chris actually sent m,e
some code that helped that was the topic of yesterdays discussion i think.

- (void) awakeFromNib

{

[qcView setEventForwardingMask :NSAnyEventMask];

}

i have had a few goes at patch binding and stuff but haven't had much luck.
if you have a look at the cocoa for quartz composer example they have a set
input or something like that updates a text cell. using a key or sting for
the published port. you just make and grab the variable from that port you
published would be my guess. I haven't done much of that, I make iPhone
things in quartz 2d so im not entirely sure how its it done on the cocoa
application side, but chris is building an application im sure he can tell
you better than i can.

as per hit testing i have attached a patch that might help you do some extra
things. im not sure if it will work on your system give it a try. there is a
private patch inside quartz called hit test. you need a kineme hack called
core to view them, but seeing that its all ready on your system you might be
able to view the attached patch.

so getting variables from you would need a controller or you could use a
delegate. here is a sample of how i get data from a UISlider. This might be
all wrong but like i said its for iPhone.

so this is the @ interface you need to make a variable to capture the data
you want. in this case im getting a sliders value.

UISlider * slider;


you will need to do something like


NSNumber *yourNum;


then in the implementation of your action do something like this.


- (IBAction)sliderValue:(id)sender {

UISlider *slider = (UISlider *)sender;

int value = slider.value;

NSLog(@"osc %i",value);

}


yours will probabbly look like this.
-(IBAction)youAction:(id)sender{NSNUmber *yourNum = (NSNumber *)sender;
float value = yourNum.value;}


maybe that will help not sure... maybe later i will make a implementation,
because your question is a good one.


check out the hit test patch attached.




- Show quoted text -
-- 
Dustin O'Connor
http://numedia-sci.info

On Mon, Jan 12, 2009 at 8:53 AM, Jonathan Selander <[email protected]>wrote:

> The expression works like magic! :)
>
> I have one last stupid question about this. I have now published the
> outputs of the expressions, but how can I read the values from the cocoa
> app? I suppose somehow using QCPatchController, but I only know how to set
> values, not how to retrieve them (maybe this is a question for cocoa-dev?)
>
>
> 12 jan 2009 kl. 13.30 skrev Chris Wood:
>
>
>  For hit testing, the hit area is normally:
>> x - (width / 2) to x + (width + 2)
>> y - (height / 2) to y + (height + 2)
>>
>> You can do the whole lot inside a single mathematical expression patch
>> with:
>>
>> (mouseX > (x - (width / 2))) && (mouseX < (x + (width / 2))) && (mouseY >
>> (y - (height / 2))) && (mouseY < (y + (height / 2)))
>>
>> Whether it's better to do it in QC or in your app depends on the case, but
>> QC is generally easier as the mouse coordinates are already converted for
>> you (i.e. the mouse position reported by the Mouse patch will match the
>> x/y/size coordinates on the billboards).
>>
>> Doing the actual handling of an interface or something in QC can be quite
>> a pain, as you're limited to javascript and a ton of wires, but it's easy
>> enough to hit test in QC and pass the result back to your cocoa app.
>>
>> Chris
>>
>>
>> 2009/1/12 Jonathan Selander <[email protected]>
>> Ahh, yes, of course. I'm still trying to figure out how to calculate the
>> position using the width. I underestand why it's 0-0.5 when it's at 0.5 and
>> 0.25 width, but with other examples I fail to get it right.
>>
>> I've got the width and X/Y positions defined outside the billboards
>> already, so I should be able to use some logic to get what I need.
>>
>> Do you think it's best to put this logic in the cocoa application or in
>> the quartz composition?
>>
>> /Jonathan
>>
>>
>> 12 jan 2009 kl. 11.26 skrev Chris Wood:
>>
>>
>> Jonathan,
>>
>> The image origin doesn't actually refer to the 'position on screen', it
>> refers to something more like the 'texture offset', which is sometimes
>> useful (and sometimes a real pain) when you're doing core image processing.
>> It generally doesn't affect the position you see the image, but if you're
>> doing things like adding one image over another image it can be important as
>> it affects the position there.
>>
>> The 'position on screen' will depend more on where you're telling it to
>> draw (as you have to give the sprite/billboard/etc. a position and a size
>> for it to draw), so you should actually already have the position. E.g. if
>> you have a billboard at position 0.25, 0.25 and size 0.5, 0.5 you just need
>> to test if the mouse is in the range x 0 to 0.5 on x and 0 to 0.5 on y.
>>
>> Let me know if you need help with something more specific.
>>
>> Chris
>>
>>
>> 2009/1/12 Jonathan Selander <[email protected]>
>> Hi, i'm trying to find where in the view an image is positioned, but image
>> origin always reports 0. I read in the doc that it's like this if the
>> dimensions are infinite, but what does that really mean?
>>
>> I'm trying to create a patch that determines whether or not the mouse
>> cursor is over the image.
>>
>> Thanks
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Quartzcomposer-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>>
>> http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com
>>
>> This email sent to [email protected]
>>
>>
>>
>>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/quartzcomposer-dev/dustin.oconnor%40gmail.com
>
> This email sent to [email protected]
>



-- 
Dustin O'Connor
http://numedia-sci.info

Attachment: HitTest.qtz
Description: application/quartzcomposer

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to