_1024_SVG

franz's picture

Plugin to load SVG vector file and render it using GL_Lines.

DL from www.1024d.wordpress.com

dust's picture
Re: _1024_SVG

sweet, i have a grip of vectors i want to try this out with.

hey franz i noticed i get an error when building plugins in xcode telling me that a lot of your plugins use a re-order structure class or something. it doesn't seem to cause any problems, i just get a list of plugins that says can not either pre-flight or have not been restored successfully. so i have been building on a machine without plugins. should i disregard these types of errors ? its not only 1024 but a bunch of plugs do the same thing primarily people that use vv frameworks tell me the same thing.

franz's picture
Re: _1024_SVG

it happens when multiple plugins use the same class internally. Renaming the class before building would resolve the problem. In my case, I use an "ordered dictionary" class in the plugins that support QCstructure. Since the same class is present within multiple plugins, osx doesn't know which one to use. It can use any.

Regarding _1024 plugins, this won't cause any major error, as I didn't modify the objects, they're all the same, so any will do the job.

Generally you can disregard this warning, although it is not particulary pretty looking.

I should think about making a _1024_CORE plugin that contains all the classes I use, by this is beyond my ability at the moment. Maybe cwright has some valuable insights about that subject.

photonal's picture
Re: _1024_SVG

The plugin example doesn't seem to work for me. I tried in 32bit and 64bit QC.

franz's picture
Re: _1024_SVG

path is absolute. so copy the .svg file in your rootdrive, it will work


Having said that, any info on how to input a relative path in a QCplug. would be truly welcome.

photonal's picture
Re: _1024_SVG

Oh right I see - I was trying ./face.svg etc to access the current directory :)

bernardo's picture
Re: _1024_SVG

try this i would be very happy if it would help:

    NSString *path = self.inputPath;
  if([path length] != 0)//PATH SECTION
  {
     // is it an absolute path?  if so, don't do anything KINEME GUYS!!!
     if([path characterAtIndex:0] != '/')
     {
     NSLog(@"current ABSOLUT path : %@", path);

        if([path characterAtIndex:0] != '~')            
        {
           // this is when the file to save is relative to the compostion
           //COMPOSITE PATH
           path = [NSString pathWithComponents:[NSArray arrayWithObjects: [ [ [context compositionURL] path] stringByDeletingLastPathComponent], self.inputPath, nil]];
           NSLog(@"current COMPOSITION path : %@", path);
        }

        else
        {   // it is a ~ directory, expand it
           path = [path stringByExpandingTildeInPath];
           NSLog(@"current TILDED path : %@", path);
        }
     }


  }

franz's picture
Re: _1024_SVG

thanks bernardo, I'll try this tomorrow. Meanwhile, I borrowed some code from Vade:

pathURL = [NSURL fileURLWithPath: [NSString pathWithComponents: [NSArray arrayWithObjects: [ [ [context compositionURL] path] stringByDeletingLastPathComponent], self.inputString, nil]]];

but no luck, the compiler gives me a funky error: "Confused by earlier errors, bailling out"......

bernardo's picture
Re: _1024_SVG

hey funky is allways better... it worked for me... but i'm not a programer...i want to be one though a funky artist programmer.....

vade's picture
Re: _1024_SVG

Look at some of the v002 blur source code, Tom and I re-use classes (v002Shader, v002FBO), but have a @compatibility_alias and a macro in the precompiled header which actually, at compile time, gives the class a new, unique name, but you can program and reference it across the plugins with the same normal name you want.

It takes a few minutes to set up, but saves you and your users from those error messages, and is generally good practice, because if you do add a features to "Ordered Dictionary", you have absolutely no idea which implementation will load and be used when the plugin bundles binary data is loaded, so you will get unexpected behavior or try methods to @selectors which don't exist for the version of "Ordered Dictionary" you are using.

Better safe than sorry :)

gtoledo3's picture
Re: _1024_SVG

Whenever that happens, I save project and restart. I think at that point Xcode is borked. I've had Xcode spontaneously quit when the error reporter starts getting in that state...be careful :) It will usually at least start giving constructive messages after restart.

jersmi's picture
Re: _1024_SVG

Another 1024 plugin! What's that, almost twenty? Awesome... Curious what your plans are for developing this one.

Feature requests: A separate plugin that outputs the svg as a 2D (or 3D) structure.

