protected void updateValue(Object value) { string text = value.ToString(); ClassPropertyInfo cp = godzObject.getPropertyValue(propertyNameHash); if (cp.mPropertyType == GodzGlue.ClassPropertyType.PropertyType_HashCode) { //deref the old string then addref for the new String in the HashTable... //1. Find the old hash in the HashTable.... if (cp.mObjectHash > 0) { Editor.RemoveHash(cp.mObjectHash); } //2. Add the new String to the HashTable uint hash = GodzGlue.GodzUtil.GetHashCode(text); Editor.AddHash(hash, text, false); } godzObject.setProperty(propertyNameHash, text); DatabaseObjectInfo info = DatabaseObjectRegistry.get(godzObject); if (info != null) { info.modified = true; } }
private void useLocalButton_Click(object sender, EventArgs e) { ClassPropertyInfo cp = diffs[conflictNum].localProp; finalList.Add(cp); increaseConflictNum(); }
public PackageProperty(string sName, uint propertyHash, ObjectBase value, bool bReadOnly, bool bVisible) : base(sName, propertyHash, value, bReadOnly, bVisible) { // Initialize our packageList to the active package value ClassPropertyInfo cp = godzObject.getPropertyValue(propertyHash); p.text = Editor.GetHashString(cp.mObjectHash); }
//-------------------------------------------------------------------------------------------------- void _AddProperties(Type type, List <ClassPropertyInfo> propInfos) { var basetype = type.BaseType; if (basetype != null) { _AddProperties(basetype, propInfos); } foreach (var propertyInfo in type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)) { if (!propertyInfo.IsDefined(typeof(SerializeMemberAttribute))) { continue; } var classPropInfo = new ClassPropertyInfo() { PropertyInfo = propertyInfo, Serializer = propertyInfo.PropertyType == _Type ? this : Serializer.GetSerializer(propertyInfo.PropertyType), MemberAttribute = (SerializeMemberAttribute)propertyInfo.GetCustomAttributes(typeof(SerializeMemberAttribute), false).First() }; if (propertyInfo.IsDefined(typeof(SerializeReferenceIdAttribute))) { _IsReferencable = true; _ReferenceIdProperty = classPropInfo; continue; } if (!classPropInfo.MemberAttribute.ReaderFunc.IsNullOrEmpty()) { var method = type.GetMethod(classPropInfo.MemberAttribute.ReaderFunc, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(Reader), typeof(SerializationContext) }, null); Debug.Assert(method != null && method.ReturnType == typeof(bool), "ReaderFunc 'bool " + classPropInfo.MemberAttribute.ReaderFunc + "(Reader,SerializationContext)' not found in class " + type.Name); classPropInfo.CustomReaderInfo = method; } if (!classPropInfo.MemberAttribute.WriterFunc.IsNullOrEmpty()) { var method = type.GetMethod(classPropInfo.MemberAttribute.WriterFunc, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(Writer), typeof(SerializationContext) }, null); Debug.Assert(method != null && method.ReturnType == typeof(bool), "WriterFunc 'bool " + classPropInfo.MemberAttribute.WriterFunc + "(Writer,SerializationContext)' not found in class " + type.Name); classPropInfo.CustomWriterInfo = method; } propInfos.Add(classPropInfo); } }
public ProjectileProperty(string sName, uint propertyHash, ObjectBase value, bool bReadOnly, bool bVisible) : base(sName, propertyHash, value, bReadOnly, bVisible) { // Initialize the projectile name ClassPropertyInfo cp = godzObject.getPropertyValue(propertyHash); string temp = Editor.GetHashString(cp.mObjectHash); if (temp == null) { temp = ""; } p.text = temp; }
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (mValue != null) { string text = (string)e.ChangedItem.Value; Editor.OnClassPropertyChanged(mValue.mPropertySelection.obj, mValue.mPropertySelection.cp, text, e); //get latest value mValue.mPropertySelection.cp = mValue.mPropertySelection.obj.getPropertyValue(mValue.mPropertySelection.cp.mName); if (mValue.mPropertySelection.cp.mName.Equals("Name")) { mValue.mPropertySelection.parentNode.Text = text; } } else if (mTemplate != null) { //Editor.HandlePropertyChanged(mTemplate, e); //update template node name just incase.... uint hash = mTemplate.getObjectName(); string text = Editor.GetHashString(hash); if (text != null) { mTemplateNode.Text = text; } } else if (currentNode != null && currentNode.Tag != null && currentNode.Tag is ObjectBase) { ObjectBase obj = (ObjectBase)currentNode.Tag; ClassPropertyInfo cp = obj.getPropertyValue("Name"); if (cp != null) { TreeNode treenode = (TreeNode)objectMap[obj]; treenode.Text = Editor.GetHashString(cp.mObjectHash); } } }
protected override void FillInList(ITypeDescriptorContext context, IServiceProvider provider, ListBox listBox) { //Note: ITypeDescriptorContext contains the Instance object // find out which mesh/package it was.... ObjectBaseProxy objProxy = (ObjectBaseProxy)context.Instance; PropertyContextData contextData = objProxy.contextData; ClassPropertyInfo packageProperty = contextData.context1.getPropertyValue("Model"); ObjectBase oo = packageProperty.mObject; if (oo != null && oo is Mesh) { Mesh m = (Mesh)oo; List <String> animList = new List <string>(); m.getAnimations(animList); foreach (string animName in animList) { listBox.Items.Add(animName); } } }