Jump to content

Parsing from a Scene with 2.3 Editor


Shard
 Share

Recommended Posts

Hey everyone.

 

So I've got my code loading new 2.3 Editor maps with Lua script and its starting to look amazing.

 

I did have one question. I would like to create Nodes, much like the AI node so that I can create a player start position as well as different enemy nodes so that I can parse it and load an object in code as well as the model.

 

My question however is how I create and parse the nodes so that I can do the processing in code.

I have looked at the tutorial but it seems with the new editor, parsing is a bit different.

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

Hey everyone.

 

So I've got my code loading new 2.3 Editor maps with Lua script and its starting to look amazing.

 

I did have one question. I would like to create Nodes, much like the AI node so that I can create a player start position as well as different enemy nodes so that I can parse it and load an object in code as well as the model.

 

My question however is how I create and parse the nodes so that I can do the processing in code.

I have looked at the tutorial but it seems with the new editor, parsing is a bit different.

 

Easiest would be to just give it a specific unique name in the editor properties, save the sbx, and then just search for the entity key that has that specific name (instead of the old way of searching for a classname). If the entity in your parsing of the sbx has that unique name then perform whatever you wish based on that entity.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Easiest would be to just give it a specific unique name in the editor properties, save the sbx, and then just search for the entity key that has that specific name (instead of the old way of searching for a classname). If the entity in your parsing of the sbx has that unique name then perform whatever you wish based on that entity.

 

 

Thanks.

 

I've done this for my player position but for things like rendering water, I would need to know its class name. The code I have below is supposed to get its call name but the class name always comes up blank. Entity name always works fine but I need class name to see if I need to render water or not. What am I doing wrong in it?

 

int i=0;
int child_count;
TVec3 objectPosition;
string entityclass;
string classname;
string objectName;
char temp[1024];

child_count = CountChildren(this->level->GetScene());

for( i=1; i<=child_count; i++ ) 
{

	entity=GetChild(this->level->GetScene(),i);
	light=NULL;

	entityclass = GetEntityKey(entity,"class");

	objectName = GetEntityKey(entity,"name");

	if(objectName == "player")
	{
		objectPosition = EntityPosition(entity);
		PositionEntity(player->player,objectPosition);
	}

	classname = GetEntityKey(entity,"classname");

	//Water ====> class name never shows up
	if (classname=="water_plane") 
	{
		//make water
	}
}

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

I've done this for my player position but for things like rendering water, I would need to know its class name. The code I have below is supposed to get its call name but the class name always comes up blank. Entity name always works fine but I need class name to see if I need to render water or not. What am I doing wrong in it?

 

Does your sbx file actually have a classname listed for the waterplane? You know you can open a sbx file with notepad? Unless you added it as a property in lua or you created an environment_waterplane.INI file with classname as a key, you will not have this property to use for parsing.

 

What I did for bmax is not actually add anything else but parse the sbx file based on another key of a waterplane, like the submersioncolor. I did the same for the skybox, using the skymaterial key instead of classname.

 

As for lights that you mentioned in your other post, if you set the properties correctly for lights (easiest is to just to make an INI file to set all the standard properties or you have to manually set all the properties), then you do not have do any sbx parsing and they will load automatically.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Does your sbx file actually have a classname listed for the waterplane? You know you can open a sbx file with notepad? Unless you added it as a property in lua or you created an environment_waterplane.INI file with classname as a key, you will not have this property to use for parsing.

 

What I did for bmax is not actually add anything else but parse the sbx file based on another key of a waterplane, like the submersioncolor. I did the same for the skybox, using the skymaterial key instead of classname.

 

As for lights that you mentioned in your other post, if you set the properties correctly for lights (easiest is to just to make an INI file to set all the standard properties or you have to manually set all the properties), then you do not have do any sbx parsing and they will load automatically.

 

 

Ah, excellent. That makes much more sense now. So if I set default values in the ini files, can I still override them in code?

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

Ah, excellent. That makes much more sense now. So if I set default values in the ini files, can I still override them in code?

 

The INI file is just for setting the initial values. What was happening before was you were adding an object to the editor scene, and it looked good so you saved. But the properties for that object were actually blank, so the values saved to the sbx file reflected that. And yes, you can overwrite them in code, but why would you?? You are missing the whole point of the editor which is to allow you to create a scene as you want it to look. Your goal for your program should be to get it to show your scene exactly as you created it in the Editor... which is why its referred to as WYSIWYG...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

The INI file is just for setting the initial values. What was happening before was you were adding an object to the editor scene, and it looked good so you saved. But the properties for that object were actually blank, so the values saved to the sbx file reflected that. And yes, you can overwrite them in code, but why would you?? You are missing the whole point of the editor which is to allow you to create a scene as you want it to look. Your goal for your program should be to get it to show your scene exactly as you created it in the Editor... which is why its referred to as WYSIWYG...

 

Hahah, definitely.

 

I'm not the artist of our team so I focus mostly on code and since the stuff hasn't been working, I figured it was on my end :)

 

I do agree with you though, I should really be as easy as LoadScene(); and thats what I'm trying to figure how to do.

Hopefully with this new knowledge of the ini files, I can make all my objects more modularized.

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

Hahah, definitely.

 

I'm not the artist of our team so I focus mostly on code and since the stuff hasn't been working, I figured it was on my end :)

 

I do agree with you though, I should really be as easy as LoadScene(); and thats what I'm trying to figure how to do.

Hopefully with this new knowledge of the ini files, I can make all my objects more modularized.

 

well, I can't help you with the C++ code much... I just know what has worked so far in bmax... there's an example bmax program in my blog that shows how I parsed the skybox and waterplane. You can just open it in notepad. Also shows how I set the globalobjects needed to work with some of the lua scripted objects... I know there are some issues with the framewerk/C++ and lua framewerk integration, but all of your lights should automatically work without any issues.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...