Itoo Software Forum

Author Topic: Getting element transforms  (Read 991 times)

Shawn Olson

  • Jr. Member
  • **
  • Posts: 67
  • Wall Worm
    • Wall Worm
Getting element transforms
« on: June 14, 2014, 02:57:57 PM »
I need to get the transformations for each element of a RailClone. Below is my pseudo-code start:

Code: [Select]
function wallworm_railclone_map rc = (

for currentNode in rc.sobjnode do (

local transforms = for t in rc.TRANFORMATIONS_FOR_currentNode_PARTS collect t

/*
NOW DO WHATEVER
*/

)

)

In the code above, how would I collect an array of transforms that are for the node specified as currentNode ?

Shawn Olson

  • Jr. Member
  • **
  • Posts: 67
  • Wall Worm
    • Wall Worm
Re: Getting element transforms
« Reply #1 on: June 14, 2014, 03:45:12 PM »
What I'm trying to do is export prop locations/orientations. I went through all the public properties and couldn't seem to find a solution.

I also tried using the Railclone Tools Instantiate utility as a manual work-around. But it won't work as I need because of a couple important issues:

1) The pivots are always offset with the instanced nodes that are generated (and I need the instances to have pivots unmodified from the original state in relation to the mesh).

2) Some segment elements are collapsed together (with a pivot aligned to the RC node itself).

For my purposes, I really just want to calculate the transforms of the segments on the fly, but I wanted to mention the Instantiate tool issues as well.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
    • iToo Software
Re: Getting element transforms
« Reply #2 on: June 15, 2014, 09:09:15 AM »
There is an important limitation in the workflow you want to achieve: not all elements of RailClone are instances, only those that are identical to the segment (not bended, sliced or deformed in any way). For this reason, RailClone Tools generates a collection of instances, and a separated mesh with the geometry that cannot be instantiated.

Besides that, RailClone includes an API to generate the geometry/instances without using RailClone Tools. It's used by some render engines as Thea Render or Corona, but it's written for for C++, not for Maxscript.
Carlos Quintero
iToo Software

Shawn Olson

  • Jr. Member
  • **
  • Posts: 67
  • Wall Worm
    • Wall Worm
Re: Getting element transforms
« Reply #3 on: June 15, 2014, 04:24:00 PM »
I suspected just such an answer.

That being said, I'd like to add a new option in RC for "Keep All Segments as Instances" specifically for this scenario, along with the ability to derive the transforms of the instances. While this is a specific scenario that forces a limit on some of the features of RC, it would help me add native prop export using Rail Clone (instead of just exporting a single large-high poly asset, the scene can reuse assets as is expected in the game engine), in my game exporter tools. I've already added this support for Forest Pro, and I would really love to have it with Railclone as well.

As it stands, emulating this requires me to use standard Max spline distribution--which is far more tedious than using Railclone and doesn't remain parametric.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
    • iToo Software
Re: Getting element transforms
« Reply #4 on: June 15, 2014, 05:16:34 PM »
If that helps, there is a combination of settings that disables most of deformations (and therefore increasing the number of instances):

- For Segments: Bend Off, Slice Off and Deform->Adaptative or Stepped.
- For Generators: Corner->Bevel Mode None

Or alternatively use proxies for Segments, that always as instanced. Anyway, i add your suggestion to the wishlist. I think it would be done easily.
Carlos Quintero
iToo Software

Shawn Olson

  • Jr. Member
  • **
  • Posts: 67
  • Wall Worm
    • Wall Worm
Re: Getting element transforms
« Reply #5 on: June 16, 2014, 03:15:46 AM »
If that helps, there is a combination of settings that disables most of deformations (and therefore increasing the number of instances):

- For Segments: Bend Off, Slice Off and Deform->Adaptative or Stepped.
- For Generators: Corner->Bevel Mode None

Or alternatively use proxies for Segments, that always as instanced. Anyway, i add your suggestion to the wishlist. I think it would be done easily.

Thanks!