Some way of understanding incoming scale, as pixels or whatever. Like is there a way to have an Illustrator stage keeps its pixel dimensions?

coyne's picture
Re: _1024_SVG

You are my hero! I second jersmi feature request regarding the option to output the output as a 2d or 3d structure for animation purposes. Like slowly painting in the strokes would be soo cool.

keep up the good work franz.

regards niklas

franz's picture
Re: _1024_SVG | 1.1 update

thxx Vade+Bernardo for the tips.

v1.1 reflects theses changes, relative paths are OK now ! Also added a SVGtoQCStructure patch. I still need to polish the duplicate object class issue tho'.

Note: when exporting SVGs from Illustrator, the scale is in pixels (? apparently), origin at top left corner of the page.

@jersmi, I'm developing this patch b/c MadMapper will -probably- feature a SVG export function... so I'm getting ready.

jersmi's picture
Re: _1024_SVG | 1.1 update

Fantastic! I noticed in 1.0 that changing Illustrator pixel size is reflected in the plugin -- is there a numerical relationship to the scale settings in the patch (set at .003 or whatever)?

MadMapper rocks.

jersmi's picture
Re: _1024_SVG

Attached Illustrator svg file has some issues rendering the SVG structure patch (stray points, missing parts). Advice welcome.

Also, seems to be a scale relationship using the Pixels to Units -- setting to 1 pixel seems a good place to start for X and Y scale on the SVG renderer.

PreviewAttachmentSize
SVGStruct_spiro0.zip9.48 KB

jersmi's picture
Re: _1024_SVG

Been having some fun with the SVG structure patch, testing speed, etc. using only the stock patch setting so far. I attached my comp + svg's. The last image file in the multiplexer list is the word "look". This demonstrates the structure not drawing completely. May be fixable as is, can't find a way yet.

franz's picture
Re: _1024_SVG

the file does seems to render correctly when using the openGL SVG render patch... Maybe it lacks a few subdivisions. In that case, in Illustrator, select the path and go to Object/ Paths/ Add Anchor Points.

see attached image.

When using the SVGtoQCStructure parser patch, you're supposed to know what you're doing, and be in charge of the rendering. My quick iterator macro can't adapt to all situations.

PreviewAttachmentSize
Screen shot 2011-02-03 at 10.53.34 AM.png
Screen shot 2011-02-03 at 10.53.34 AM.png182.26 KB

franz's picture
Re: _1024_SVG

FYI, the circles where not closed, so they lack the very last segment. Here's a quick fix showing how to build the last segment of a path, rendered in red: a line from the last point back to the first point. Hope this helps.

PreviewAttachmentSize
_1024_SVG_Structure_Spiro0_fix.qtz10.04 KB

jersmi's picture
Re: _1024_SVG

Thanks, franz, I appreciate it. I try to know what I'm doing, but my idiocy keeps me busy!

I forgot to post my experiments. I added the Z dimension.

PreviewAttachmentSize
1024_SVG_Struct_TEST.zip207.85 KB

jersmi's picture
Re: _1024_SVG

It rendered for me fine with the renderer patch, too. Interesting. It looked like open paths, but I do not know how you sussed them out exactly. I had generated circles in Illustrator then used the blend and rotate tools. Maybe the svg export? I'm not too surprised Illustrator didn't produce "clean" closed shapes, I guess. Though I did not think to look at the basic circles for open paths. Oh, Illustrator...

The one example of type I have in my test comp must have open paths, too. I did not create outlines in Illustrator, but I did select it in the font section of the SVG save dialog. I need to look closer at your fix comp -- your solution seems simple but I don't get it yet. I also do not get why you are dividing the iterated indices by 2 in the demo comp.

jersmi's picture
Re: _1024_SVG

And by the way, I was doing some funky stuff -- the structure plugin appears to be super stable, not a single crash or hiccup.

toneburst's picture
Re: _1024_SVG

This look very cool! Looking forward to giving it a go.

a|x

franz's picture
Re: _1024_SVG

the structure outputs the number of points. Since a line is 2 points, number of lines (= iterations) is numPoints/2 ... (= structureCount/2)

roughly, unless a line has an odd number of points, you'll have to use a trick:

  • if count%2== 0, iterations=floor (structureCount/2)

  • if count%2== 1, iterations=floor (structureCount/2) +1

hope this helps

jersmi's picture
Re: _1024_SVG

Helpful, yes. Thanks again, franz, for your generosity.