Showing posts with label editor. Show all posts
Showing posts with label editor. Show all posts

Sunday, April 12, 2015

Unity3d Curve Editor


No Curves No Sex. Seem that curves are one of most important things in Unity. Why Unity not opensource the editor components, similar like Unity UI 5.0 model, or at least to remove those internal modifiers to component's classes is MYSTERY. Here it is Unity Curve Editor exposed so you can used it Editors or Inspectors. Curve editor inside Inspector where you can add/edit/remove multiply curves. https://youtu.be/CAV_faETDvA?t=364
Usage:
Source code:

Sunday, November 30, 2014

Custom Time Line Multi Selection Slider Handles - Unity3d

Great news that Unity reveal the code of new UI. But why they didn't reveal source of Editor/Inspector Components?. At least why they not remove those fucken internal and sealed from code, so we can use , AvatarPreview, AnimationTimeLine .... without doing lot of Reflection mambo jumbo.????








Use it like this:
EditorGUILayoutEx.CustomTimeLine (ref eventTimeValues,ref eventTimeValuesPrev, ref displayNames, ref eventTimeValuesSelected,-1, onAdd,oDelete,onClose,onEdit,onDragEnd ); Source:

Thursday, November 13, 2014

Custom Object Popup list drop down menu combo box - Unity3D

EditorGUILayout.Popup EditorGUILayout.IntPopup,FloatPopup...
No selection event, no generic objects, no way to format button appearance, no way to set separator or disable items...

public class EditorGUILayoutEx
  {

    private static object _CustomPopup_SelectedObject;
    private static int _CustomPopup_ControlID = -1;
    private static int _CustomPopup_SelectedIndex = -1;

    public delegate void MenuCallaback <T> (int selectedIndex,T SelectedObject,int controlID);

    public delegate void EventCallback (int ownerControlID,Event e);

Use like this (returning Index or Generic Object with Arrays or Lists as values):


int selectedIndex;
selectedIndex=ws.winx.editor.extensions.EditorGUILayoutEx.CustomPopup(new GUIContent("State1"),selectedIndex,new GUIContent[]{new GUIContent("mile1*"),new GUIContent("mile1/kitic")},new int[]{22,33},onMenuSelectionIndex);

String selectedObject2;
selectedObject2=ws.winx.editor.extensions.EditorGUILayoutEx.CustomObjectPopup(new GUIContent("State1"),selectedObject2,new GUIContent[]{new GUIContent("mile"),new GUIContent("mile/kitic")},new List(){ "One", "Two" },onMenuSelectionObject);

String selectedObject3;
selectedObject3=ws.winx.editor.extensions.EditorGUILayoutEx.CustomObjectPopup(new GUIContent("State1"),selectedObject3,new GUIContent[]{new GUIContent("mile"),new GUIContent("mile/kitic")},new string[]{"mile","kitic"},onMenuSelectionObject);

MyClass selectedObject3;
selectedObject3=ws.winx.editor.extensions.EditorGUILayoutEx.CustomObjectPopup(new GUIContent("State1"),selectedObject3,new GUIContent[]{new GUIContent("mile"),new GUIContent("mile/kitic")},new MyClass[]{new MyClass,new MyClass},onMenuSelectionMyClass);
     
Handle events:
 void onMenuSelectionObject (int si,string obj,int cid) {
   Debug.Log ("Selected at inx: " + si+" selection="+obj+" cid:"+cid);
  }


  void onMenuSelectionIndex (int si,int obj,int cid) {
   Debug.Log ("Selected at inx: " + si+" selection="+obj+" cid:"+cid);
  }

void onMenuSelectionMyClass (int si,MyClass obj,int cid) {
   Debug.Log ("Selected at inx: " + si+" selection="+obj+" cid:"+cid);
  }