MoI discussion forum
MoI discussion forum

Full Version: Auto Number Object Copys

Show messages:  1-7  8-23

From: danperk (SBEECH)
19 Nov 2009   [#8] In reply to [#7]
Hi Michael,

Sorry, I'm guilty of side tracking this discussion into a
parent/child hierarchy between different objects wish. ;)
Does fbx, dae, or lwo support parent/child hierarchy?

>In your screencap, I noticed that you set all the pieces of your second copied object to the same name - doesn't that end up messing up your organization? If you don't do that name assigning step then you should get your pieces preserved better, like the legs will be named "Legs_1" for the first legs, and "Legs_2" for the second chair's legs, wouldn't that be more what you want?<


When I run the script on (1) chair object I end up with
chair_1 to chair_12. So I guess the way I'm going to
get what I need is if each instance of a chair is single
Boolean object. Then I can run the script on multiple chairs
in get the desired result. Then I can use the Style setting
to zero in on sub-objects using 'Select by material' in my
mesh program.

I use trueSpace 6.6/76.1 as my main mesh program (I know, the program
people love to hate, but it works for me.)

I'm open to alternatives for a poly render-er if it makes life easier.


Thanks very much for auto numbering script!!! :)
From: Michael Gibson
19 Nov 2009   [#9] In reply to [#8]
Hi Steve,

> Does fbx, dae, or lwo support parent/child hierarchy?

lwo does, and I think that fbx and dae probably do as well.

But keep in mind that just because a format supports having a hierarchy does not automatically mean that a program reading it also preserves it as well.

I'm not really sure in general if I'll be able to attempt to get groups exporting to other programs in MoI v2, that may be something that does not happen until v3.

I'll actually be kind of lucky to get groups just working well within MoI itself for v2 I think. Exporting tends to be a whole different world of difficulty.


> When I run the script on (1) chair object I end up with
> chair_1 to chair_12.

Sorry, I'm not following you - it seemed like in your screencap you did not just have a "chair" object, you had a variety of objects like "Legs", "Pole" etc...

So now I'm confused that you are talking about "chair" - what happened to all the individual pieces?

Maybe you can post your chair model so I can follow along more closely.

But the idea is that if you have a bunch of objects like "Legs", "Pole", "Seat", etc.., then if you duplicate all of those and run that script (without changing or assigning a new name to everything!) then you should end up with the legs on object1 being "Legs_1", the legs on object 2 being "Legs_2", etc... - does that not work for you?

- Michael
From: danperk (SBEECH)
19 Nov 2009   [#10]
Here's the file.
From: Michael Gibson
19 Nov 2009   [#11] In reply to [#10]
Thanks for posting the model.

So yeah if I take your chair model and make some copies it looks like this:



You've got the duplicate names there that you don't want - like "Foot rest" for example is the same name on all 3 foot rests.

But why at this point in your screencap are you selecting the copied objects and setting all their names to something like "chair1" ? That is not making a hierarchy - what that is doing is erasing all the existing names on all the selected objects and instead setting them to have the name "chair1".

It doesn't seem like you want to do that - you're erasing all your assigned names by doing that.

Instead right after copying, run the script (do not assign any new names), and the object names will separate like this:



So now you've got different names for each foot rest - the foot rest for object 1 is "Foot rest_1", the foot rest for object 2 is "Foot rest_2", and the foot rest for object 3 is "Foot rest_3".

Doesn't that do what you need?

- Michael

Image Attachments:
chair_names1.jpg  chair_names2.jpg 


From: danperk (SBEECH)
19 Nov 2009   [#12] In reply to [#10]
My ideal situation would be I load say 20 chairs via OBJ import and 1st step down in hierarchy
would select one of 20 chairs, next step down would select that chairs seat etc. (parent/sibling nesting)
without thinking about the fact that OBJ doesn't support parent/sibling nesting.

The script you supplied will be very handy for using multiple approaches.

Thanks again!!
From: Michael Gibson
19 Nov 2009   [#13] In reply to [#12]
> My ideal situation would be I load say 20 chairs via OBJ
> import and 1st step down in hierarchy
> would select one of 20 chairs, next step down would
> select that chairs seat etc. (parent/sibling nesting)

Well yes I think we will get to that point eventually with groups.

Except OBJ not supporting hierarchy throws a monkey wrench in there.

In some cases I have seen programs encode a hierarchy inside of an object name with stuff like different levels separated by a : like the name being "Chair1:Seat:Seat Top"

Do you happen to know if trueSpace supports converting object names into a hierarchy like that? If it does then it may be possible to make it work.

What happens if you take a model that has hierarchy in trueSpace, and export it to OBJ and then read it back in again to a new fresh trueSpace program instance? Do you get the hierarchy back again or is it gone? If you get it back again, if you can send me a sample OBJ file that preserves the hierarchy then that could help.

- Michael
From: danperk (SBEECH)
19 Nov 2009   [#14] In reply to [#13]
>What happens if you take a model that has hierarchy in trueSpace, and export it to OBJ and then read it back in again to a new fresh
>trueSpace program instance? Do you get the hierarchy back again or is it gone?

No, it's maintained for 1 chair, that was the flaw in my thinking.

If Moi gets to this point and there is another viable export option,(fbx, dae,lwo) then it's time to shop for a new poly modeler.

For the moment the attached chair works, I can use your script on multiple copies (giving me chair_1 Chair_2 etc.), export as obj and
select down in hierarchy and from there I can select by Style (material).
From: Michael Gibson
19 Nov 2009   [#15] In reply to [#14]
Hi Steve, I'm glad you got a way that will work for the time being.

So the test I was asking about was actually: What happens if you create a model just totally inside of trueSpace instead of importing it from MoI, where that model has some hierarchy in it (for example a parent box with 2 child spheres, or whatever).

If you export that model from trueSpace into an OBJ file, and then exit trueSpace, then start it up again and read the OBJ file back in, do you end up with the hierarchy preserved?

If you do, then it means that trueSpace is encoding its hierarchy somehow in the OBJ file and if that is the case then I could do it too.

- Michael
From: Ecuadorian
20 Nov 2009   [#16] In reply to [#1]
Danperk, how did you create the awesome animated GIF in the first post? It looks very clean and noise-free.
From: danperk (SBEECH)
20 Nov 2009   [#17] In reply to [#16]
Hi Ecuadorian,

I used Camtasia 5. Not sure what version they are selling
now but Version 5 worked well so I haven't upgraded.


Hi Michael,

I tried the round trip by exporting a parent with 2 sibling children.

On import the group reverted to 3 siblings.

My main problem is I'm using Moi for scene creation, not just for
creating objects. It works so well for this, I prefer to do everything
except textures and render/animation in Moi. The situation is that
after the texturing stage if a client decides to make changes to
the scene layout, (they always do), then I need my hierarchy to
be easy to re-arrange/edit on the textured version.

That is why I'm interest other poly software with good import choices
that Moi hopefully will support in the future.
From: Brian (BWTR)
20 Nov 2009   [#18] In reply to [#17]
Carrara works very well with many of the file types exported by MoI, including 3dm

Certainly it is good value and easy to learn but it comes with so much "built in" operations that other high priced apps often charge huge plugin money for.


Brian
From: Michael Gibson
20 Nov 2009   [#19] In reply to [#17]
Hi Steve, thanks for running that test. So it looks like OBJ will not work for preserving hierarchies into trueSpace (and probably other programs also).

> That is why I'm interest other poly software with
> good import choices that Moi hopefully will support in the future.

Yeah I will probably be able to focus on this early in the v3 timeframe.

File formats tend to be a finicky area of work, some programs are pretty sensitive to a variety of factors.

It's just not such a great area to tinker with to a very large degree right near the end of a beta period, just too much possibility of problems being introduced.

- Michael
From: danperk (SBEECH)
20 Nov 2009   [#20] In reply to [#19]
Hi Brian,

> Carrara works very well with many of the file types exported by MoI, including 3dm

> Certainly it is good value and easy to learn but it comes with so much "built in" operations that other high priced apps often charge huge plugin money for.

I have Carrara Pro 6.2 which I got free from 3DArtist Magazine. It's OK and I like to have lots of options for file conversion etc.,
but I think that for most people, myself included, we tend to judge/compare software with what we know and are used to, so for
me Carrara is just not a good fit. In what I have learned by researching 3D programs available out there, I think Modo has the
most to offer for my requirements. But thanks for the suggestion!!

Hi Michael,

> So it looks like OBJ will not work for preserving hierarchies into trueSpace (and probably other programs also).

Yeah it looks that way, still in most regards OBJ export allows me to get the data across and the rest is just optimizing my set-up
to make working in my poly prog. as painless as possible.

I did some testing with Right Hemisphere Deep View, (an excellent free utility), to see some results of Moi's different exports.
Now I realize these results are dependent on Deep View's import parser but interesting anyway. You can view the scene tree or
a parts list, (which seems to relate to the Object settings in Moi.) I won't list all my result but FBX was interesting in that the parts
were arranged as instances.



> File formats tend to be a finicky area of work, some programs are pretty sensitive to a variety of factors.

> It's just not such a great area to tinker with to a very large degree right near the end of a beta period, just too much possibility of problems being introduced.

As I said I wanted this more as a discussion, to pick your brain, not to try and squeeze more things into Ver. 2. :)

Thanks for the script, and your patience!! :)

Image Attachments:
DV.jpg 


From: Mindset (IGNITER)
27 Oct   [#21] In reply to [#5]
Hello Micheal, et. al.

Might there be some modification that would respect the 'order of selection' when using the "object name separator" script?
http://moi3d.com/forum/index.php?webtag=MOI&msg=3114.5

Thanks!

Moi Bueno
MindSet
From: Michael Gibson
27 Oct   [#22] In reply to [#21]
Hi MindSet,

re:
> Might there be some modification that would respect the 'order of selection' when using the "object name separator" script?

Try this one:

script:var Objects = moi.geometryDatabase.getObjects(); Objects.sortBySelectionOrder(); var Names = new Object(); for ( var i = 0; i < Objects.length; ++i ) { var Obj = Objects.item(i); if ( Obj.name == '' ) { continue; } if ( !Names[Obj.name] ) { Names[Obj.name] = new Array(); } Names[Obj.name].push( Obj ); } for ( var Name in Names ) { if ( Names[Name].length == 1 ) { continue; } for ( var i = 0; i < Names[Name].length; ++i ) { Names[Name][i].name = Name + '_' + (i+1); } }

- Michael
From: Mindset (IGNITER)
28 Oct   [#23] In reply to [#22]
Terrificâť—
I left-padded the number with zeros to 2 digits Took me hours

script: /*!Obj-Name + Number */ var numb = 0 ; var Objects = moi.geometryDatabase.getObjects(); Objects.sortBySelectionOrder(); var Names = new Object(); for ( var i = 0; i < Objects.length; ++i ) { var Obj = Objects.item(i); if ( Obj.name == '' ) { continue; } if ( !Names[Obj.name] ) { Names[Obj.name] = new Array(); } Names[Obj.name].push( Obj ); } for ( var Name in Names ) { if ( Names[Name].length == 1 ) { continue; } for ( var i = 0; i < Names[Name].length; ++i ) { numb = (i+1); numb = numb.toString();while (numb.length < 2) numb = "0" + numb; Names[Name][i].name = Name + '_' + numb; } }


Moi Bueno
MindSet

Show messages:  1-7  8-23