public void PopulateUI(CathodeResource cResource, cGUID paramID, CathodeFlowgraph selected_flowgraph) { GUID_VARIABLE_DUMMY.Text = NodeDBEx.GetParameterName(paramID) + " (" + paramID.ToString() + ")"; resRef = cResource; if (cResource.resourceID.val != null) { textBox2.Text = BitConverter.ToString(new byte[] { cResource.resourceID.val[0] }); textBox3.Text = BitConverter.ToString(new byte[] { cResource.resourceID.val[1] }); textBox5.Text = BitConverter.ToString(new byte[] { cResource.resourceID.val[2] }); textBox4.Text = BitConverter.ToString(new byte[] { cResource.resourceID.val[3] }); } /* * List<RenderableElement> redsList = new List<RenderableElement>(); * CathodeResourceReference resRef = selected_flowgraph.resources.FirstOrDefault(o => o.resourceRefID == cResource.resourceID); * if (resRef == null || resRef.entryType != CathodeResourceReferenceType.RENDERABLE_INSTANCE) return; * for (int p = 0; p < resRef.entryCountREDS; p++) redsList.Add(redsBIN.GetRenderableElement(resRef.entryIndexREDS + p)); * if (resRef.entryCountREDS != redsList.Count || redsList.Count == 0) return; //TODO: handle this nicer * CathodeEditorGUI_EditResource res_editor = new CathodeEditorGUI_EditResource(modelPAK.GetCS2s(), redsList); * res_editor.Show(); * res_editor.EditComplete += new FinishedEditingIndexes(res_editor_submitted); */ }
private void createEntity(object sender, EventArgs e) { cGUID thisID = Utilities.GenerateGUID(DateTime.Now.ToString("G")); if (createDatatypeEntity.Checked) { //Make the DatatypeEntity DatatypeEntity newEntity = new DatatypeEntity(thisID); newEntity.type = (CathodeDataType)entityVariant.SelectedIndex; newEntity.parameter = Utilities.GenerateGUID(textBox1.Text); //Make the parameter to give this DatatypeEntity a value (the only time you WOULDN'T want this is if the val is coming from a linked entity) CathodeParameter thisParam = null; switch (newEntity.type) { case CathodeDataType.POSITION: thisParam = new CathodeTransform(); break; case CathodeDataType.FLOAT: thisParam = new CathodeFloat(); break; case CathodeDataType.FILEPATH: case CathodeDataType.STRING: thisParam = new CathodeString(); break; case CathodeDataType.SPLINE_DATA: thisParam = new CathodeSpline(); break; case CathodeDataType.ENUM: thisParam = new CathodeEnum(); ((CathodeEnum)thisParam).enumID = new cGUID("4C-B9-82-48"); //ALERTNESS_STATE is the first alphabetically break; case CathodeDataType.SHORT_GUID: thisParam = new CathodeResource(); ((CathodeResource)thisParam).resourceID = new cGUID("00-00-00-00"); break; case CathodeDataType.BOOL: thisParam = new CathodeBool(); break; case CathodeDataType.DIRECTION: thisParam = new CathodeVector3(); break; case CathodeDataType.INTEGER: thisParam = new CathodeInteger(); break; } newEntity.parameters.Add(new CathodeLoadedParameter(newEntity.parameter, thisParam)); //Add to flowgraph & save name flow.datatypes.Add(newEntity); if (NodeDB.GetCathodeName(newEntity.parameter) == newEntity.parameter.ToString()) { NodeDBEx.AddNewParameterName(newEntity.parameter, textBox1.Text); } NewEntity = newEntity; } else if (createFunctionEntity.Checked) { //Create FunctionEntity FunctionEntity newEntity = new FunctionEntity(thisID); switch (entityVariant.Text) { //TODO: find a nicer way of auto selecting this (E.G. can we reflect to class names?) case "CAGEAnimation": newEntity = new CAGEAnimation(thisID); break; case "TriggerSequence": newEntity = new TriggerSequence(thisID); break; } newEntity.function = CathodeEntityDatabase.GetEntityAtIndex(entityVariant.SelectedIndex).guid; //TODO: auto populate params here //Add to flowgraph & save name flow.functions.Add(newEntity); NodeDBEx.AddNewNodeName(thisID, textBox1.Text); NewEntity = newEntity; } else if (createFlowgraphEntity.Checked) { //Create FunctionEntity FunctionEntity newEntity = new FunctionEntity(thisID); CathodeFlowgraph selectedFlowgraph = availableFlows.FirstOrDefault(o => o.name == entityVariant.Text); if (selectedFlowgraph == null) { MessageBox.Show("Failed to look up flowgraph!\nPlease report this issue on GitHub.\n\n" + entityVariant.Text, "Could not find flowgraph!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } newEntity.function = selectedFlowgraph.nodeID; //Add to flowgraph & save name flow.functions.Add(newEntity); NodeDBEx.AddNewNodeName(thisID, textBox1.Text); NewEntity = newEntity; } this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (param_name.Text == "") { return; } cGUID thisParamID = Utilities.GenerateGUID(param_name.Text); foreach (CathodeLoadedParameter param in node.parameters) { if (param.paramID == thisParamID) { MessageBox.Show("This parameter already exists on the entity!"); return; } } CathodeParameter thisParam = null; switch ((CathodeDataType)param_datatype.SelectedIndex) { case CathodeDataType.POSITION: thisParam = new CathodeTransform(); break; case CathodeDataType.FLOAT: thisParam = new CathodeFloat(); break; case CathodeDataType.FILEPATH: case CathodeDataType.STRING: thisParam = new CathodeString(); break; case CathodeDataType.SPLINE_DATA: thisParam = new CathodeSpline(); break; case CathodeDataType.ENUM: thisParam = new CathodeEnum(); ((CathodeEnum)thisParam).enumID = new cGUID("4C-B9-82-48"); //ALERTNESS_STATE is the first alphabetically break; case CathodeDataType.SHORT_GUID: thisParam = new CathodeResource(); ((CathodeResource)thisParam).resourceID = new cGUID("00-00-00-00"); break; case CathodeDataType.BOOL: thisParam = new CathodeBool(); break; case CathodeDataType.DIRECTION: thisParam = new CathodeVector3(); break; case CathodeDataType.INTEGER: thisParam = new CathodeInteger(); break; } node.parameters.Add(new CathodeLoadedParameter(thisParamID, thisParam)); //If this parameter doesn't come up in the CATHODE string table, add it to our own if (NodeDB.GetCathodeName(thisParamID) == thisParamID.ToString()) { NodeDBEx.AddNewParameterName(thisParamID, param_name.Text); } this.Close(); }