Anim8or Community

General Category => ASL Scripts => Topic started by: Paulo on July 30, 2009, 09:34:46 pm

Title: VRML
Post by: Paulo on July 30, 2009, 09:34:46 pm
Does exist a VRML exporter plug-in?
Title: Re: VRML
Post by: Claude on July 31, 2009, 03:48:04 am
Nope.
Title: Re: VRML
Post by: 3Dgeek11 on August 02, 2009, 04:10:43 am
Would it be that hard?

It'd be nice to have one.

Although, I'd want a VRML importer.
Title: Re: VRML
Post by: AnimalCrosser5 on December 17, 2009, 01:26:22 am
Blender has a VRML import/export option. So, you import with blender and export to an anim8or compatible format. It would be awesom if there was an importer for anim8or though.
Title: Re: VRML
Post by: Paulo on January 19, 2010, 10:04:41 pm
I'm going to make myself this exporter, but I'm thoroughly a noob !
How to format a string like this :
"hello world" -> "hello_world" in ASL ?

Thank you !
Title: Re: VRML
Post by: Paulo on January 21, 2010, 08:48:36 pm
nobody could help me ? :(
Title: Re: VRML
Post by: Raxx on January 21, 2010, 10:33:58 pm
Have you bothered looking at the ASL tutorial list in this board? Technically a "hello world" tutorial isn't useful at all in this setting, just follow one of the tutorials out there step by step and read the references until you get results. If you have no prior experience with scripting, start small!
Title: Re: VRML
Post by: Paulo on January 22, 2010, 08:12:31 pm
I read ASL specifications and the two tutorials. But I didn't find how to create my own function ! Then I think I'll be able to format the string as I want. My exporter is nearly ready to be released ;)
Title: Re: VRML
Post by: Raxx on January 22, 2010, 10:04:45 pm
I don't think you can make your own functions. You'll have to be creative with for and while loops. I'm sure you can do it! I worked on my own export script a while back and it wasn't that hard to work around the limitations! (reminds me that I should go back to it sometime...)
Title: Re: VRML
Post by: Paulo on January 23, 2010, 08:40:35 pm
That is ok, this is the code I made (it's simple, but it can be useful for a beginner) :

Code: [Select]
$s=$shape.name;
for $ii = 0 to ($s.length() - 1) do {
if ($s.GetChar($ii) == 32)     {
$s=$s.SetChar(95, $ii);
}
}
My exporter works fine, but I'm going to improve it a litle bit :)
Title: Re: VRML
Post by: Paulo on January 24, 2010, 04:36:53 pm
I use this code :

if ($attribute.GetType() == 6) {

But Anim8or console says : undefined member reference 'GetType'
Strange... what is wrong ?
Title: Re: VRML
Post by: Raxx on January 24, 2010, 05:13:39 pm
Sorry but I don't remember ever getting that one to work. You'll just have to assume an attribute is the right type before you work with it. You can use GetStringValue() to make sure you're capturing a string. If it returns 0 then that means it's not a string. Or at least that's how it's supposed to work...
Title: Re: VRML
Post by: Paulo on January 25, 2010, 06:48:03 pm
It bothers me but I removed this verification step... GetType function doesn't seem working, maybe it's a bug !

I have a big question :

How to separate (cut) an object with several materials into several objects with only one material ?

And a small question :

Is it possible to make some alert dialog box ?

(after that, my exporter will be perfect !! ;D)
Title: Re: VRML
Post by: Raxx on January 26, 2010, 04:16:27 am
I don't think there's an alert function.

As for separating meshes by materials, you could try looping through the GetFaceMaterialIndex() per face to differentiate between faces that have different materials, and then export accordingly. Just look through the scripting reference to see what you can do.
Title: Re: VRML
Post by: Paulo on January 27, 2010, 07:22:03 pm
I succeeded in making a kind of alert like this :
Code: [Select]
file $alert;

if ($ext=="bmp"){
            $alert.open("$console", "w");
            $alert.print("\n\nWARNING :\n---------\nSome bitmap textures are used in : %s \nVRML doesn't support this file format for textures.\n\n",$s);
            $alert.close();
          }

Now I'm coding the separation of meshes by materials. The end is near :)
Title: Re: VRML
Post by: Paulo on January 27, 2010, 08:44:24 pm
Damned ! I haven't rights to create mesh in an exporter plug in ! Why this restriction ???
I wanted to create copy of my multi-material shape (as many copy as number of materials) and delete faces which were not with the same material... I cannot... How to do circumvent this restriction ? :(

An other question : how to delete a mesh ? Delete functions for faces, edges, points exist but for a whole mesh ??
Title: Re: VRML
Post by: Raxx on January 29, 2010, 08:05:33 am
Sorry, can't really help you much further since I haven't worked with ASL in a while. I'd suggest looking at similar scripts and see if someone else can answer your questions as well.
Title: Re: VRML
Post by: Kubajzz on January 29, 2010, 06:03:51 pm
As far as I know there is no way to delete a shape in ASL...
Title: Re: VRML
Post by: Paulo on January 29, 2010, 07:56:20 pm
Thank you for your answers. So I'm going to stop coding because of these restrictions. I cannot finish what I wanted to do.
So I'm going to release soon the VRML plug-in exporter. But the shapes with several materials won't be exactly like in Anim8or...