Example #1
0
 public static void RebuildAppDB()
 {
     NCARappDB.Rebuild();
 }
Example #2
0
        //		public override void OnGUI_original (Rect pos, SerializedProperty prop, GUIContent label)
        //		{
        //			//refresh AR database
        //			NCARappDB.Rebuild ();
        //
        //			//ArConditionė˜ property
        //			SerializedProperty target1 = prop.FindPropertyRelative ("target1Index");
        //			SerializedProperty deligateIndex = prop.FindPropertyRelative ("deligateIndex");
        //			SerializedProperty target2 = prop.FindPropertyRelative ("target2Index");
        //
        //			//start property. this enables the manipulation of a label.
        //			label = EditorGUI.BeginProperty (pos, label, prop);
        //
        //			//draw label and return the adjusted rect
        //			Rect posNew = EditorGUI.PrefixLabel (pos, new GUIContent ("Check If"));
        //
        //			//save original indent
        //			int indentOriginal = EditorGUI.indentLevel;
        //			EditorGUI.indentLevel = 0;
        //
        //			//Set the popup bar width
        //			float elemWidth = posNew.width * (1f / 3f);
        //
        //			//define positions of popups
        //			Rect t1rect = new Rect (posNew.x, posNew.y, elemWidth, posNew.height);
        //			Rect relrect = new Rect (posNew.x + posNew.width - (elemWidth * 2f), posNew.y, elemWidth, posNew.height);
        //			Rect t2rect = new Rect (posNew.x + posNew.width - elemWidth, posNew.y, elemWidth, posNew.height);
        //			//
        //			//			//create popups
        //			target1.intValue = EditorGUI.Popup (t1rect, target1.intValue, NCARappDB.targetNames);
        //			deligateIndex.intValue = EditorGUI.Popup (relrect, deligateIndex.intValue, NCARappDB.conditionNames);
        //			target2.intValue = EditorGUI.Popup (t2rect, target2.intValue, NCARappDB.targetNames);
        //
        //			//end property
        //			EditorGUI.EndProperty ();
        //
        //			//revert indentlevel
        //			EditorGUI.indentLevel = indentOriginal;
        //		}

        public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
        {
            //refresh AR database
            NCARappDB.Rebuild();

            //ArConditionė˜ property
            SerializedProperty target1       = prop.FindPropertyRelative("target1Name");
            SerializedProperty deligateIndex = prop.FindPropertyRelative("deligateIndex");
            SerializedProperty target2       = prop.FindPropertyRelative("target2Name");

            //start property. this enables the manipulation of a label.
            label = EditorGUI.BeginProperty(pos, label, prop);

            //draw label and return the adjusted rect
            Rect posNew = EditorGUI.PrefixLabel(pos, new GUIContent("Check If"));

            //save original indent
            int indentOriginal = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;

            //Set the popup bar width
            float elemWidth = posNew.width * (1f / 3f);

            //define positions of popups
            Rect t1rect  = new Rect(posNew.x, posNew.y, elemWidth, posNew.height);
            Rect relrect = new Rect(posNew.x + posNew.width - (elemWidth * 2f), posNew.y, elemWidth, posNew.height);
            Rect t2rect  = new Rect(posNew.x + posNew.width - elemWidth, posNew.y, elemWidth, posNew.height);

            //create popups
            //target1
            int target1_index_old = System.Array.IndexOf(NCARappDB.targetNames, target1.stringValue.ToString());

            if (target1_index_old == -1)
            {
                Debug.Log(" Image Targets are not properly set. Target1 is set to the first target");
                target1_index_old = 0;
            }
            int target1_index_new = EditorGUI.Popup(t1rect, target1_index_old, NCARappDB.targetNames);

            target1.stringValue = NCARappDB.targetNames [target1_index_new];

            //deligate
            deligateIndex.intValue = EditorGUI.Popup(relrect, deligateIndex.intValue, NCARappDB.conditionNames);

            //target2 as GUID
            int target2_index_old = System.Array.IndexOf(NCARappDB.targetNames, target2.stringValue.ToString());

            if (target2_index_old == -1)
            {
                Debug.Log(" Image Targets are not properly set. Target1 is set to the first target");
                target2_index_old = 0;
            }
            int target2_index_new = EditorGUI.Popup(t2rect, target2_index_old, NCARappDB.targetNames);

            target2.stringValue = NCARappDB.targetNames [target2_index_new];


            //end property
            EditorGUI.EndProperty();

            //revert indentlevel
            EditorGUI.indentLevel = indentOriginal;
        }