Jump to content
  • Advertisement
Sign in to follow this  
Kryzon

[MaxScript] Listing all Geometry and Helpers?

This topic is 3075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all,
I'm attempting to write an exporter for a specific format by using the MaxScript interface.

I'm having trouble going through all the geometry and helpers currently in the scene. How should I design the For(...) loop to traverse through all the scene objects without having to select any of them?
What kind of colletion has both Geometry and Helpers?

I know it must be something in the lines of the "for obj in [something]" - but my mind can't get around that.

Thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
But this would cycle me through all the nodes in the scene, right?

Is there a way to filter the Geometries and Helpers (maybe with a Case...Of or something), just so I get these and not all the rest of node kinds when cycling through the Scene?

Share this post


Link to post
Share on other sites

You could test for each type of object



for obj in rootScene.world.children do (

case superclassof obj of
(
GeometryClass: -- Do stuff with geometry
Helper: -- Do stuff with helpers
)
)



Share this post


Link to post
Share on other sites
MaxScript help for 'ObjectSet Values'


-- helpers in scene
for h in helpers do
(
print h
)

-- geometry in scene
for g in geometry do
(
print g
)

Share this post


Link to post
Share on other sites
Is that so? I guess I'll have to use that when dealing with materials - although, I don't see a "material" ObjectSet value. How is it done?

About the geometry and helpers, the procedure should join the geometry and helpers (since both these kinds are game nodes) into the same array and loop through them:

for obj in rootScene.world.children do (

cl = superclassof obj
if (cl == GeometryClass) or (cl == Helper) then
(
append obj geometryAndHelper_Array
)
)

-- And then later on cycle through that:

for i = 1 to geometryAndHelper_Array.count do
(
geometryAndHelper_Array = -- blablabla
)


Is this a good way to approach it?

Share this post


Link to post
Share on other sites

-- Scene materials:

for s in scenematerials do
(
print s
)

-- Material Editor materials:
-- doesn't mean they are actually used in scene
-- array size I think is 24... number of material slots in material editor

for s in meditmaterials do
(
print s
)

In my opinion, don't worry about creating one big list.. process the two types of objects separately. If they are meant to be used together then go ahead and parent them as such and use the 'obj.parent' or 'obj.children' accessors.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!