PDA

View Full Version : Book building - Weight to Layers?



raw-m
04-22-2015, 11:00 AM
Building a book and I've got a couple of hundred pages all generated by MGimagetoLayers. Hundred pages UV mapped and lovely at the click of a button.

But.... they are generated at the origin. They all need offsetting down the z, but in order.

So I'm thinking, is there a script that will generate one weight map but with incremental values on each layer? A bit like TrueArt's Weight Polygon Groups but over layers. That way I can use Transform based on Weightmap to separate them all out.

I'll need to flatten the object anyway, so an alternative is to flatten the object and use Weight Polygon Groups by selecting each surface one at a time in order - there's a hundred of them - then use Transform based on Weightmap to separate them all out. No fun :(

Another thought is to do it in Layout using Motion Options, but again, it means copy/pasting MO over hundred times to each object and then saving out a transformed scene - no fun :(

ernpchan
04-22-2015, 12:01 PM
But.... they are generated at the origin. They all need offsetting down the z, but in order.

So I'm thinking, is there a script that will generate one weight map but with incremental values on each layer? A bit like TrueArt's Weight Polygon Groups but over layers. That way I can use Transform based on Weightmap to separate them all out.



Not sure about the weight map script/plug-in. The alternative would be to iterate through all the layers and apply an incremental offset on each layer. That's an easy one via scripting.

daforum
04-22-2015, 12:14 PM
Nickdigital made a script that could offset in the z-axis, and he posted it here somewhere on the forum.
It was one of his quick scripts.

ernpchan
04-22-2015, 12:47 PM
Nickdigital made a script that could offset in the z-axis, and he posted it here somewhere on the forum.
It was one of his quick scripts.

I did?! I don't remember doing this. I'll have to search through my library.

raw-m
04-22-2015, 01:01 PM
That would be an excellent alternative. Please tell me more.....:D

ernpchan
04-22-2015, 01:05 PM
That would be an excellent alternative. Please tell me more.....:D

I don't remember making this script. It may have been a one-off challenge that I did during a lunch break. Maybe you'll get lucky searching the forum...

I can search my files when I get home.

raw-m
04-22-2015, 01:41 PM
Thanks. Would they be called "quick scripts"? I'll have a dig around.

ernpchan
04-22-2015, 01:51 PM
Thanks. Would they be called "quick scripts"? I'll have a dig around.

If it's like any of the other scripts I've slapped together as a challenge to a thread problem, I probably posted the script in that specific forum versus announcing it in it's own thread. I've moved away from doing that as it's not a very good way of cataloging scripts.

If need be I could remake that script. I'd probably do it in python as I've moved away from lscript. I could probably recycle code from other scripts I've tinkered with. Is this something you need right away? Or can it wait till the weekend?

(Unless someone else wants to beat me to this)

raw-m
04-22-2015, 01:53 PM
Still searching but not getting the keyword quite right, yet!

That would be so much appreciated, the weekend would be great.

ernpchan
04-22-2015, 02:00 PM
Still searching but not getting the keyword quite right, yet!


Maybe do a search for every thread response nickdigital ever made...could be painful to search though. I think it's a pretty high number.

I'll try to cobble something together this weekend. Maybe it'll evolve into a more robust tool...move, scale, rotate, etc.

JoePoe
04-22-2015, 02:02 PM
Maybe I'm not understanding fully....

Can you get them all on one layer > use Weight Poly Group > do your adjustment with Transform by weight > then use Connected to Layer to put them all back in their own layer. (but then you said you need to flatten anyway so.... :stumped:)

On second read I think I'm saying what your option two is. Does weight poly group only work with a manual selection of polys?

What do all these pages look like together? Stacked? Can you use a simple linear falloff for the transform?


ANOTHER THOUGHT:
Simply place the first and last pages where they need to be. (sounds like you will only need to move the last page).
Then use Align and Distribute (https://www.lightwave3d.com/assets/plugins/entry/align-and-distribute/) plug down the Z.

raw-m
04-22-2015, 02:15 PM
Hi JoePoe, I would need Weight Poly Group to work in a specific order, ie page 1,2,3.... So would need to select them in the correct order, which is a pain and open to human error.

Linear falloff won't work as there's no space between them, they are in exactly the same position, 0,0,0.

If you can think of a solution then that would be great!

JoePoe
04-22-2015, 02:19 PM
Raw

See my "ANOTHER THOUGHT" (they can all stay on their own layer :hey:)

raw-m
04-22-2015, 02:22 PM
Look at that! Top find, fingers crossed it works on a Mac, cheers JoePoe. Finished for the day, will report in the morning.

JoePoe
04-22-2015, 02:24 PM
Oh it works on a Mac. How do I know?.... because I work on a Mac! :D

:beerchug:

BokadCastle
04-22-2015, 04:33 PM
When you load MGimagetoLayers, there are 3 scripts loaded simultaneously.
One is called "Layer Offset" - try that.

lertola2
04-22-2015, 04:56 PM
What is this MGimagetoLayers? I can find it in the plugins database and it does not seem to be mentioned in any thread except this one.

ernpchan
04-22-2015, 04:59 PM
What is this MGimagetoLayers? I can find it in the plugins database and it does not seem to be mentioned in any thread except this one.

It's one Dodgy's scripts.
http://www.mikegreen.name/

JoePoe
04-22-2015, 05:00 PM
What is this MGimagetoLayers? I can find it in the plugins database and it does not seem to be mentioned in any thread except this one.

Ditto. All I could find was MGImagesToPlanesMD and that was on Mike Greens website. Is it a 2015 addition?
No such setting on the version I've got....v1.9.

....oh, and the Layer Offset sounds like a setting that makes too much sense :D. In other words perfect.

Sorry Ernest posted 1 minute after you .... again (that seems to happen a lot :D).
Yeah ... MG. But, the question still remains.

ernpchan
04-22-2015, 05:08 PM
Sorry Ernest posted 1 minute after you .... again (that seems to happen a lot :D).


It's all good.

If you found a native solution for raw-m...then I have a free weekend of watching basketball playoffs and falling asleep on my sofa. :D

JoePoe
04-22-2015, 05:14 PM
:)

Well I know my suggestion will work and take just a few seconds.....
BUT this Layer Offset setting in the initial planes creation process BokadCastles mentioned sounds like the ace in the hole.

If I could just find it.

BokadCastle
04-22-2015, 05:21 PM
you run Layer Offset after all the images are created at the origin.
- it's a 2 step process.

ernpchan
04-22-2015, 05:22 PM
:)

Well I know my suggestion will work and take just a few seconds.....
BUT this Layer Offset setting in the initial planes creation process BokadCastles mentioned sounds like the ace in the hole.

If I could just find it.

Not sure what Bokad is talking about...loading Dodgy's script just loads one file. There's no layer offset option in his gui either. I also notice he calls it ImagesToLayers and not ImagesToPlanes.

- - - Updated - - -


you run Layer Offset after all the images are created at the origin.
- it's a 2 step process.

Ah ok.

BokadCastle
04-22-2015, 05:31 PM
127950

btw I have a 4K monitor.

JoePoe
04-22-2015, 05:35 PM
- it's a 2 step process.

Ah ok from me too....

....but still can't find it. :cry:

BokadCastle
04-22-2015, 05:38 PM
layer offset - I wonder if I found this somewhere else -
there's no credits to MG, I'm happy to post it.

- - - Updated - - -

@version 2.8
@warnings
@script modeler
@name "Layer Offset"

main
{
myOffset = recall("myOffset",1);

reqbegin("Layer Offset");

c0 = ctlnumber("Offset",myOffset);

if(!reqpost()) return;

myOffset = getvalue(c0);

store("myOffset",myOffset);

reqend();

result = lyrdata();

n = sizeof(result);

d = 0;

for(i = 1; i<= n; i++)
{
lyrsetfg(result[i]);
move(0,0,d);
d = d + myOffset;
}
}

ernpchan
04-22-2015, 05:45 PM
Probably need to file this away in lwplugindb.com.

BokadCastle
04-22-2015, 05:49 PM
Yeah, just checked - sometime ago I must have run into the same problem you are now trying to solve.

I must have found that script somewhere out there, used it then promptly forgot it.
It would have been a couple of years ago.

Sorry for any confusion I caused, however still try it out.

JoePoe
04-22-2015, 05:50 PM
Sweet!

Thanks!

raw-m
04-23-2015, 03:33 AM
Looks like it all happened while I was sleeping!

Stand down ernpchan, enjoy your sofa!

That Layer Offset script works a treat, thanks BokadCastle. If I had one minor request it would be that, after running the script, it turns off all the FG layers except the last. Would be nice to have them left on.

Align and Distribute works well, too. Have to be careful to select the right option so the layers are offset in order. Also, couldn't get the "Modified" version to work - it requests a "awAlignAndDistribute.tga" file. I'm assuming it has something to o with the UI. The older version works OK though (if a little ugly!).

I've found a nice technique for quickly getting some page flips, I'll put together a tute when I've finished this.

daforum
04-23-2015, 05:38 AM
I need to apologise for my original post.
The script that nickdigital ( now ernpchan ) made was 'Layer Offset' and probably won't work for you raw-m.

Anyway, the script was posted here:http://forums.newtek.com/showthread.php?135471-Offsetting-objects-script-in-Modeller

raw-m
04-23-2015, 07:05 AM
Well that's really embarrassing! It's a post I started with pretty much the same question. I think me and ernpchan must have had some kind of blackout that week.

But thanks everyone again. As an apology, I'll make that tutorial later today!

ernpchan
04-23-2015, 08:33 AM
Wow, so we had this same conversation years ago? I even had the same idea of adding more functionality. lol

If it's still worth it, I could still make a more robust tool.

raw-m
04-23-2015, 12:13 PM
Did it!

https://www.youtube.com/watch?v=j6cjfr245oQ

ernpchan
04-23-2015, 04:52 PM
Did it!

https://www.youtube.com/watch?v=j6cjfr245oQ

Very cool!