Well, it is now time for the technical design of our solution.
First of all we have to design our database. We have to store 3 things:
- The object identifier as a string: I decided to retain the object name as a unique identifier to simplify this sample (I didn't want to use the object internal Guid into the nova scene).
- The object description as a string: the detail of the object.
- The object price as a decimal.
So here is the database schema with a catalog called "bCatalog":
I also added a stored procedure called "sSelectProducts" to get all products from the table "tProducts". A stored procedure is a SQL Syntax to query the database. is stored inside the database and can be called with its name. So, informations for my Nova Scene objects are stored in this table and I will match them according to the field "objectID". Only those that have a record in this table will have a description in my Nova Scene.
The next step to design will be how to load data from my MySql database. As I wrote in my previous post, I used the Namespace "System.Data.Odbc" and specifically the following classes inside the .NET Framework:
- "OdbcConnection" to connect to MySql Database
- "OdbcCommand" to execute the previous SQL query
- "OdbcDataReader" to browse records from "tProducts" table
The next step is to design interactions into the scene (click on an object) and to display description and price for each object. You probably know the action builder: the capability to add interactions into a Nova Scene without programming. The solution I developed uses the Action Builder object model to generate on the fly custom interactions. Then I use a static text widget to display data from MySql database. Ultimately, I will manually generate code, as if I had done it directly in the action builder GUI:
You will notice the widget:
- will appear on a user interaction (mouse click),
- will display its text during only 3 seconds,
- is attached to the corresponding object,
- is linked to the active camera to keep it in front when looking at the object
This interaction generation on the fly will be done with the Nova script editor in VB.NET. Indeed, the generation interactions on the fly requires no hard coding in the scene with the Action Builder and is completely scalable as the object name is unique and is associated with a database record. In other terms, you can add or delete records in the database without any problem with the scene.
Following the next issue...