Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Mel Shuts Down Maya (https://simplymaya.com/forum/showthread.php?t=15294)

InvaZimm 02-02-2005 01:00 AM

Mel Shuts Down Maya
 
Hi guys,

I'm currently working on a script and have come to an unexpected road block. While my main for loop runs, Maya suddenly dissappears and fully shuts down. I have never come across anything of the sort before with scripting in Mel. Has anyone ever come across this? Or does anyone know how to get around this predicament? Thanks.

Alan 02-02-2005 09:19 AM

You're crashing maya. It means your script is dodgy. You need to debug your script and find out where the crash is occurring. Try commenting lines out and finding the dodgy one.

:ninja:
Alan

InvaZimm 02-02-2005 03:55 PM

Pure_Morning,

I have tracked it down to the fact that it was calling for a namespace that never existed. Tho for some reason, the object that I am importing is not going to the namespace that I specify, it seems to be the specified name but plus 1. Thus later when the script calls on selecting the object based on the specified namespace, it cannot find it.

This is my first time really using namespaces, so I'm not sure if I am doing it correctly. From looking thru the help docs, it seemed like a logical way to go so that each item has a similar namespace but incremented based on the iteration that it came in. Also so that the script could select the object that was imported in so that it can be placed properly in the scene. Hope that makes some sense ;) .

Alan 02-02-2005 04:12 PM

well what exactly are you trying to do? just so I can get a better idea. I've never had to us namespaces in my scripts so I may not be able to help with them but maybe I can suggest something else. What does ocurr to me though is that with maya it's usually better to capture the names as maya provides them to you e.g. string $blah = `spaceLocator`

At least that way you avoid weird maya things where it can't find the object you specify.

:bandit:
Alan

InvaZimm 02-02-2005 04:44 PM

Pure_Morning,

I'm currently in the process of revamping a script that I wrote working with a friend. It is a city generator. He's doing the models of the buildings and I'm doing the script for it. For this version I am completely rewriting it. This version is to call for a file, to import the building located in it, and then select that building so that it can be placed in the proper position of the current scene. The amount of buildings is based on the user's input.

Alan 02-02-2005 04:52 PM

well ok that doesn't seem too hard. Why don't you just import the buildings (or better yet reference them) without namespaces. Unless you need absolutley unique names them I wouldn't worry about it.

What I would do is when I add a building I would create a name for it (based on location on the map size etc etc) and then create a group with that name. Then parent the building under it once referenced in...

How does that sound? No namespace problems

Alan

InvaZimm 02-02-2005 05:27 PM

That sounds like a good possibility. The only thing I'm wondering about, and it's porbably what led me to try using namespaces, is when an object is imported it is not selected. How would you select that specific object?

The main reason I wanted to import the buildings rather than reference them, is so that the user didn't have to drag all the building files with them after s/he has made the file.

Alan 02-02-2005 05:59 PM

well name the building group the same as the file and then take off the .ma part of the file when you bring it in and then you will know the name of the group.

What you said about the references probably makes sense aswell, but maybe you should make it an option to reference or import?

Alan

InvaZimm 02-02-2005 07:57 PM

Thanks a lot for your help and suggestions, Alan. I've finally gotten the script start placing the buildings down. Now that that part's done I can finish it by placing in the collision detection code.

Yeah, I think you're right about making it an option to either import or reference the buildings. The thought never occurred to me for some odd reason :) .

I noticed in your signature that you work at Framestore CFC, I've become more and more impressed with the work you guys do there, with each project the company's worked on. I've thought about possibly applying there sometime in the future, but some time after I've tweaked my own abilities. I was wondering if you could give me a critique on my current demo reel, if/when you had the time. I would really appreciate it. The link to it is:
http://johnzimmermann.com/gallery.php?p=demo

Again, I very much appreciate the help you've given me on this script.

Alan 03-02-2005 09:07 AM

I'll try and take a look at the reel later on today when I get time.

As for the script. How come you need collision detection? just wondering.

:ninja:
Alan

InvaZimm 03-02-2005 04:00 PM

The buildings are placed at a random vert of a base plane. Because of this some buildings may end up penetrating each other, so need to code it so that they can't penetrate each other. I wasn't refferring to using Dynamics. I think I was going to use the bounding box information of the buildings to do so.

Alan 03-02-2005 05:10 PM

you could make it easier than that by having a building "footprint" which will cover a set of verts say a 4x4 square. Then you can tell if a building will fit in at a set position without screwing other buildings up. That way you wont have to do collision detection.

Alan

InvaZimm 03-02-2005 05:51 PM

I get what you are saying with the footprint, tho each buidling will have to have it's own since they are different sizes. I guess my only problem is being able to fathom how to do it. I've been staring at this project for days on end, and I think that's probably where I got the mental roadblock about this.

Sparaig 07-02-2005 11:52 AM

Mel Shuts down maya
 
Quote:

Originally posted by InvaZimm
I get what you are saying with the footprint, tho each buidling will have to have it's own since they are different sizes. I guess my only problem is being able to fathom how to do it. I've been staring at this project for days on end, and I think that's probably where I got the mental roadblock about this.
Actually, that kind of thing IS a form of 2D collision detection. Games programming books show how to do this, I believe, but the most efficient algorithms use bit manipulation operators which MEL apparently doesn't have.

The basic way to do it is to define your map to be a bunch of blocks 1 unit (feet/yard/inches/bricks/blocks/whatever) on a side. Now create a 2D array that is the size of your map in units. Each time you want to place a building, check the array to see if there is already a block/brick in that position --if there is, then you have to move over until you can't find one (or move down or both). Once you place a building, update the position array so that set of blocks is marked "taken". Continue til done. Hope this helps.

InvaZimm 08-02-2005 12:46 AM

Sparaig,

I like your suggestion. Tho my only concern is how to combine it with the setup I currently have. Since the buildings are placed at a plane's verts, it suggests that at least 4 faces are used. These faces can be found using the polyInfo command.

However, the problem that occurred to me, is that some of the buildings are wider than 4 faces. This being the case I'm having trouble expanding from the vert and face information easily provided. Is there a way to expand the polyInfo command or is there a command that I have over looked that can do this as well? Would be a lot nicer if you could pick walk with verts.


All times are GMT. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018