public static GodzClassInfo get(uint classHash) { GodzClassInfo cp = new GodzClassInfo(); // constructs a class info that has all the properties from this class // with it's parents ClassBase temp = ClassBase.findClass(classHash); while (temp != null) { //find the GodzClassInfo for this class.... GodzClassInfo classDesc = (GodzClassInfo)mClassMap[temp.getObjectName()]; if (classDesc != null) { // append the properties int num = classDesc.cpList.Count; for (int i = 0; i < num; i++) { cp.cpList.Add(classDesc.cpList[i]); } } temp = temp.getSuperClass(); } return(cp); }
private void classPickComboBox_SelectedIndexChanged(object sender, EventArgs e) { //user selected a class... uint classhash = GodzUtil.GetHashCode((string)classPickComboBox.SelectedItem); activeClass = null; foreach (ClassBase tempClass in classes) { if (tempClass.getObjectName() == classhash) { activeClass = tempClass; break; } } //grab all the properties.... props.Clear(); activeClass.getPropertiesNonRecurse(props); propertyListBox1.Items.Clear(); foreach (ClassPropertyInfo cp in props) { propertyListBox1.Items.Add(cp.mName); } //grab the documentation for this class from the database... classInfo = (GodzClassInfo)GodzClassDescriptionRegistry.get(activeClass.getObjectName()); if (classInfo == null) { classInfo = new GodzClassInfo(); GodzClassDescriptionRegistry.put(activeClass.getObjectName(), classInfo); } dbProperties = classInfo.cpList; }
private void addToWorldToolStripMenuItem_Click(object sender, EventArgs e) { TabPanelData data = mMainForm.getTabPanel(); if (data.mActiveLayer == null) { MessageBox.Show("Cannot add an entity without an active Sector. Please add one to the Level"); return; } if (packageTreeView1.SelectedNode == null || packageTreeView1.SelectedNode.Tag == null) { //They must have selected a package node... return; } ObjectBase selectedNode = (ObjectBase)packageTreeView1.SelectedNode.Tag; //TODO: need to somehow cache off a global placement position GodzGlue.Vector3 cameraPos = data.mPrimaryCamera.getLocation(); GodzGlue.Vector3 fdir = data.mPrimaryCamera.getForward(); //y+ up fdir.z += 100.0f; cameraPos += fdir; GodzGlue.Entity newActor = null; if (selectedNode.IsA("Mesh")) { //build entity then set Mesh newActor = data.mActiveLayer.spawnActor("WEntity", ref cameraPos, ref zero); //Get mesh from the package Mesh m = (Mesh)selectedNode; newActor.setMesh(m); } else if (selectedNode.IsA("WSunLight")) { if (data.mSun != null) { //display error, can only have 1 Sun MessageBox.Show("You can only have 1 sunlight in the scene"); } else { data.mSun = (GodzGlue.SunLight)data.mActiveLayer.spawnActor("WSunLight", ref cameraPos, ref zero); data.mSun.setSunLight(); newActor = data.mSun; } } else { ClassBase gc = selectedNode.getClass(); newActor = data.mActiveLayer.spawnActor(gc.getObjectName(), ref cameraPos, ref zero); } //set package.... newActor.setPackage(data.mActiveLayer.getPackage()); //Add to the Database Editor.AddEntity(data.mActiveLayer.getName(), newActor); //tick the actors so they send events over to renderer GodzUtil.RunMainPass(); //Add the entity to the 'Actors' list AddActorToTree(newActor, actorsTreeView1.Nodes[0]); }