コード例 #1
0
        private void InitEditors()
        {
            Terrain terrain = TerrainEditor.Terrain;

            if (terrain != null)
            {
                if (m_widthEditor != null)
                {
                    m_terrainSettings.InitEditor(m_widthEditor, Strong.PropertyInfo((ITerrainSettings x) => x.Width), m_localization.GetString("ID_RTTerrain_Settings_Width", "Width"));
                }

                if (m_lengthEditor != null)
                {
                    m_terrainSettings.InitEditor(m_lengthEditor, Strong.PropertyInfo((ITerrainSettings x) => x.Length), m_localization.GetString("ID_RTTerrain_Settings_Length", "Length"));
                }

                if (m_heightmapResolutionEditor != null)
                {
                    m_terrainSettings.InitEditor(m_heightmapResolutionEditor, Strong.PropertyInfo((ITerrainSettings x) => x.Resolution), m_localization.GetString("ID_RTTerrain_Settings_Resolution", "Resolution"));
                }

                if (m_positionEditor != null)
                {
                    m_terrainSettings.InitEditor(m_positionEditor, Strong.PropertyInfo((ITerrainSettings x) => x.Position), m_localization.GetString("ID_RTTerrain_Settings_Position", "Position"));
                }
            }
        }
コード例 #2
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            ILocalization lc = IOC.Resolve <ILocalization>();

            Camera camera = (Camera)editor.Component;

            PropertyEditorCallback valueChanged     = () => editor.BuildEditor();
            MemberInfo             projection       = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection");
            MemberInfo             orthographic     = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic");
            MemberInfo             fov              = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView");
            MemberInfo             orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize");

            List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>();

            descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Projection", "Projection"), converter, projection, orthographic, valueChanged));

            if (!camera.orthographic)
            {
                descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Fov", "Field Of View"), editor.Component, fov, "field of view"));
            }
            else
            {
                descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Size", "Size"), editor.Component, orthographicSize, "orthographic size"));
            }

            return(descriptors.ToArray());
        }
コード例 #3
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            MemberInfo connectedBodyInfo       = Strong.PropertyInfo((SpringJoint x) => x.connectedBody, "connectedBody");
            MemberInfo anchorInfo              = Strong.PropertyInfo((SpringJoint x) => x.anchor, "anchor");
            MemberInfo autoConfigAnchorInfo    = Strong.PropertyInfo((SpringJoint x) => x.autoConfigureConnectedAnchor, "autoConfigureConnectedAnchor");
            MemberInfo connectedAnchorInfo     = Strong.PropertyInfo((SpringJoint x) => x.connectedAnchor, "connectedAnchor");
            MemberInfo springInfo              = Strong.PropertyInfo((SpringJoint x) => x.spring, "spring");
            MemberInfo damperInfo              = Strong.PropertyInfo((SpringJoint x) => x.damper, "damper");
            MemberInfo minDistanceInfo         = Strong.PropertyInfo((SpringJoint x) => x.minDistance, "minDistance");
            MemberInfo maxDistanceInfo         = Strong.PropertyInfo((SpringJoint x) => x.maxDistance, "maxDistance");
            MemberInfo toleranceInfo           = Strong.PropertyInfo((SpringJoint x) => x.tolerance, "tolerance");
            MemberInfo breakForceInfo          = Strong.PropertyInfo((SpringJoint x) => x.breakForce, "breakForce");
            MemberInfo breakTorqueInfo         = Strong.PropertyInfo((SpringJoint x) => x.breakTorque, "breakTorque");
            MemberInfo enableCollisionInfo     = Strong.PropertyInfo((SpringJoint x) => x.enableCollision, "enableCollision");
            MemberInfo enablePreporcessingInfo = Strong.PropertyInfo((SpringJoint x) => x.enablePreprocessing, "enablePreprocessing");

            return(new[]
            {
                new PropertyDescriptor("ConnectedBody", editor.Component, connectedBodyInfo),
                new PropertyDescriptor("Anchor", editor.Component, anchorInfo),
                new PropertyDescriptor("Auto Configure Connected Anchor", editor.Component, autoConfigAnchorInfo),
                new PropertyDescriptor("Connected Anchor", editor.Component, connectedAnchorInfo),
                new PropertyDescriptor("Spring", editor.Component, springInfo),
                new PropertyDescriptor("Damper", editor.Component, damperInfo),
                new PropertyDescriptor("MinDistance", editor.Component, minDistanceInfo),
                new PropertyDescriptor("MaxDistance", editor.Component, maxDistanceInfo),
                new PropertyDescriptor("Tolerance", editor.Component, toleranceInfo),
                new PropertyDescriptor("Break Force", editor.Component, breakForceInfo),
                new PropertyDescriptor("Break Torque", editor.Component, breakTorqueInfo),
                new PropertyDescriptor("Enable Collision", editor.Component, enableCollisionInfo),
                new PropertyDescriptor("Enable Preprocessing", editor.Component, enablePreporcessingInfo),
            });
        }
コード例 #4
0
        private void Awake()
        {
            m_tool   = IOC.Resolve <IProBuilderTool>();
            m_editor = IOC.Resolve <IRuntimeEditor>();
            m_editor.Undo.UndoCompleted += OnUpdateVisualState;
            m_editor.Undo.RedoCompleted += OnUpdateVisualState;
            m_editor.Undo.StateChanged  += OnUpdateVisualState;

            if (m_useGizmosToggle != null)
            {
                m_useGizmosToggle.onValueChanged.AddListener(OnUseGizmosValueChanged);
            }

            if (m_fillModeEditor != null)
            {
                m_fillModeEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.fill), null, "Fill");
            }

            if (m_anchorEditor != null)
            {
                m_anchorEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.anchor), null, "Anchor");
            }

            if (m_offsetEditor != null)
            {
                m_offsetEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.offset), null, "Offset");
            }

            if (m_rotationEditor != null)
            {
                m_rotationEditor.Min = 0;
                m_rotationEditor.Max = 360;
                m_rotationEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.rotation), null, "Rotation");
            }

            if (m_tilingEditor != null)
            {
                m_tilingEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.scale), null, "Tiling");
            }

            if (m_worldSpaceEditor != null)
            {
                m_worldSpaceEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.useWorldSpace), null, "World Space");
            }

            if (m_flipUEditor != null)
            {
                m_flipUEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.flipU), null, "Flip U");
            }

            if (m_flipVEditor != null)
            {
                m_flipVEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.flipV), null, "Flip V");
            }

            if (m_swapUVEditor != null)
            {
                m_swapUVEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.swapUV), null, "Swap UV");
            }
        }
コード例 #5
0
        protected override void InitEditor(PropertyEditor editor, PropertyDescriptor descriptor)
        {
            base.InitEditor(editor, descriptor);

            if (RuntimeTools.LockAxes == null)
            {
                return;
            }

            if (descriptor.ComponentMemberInfo == Strong.PropertyInfo((Transform x) => x.position, "position"))
            {
                Vector3Editor vector3Editor = (Vector3Editor)editor;
                vector3Editor.IsXInteractable = !RuntimeTools.LockAxes.PositionX;
                vector3Editor.IsYInteractable = !RuntimeTools.LockAxes.PositionY;
                vector3Editor.IsZInteractable = !RuntimeTools.LockAxes.PositionZ;
            }

            if (descriptor.ComponentMemberInfo == Strong.PropertyInfo((Transform x) => x.rotation, "rotation"))
            {
                Vector3Editor vector3Editor = (Vector3Editor)editor;
                vector3Editor.IsXInteractable = !RuntimeTools.LockAxes.RotationX;
                vector3Editor.IsYInteractable = !RuntimeTools.LockAxes.RotationY;
                vector3Editor.IsZInteractable = !RuntimeTools.LockAxes.RotationZ;
            }

            if (descriptor.ComponentMemberInfo == Strong.PropertyInfo((Transform x) => x.localScale, "localScale"))
            {
                Vector3Editor vector3Editor = (Vector3Editor)editor;
                vector3Editor.IsXInteractable = !RuntimeTools.LockAxes.ScaleX;
                vector3Editor.IsYInteractable = !RuntimeTools.LockAxes.ScaleY;
                vector3Editor.IsZInteractable = !RuntimeTools.LockAxes.ScaleZ;
            }
        }
コード例 #6
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            ILocalization lc = IOC.Resolve <ILocalization>();

            MemberInfo connectedBodyInfo       = Strong.PropertyInfo((SpringJoint x) => x.connectedBody, "connectedBody");
            MemberInfo anchorInfo              = Strong.PropertyInfo((SpringJoint x) => x.anchor, "anchor");
            MemberInfo autoConfigAnchorInfo    = Strong.PropertyInfo((SpringJoint x) => x.autoConfigureConnectedAnchor, "autoConfigureConnectedAnchor");
            MemberInfo connectedAnchorInfo     = Strong.PropertyInfo((SpringJoint x) => x.connectedAnchor, "connectedAnchor");
            MemberInfo springInfo              = Strong.PropertyInfo((SpringJoint x) => x.spring, "spring");
            MemberInfo damperInfo              = Strong.PropertyInfo((SpringJoint x) => x.damper, "damper");
            MemberInfo minDistanceInfo         = Strong.PropertyInfo((SpringJoint x) => x.minDistance, "minDistance");
            MemberInfo maxDistanceInfo         = Strong.PropertyInfo((SpringJoint x) => x.maxDistance, "maxDistance");
            MemberInfo toleranceInfo           = Strong.PropertyInfo((SpringJoint x) => x.tolerance, "tolerance");
            MemberInfo breakForceInfo          = Strong.PropertyInfo((SpringJoint x) => x.breakForce, "breakForce");
            MemberInfo breakTorqueInfo         = Strong.PropertyInfo((SpringJoint x) => x.breakTorque, "breakTorque");
            MemberInfo enableCollisionInfo     = Strong.PropertyInfo((SpringJoint x) => x.enableCollision, "enableCollision");
            MemberInfo enablePreporcessingInfo = Strong.PropertyInfo((SpringJoint x) => x.enablePreprocessing, "enablePreprocessing");

            return(new[]
            {
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_ConnectedBody", "ConnectedBody"), editor.Components, connectedBodyInfo),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_Anchor", "Anchor"), editor.Components, anchorInfo, "m_Anchor"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_AutoConfigConnectedAnchor", "Auto Configure Connected Anchor"), editor.Components, autoConfigAnchorInfo, "m_AutoConfigureConnectedAnchor"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_ConnectAnchor", "Connected Anchor"), editor.Components, connectedAnchorInfo, "m_ConnectedAnchor"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_Spring", "Spring"), editor.Components, springInfo, "m_Spring"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_Damper", "Damper"), editor.Components, damperInfo, "m_Damper"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_MinDistance", "MinDistance"), editor.Components, minDistanceInfo, "m_MinDistance"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_MaxDistance", "MaxDistance"), editor.Components, maxDistanceInfo, "m_MaxDistance"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_Tolerance", "Tolerance"), editor.Components, toleranceInfo, "m_Tolerance"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_BreakForce", "Break Force"), editor.Components, breakForceInfo, "m_BreakForce"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_BreakTorque", "Break Torque"), editor.Components, breakTorqueInfo, "m_BreakTorque"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_EnableCollision", "Enable Collision"), editor.Components, enableCollisionInfo, "m_EnableCollision"),
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_SpringJoint_EnablePreprocessing", "Enable Preprocessing"), editor.Components, enablePreporcessingInfo, "m_EnablePreprocessing"),
            });
        }
コード例 #7
0
ファイル: CapsuleColliderGizmo.cs プロジェクト: lbm7926/Imp
 protected override void EndRecordOverride()
 {
     base.EndRecordOverride();
     Window.Editor.Undo.EndRecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.center, "center"));
     Window.Editor.Undo.EndRecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.height, "height"));
     Window.Editor.Undo.EndRecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.direction, "direction"));
 }
コード例 #8
0
        private void OnEndMove(BaseHandle positionHandle)
        {
            IMeshEditor meshEditor = GetEditor();

            if (meshEditor != null)
            {
                positionHandle.EnableUndo = true;

                m_rte.Undo.BeginRecord();

                if (UVEditingMode)
                {
                    m_pivot.position = meshEditor.Position;
                    m_rte.Undo.EndRecordValue(UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.offset));
                }
                else
                {
                    MeshEditorState newState = meshEditor.GetState();
                    this.RecordState(meshEditor, null, newState, false, false);

                    m_rte.Undo.EndRecordTransform(m_pivot);
                    m_rte.Undo.RecordValue(meshEditor, Strong.PropertyInfo((IMeshEditor x) => x.Position));
                }
                m_rte.Undo.EndRecord();
            }
        }
コード例 #9
0
        public PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            PropertyEditorCallback valueChanged = () => editor.BuildEditor();

            MemberInfo convexInfo    = Strong.PropertyInfo((MeshCollider x) => x.convex, "convex");
            MemberInfo isTriggerInfo = Strong.PropertyInfo((MeshCollider x) => x.isTrigger, "isTrigger");
            MemberInfo materialInfo  = Strong.PropertyInfo((MeshCollider x) => x.sharedMaterial, "sharedMaterial");
            MemberInfo meshInfo      = Strong.PropertyInfo((MeshCollider x) => x.sharedMesh, "sharedMesh");

            MeshCollider collider = (MeshCollider)editor.Component;

            if (collider.convex)
            {
                return(new[]
                {
                    new PropertyDescriptor("Convex", editor.Component, convexInfo, convexInfo, valueChanged),
                    new PropertyDescriptor("Is Trigger", editor.Component, isTriggerInfo, isTriggerInfo),
                    new PropertyDescriptor("Material", editor.Component, materialInfo, materialInfo),
                    new PropertyDescriptor("Mesh", editor.Component, meshInfo, meshInfo),
                });
            }
            else
            {
                return(new[]
                {
                    new PropertyDescriptor("Convex", editor.Component, convexInfo, convexInfo, valueChanged),
                    new PropertyDescriptor("Material", editor.Component, materialInfo, materialInfo),
                    new PropertyDescriptor("Mesh", editor.Component, meshInfo, meshInfo),
                });
            }
        }
コード例 #10
0
        private void OnBeginMove(BaseHandle positionHandle)
        {
            IMeshEditor meshEditor = GetEditor();

            if (meshEditor != null)
            {
                positionHandle.EnableUndo = false;

                m_rte.Undo.BeginRecord();
                if (UVEditingMode)
                {
                    m_rte.Undo.BeginRecordValue(UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.offset));
                }
                else
                {
                    m_rte.Undo.BeginRecordTransform(m_pivot);
                    m_rte.Undo.RecordValue(meshEditor, Strong.PropertyInfo((IMeshEditor x) => x.Position));
                    m_shift = m_rte.Input.GetKey(KeyCode.LeftShift);
                    if (m_shift)
                    {
                        MeshEditorState oldState = meshEditor.GetState();
                        meshEditor.Extrude();
                        this.RecordState(meshEditor, oldState, null, false);
                    }
                }

                m_rte.Undo.EndRecord();
                m_initialUVOffset = UV.offset;
            }
        }
コード例 #11
0
        private void RunStateChangeAction(Action <IMeshEditor> action, bool clearSelection)
        {
            IMeshEditor meshEditor = GetEditor();

            if (meshEditor != null)
            {
                m_rte.Undo.BeginRecord();
                m_rte.Undo.BeginRecordTransform(m_pivot);
                m_rte.Undo.RecordValue(meshEditor, Strong.PropertyInfo((IMeshEditor x) => x.Position));

                MeshEditorState oldState = meshEditor.GetState();
                action(meshEditor);
                MeshEditorState newState  = meshEditor.GetState();
                MeshSelection   selection = null;
                if (clearSelection)
                {
                    selection = meshEditor.ClearSelection();
                }
                this.RecordState(meshEditor, oldState, newState);
                if (selection != null)
                {
                    RecordSelection(meshEditor, selection);
                }
                TrySelectPivot(meshEditor);
                m_rte.Undo.EndRecord();
            }
        }
コード例 #12
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            Camera camera = (Camera)editor.Component;

            PropertyEditorCallback valueChanged     = () => editor.BuildEditor();
            MemberInfo             projection       = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection");
            MemberInfo             orthographic     = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic");
            MemberInfo             fov              = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView");
            MemberInfo             orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize");

            List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>();

            descriptors.Add(new PropertyDescriptor("Projection", converter, projection, orthographic, valueChanged));

            if (!camera.orthographic)
            {
                descriptors.Add(new PropertyDescriptor("Field Of View", editor.Component, fov, fov));
            }
            else
            {
                descriptors.Add(new PropertyDescriptor("Size", editor.Component, orthographicSize, orthographicSize));
            }

            return(descriptors.ToArray());
        }
コード例 #13
0
 protected override void RecordOverride()
 {
     base.RecordOverride();
     RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.center));
     RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.height));
     RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.direction));
 }
コード例 #14
0
        private void Awake()
        {
            if (m_createTree != null)
            {
                m_createTree.onClick.AddListener(OnCreateTree);
            }
            if (m_removeTree != null)
            {
                m_removeTree.onClick.AddListener(OnRemoveTree);
            }

            if (m_treeList != null)
            {
                m_treeList.SelectionChanged += OnTreesSelectionChanged;
                m_treeList.ItemDataBinding  += OnTreesDatabinding;
                m_treeList.CanDrag           = false;
                m_treeList.CanEdit           = false;
                m_treeList.CanRemove         = false;
                m_treeList.CanReorder        = false;
                m_treeList.CanReparent       = false;
                m_treeList.CanSelectAll      = false;
            }

            ILocalization lc = IOC.Resolve <ILocalization>();

            if (m_treeEditor != null)
            {
                m_treeEditor.Init(this, this, Strong.PropertyInfo((TerrainTreeEditor x) => x.Prefab), null, lc.GetString("ID_RTTerrain_TerrainTreeEditor_Prefab", "Prefab"), null, null, null, false, null, BeginRecordDetailProperties, EndRecordDetailProperties);
            }
            if (m_bendFactorEditor != null)
            {
                m_bendFactorEditor.Init(this, this, Strong.PropertyInfo((TerrainTreeEditor x) => x.BendFactor), null, lc.GetString("ID_RTTerrain_TerrainTreeEditor_BendFactor", "Bend Factor"), null, null, null, false, null, BeginRecordDetailProperties, EndRecordDetailProperties);
            }
        }
コード例 #15
0
        public static PropertyInfo GetPropertyInfo(RTShaderPropertyType propertyType, TextureDimension dim)
        {
            PropertyInfo propertyInfo = null;

            switch (propertyType)
            {
            case RTShaderPropertyType.Color:
                propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Color, "Color");
                break;

            case RTShaderPropertyType.Float:
                propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Float, "Float");
                break;

            case RTShaderPropertyType.Range:
                propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Float, "Float");
                break;

            case RTShaderPropertyType.TexEnv:
                switch (dim)
                {
                case TextureDimension.Any:
                    propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Texture, "Texture");
                    break;

                case TextureDimension.Cube:
                    propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Cubemap, "Cubemap");
                    break;

                case TextureDimension.None:
                    propertyInfo = null;
                    break;

                case TextureDimension.Tex2D:
                    propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Texture2D, "Texture2D");
                    break;

                case TextureDimension.Tex2DArray:
                    propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Texture2DArray, "Texture2DArray");
                    break;

                case TextureDimension.Tex3D:
                    propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Texture3D, "Texture3D");
                    break;

                case TextureDimension.Unknown:
                    propertyInfo = null;
                    break;
                }

                break;

            case RTShaderPropertyType.Vector:
                propertyInfo = Strong.PropertyInfo((MaterialPropertyAccessor x) => x.Vector, "Vector");
                break;
            }

            return(propertyInfo);
        }
コード例 #16
0
ファイル: MaterialPaletteView.cs プロジェクト: lbm7926/Imp
        protected override void AwakeOverride()
        {
            m_texturePicker.gameObject.SetActive(false);
            m_textureEditor.Init(this, this, Strong.PropertyInfo((MaterialPaletteView x) => x.Texture));

            WindowType = RuntimeWindowType.Custom;
            base.AwakeOverride();
        }
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            MemberInfo materialsInfo = Strong.PropertyInfo((SkinnedMeshRenderer x) => x.sharedMaterials, "sharedMaterials");
            List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>();

            descriptors.Add(new PropertyDescriptor("Materials", editor.Component, materialsInfo, materialsInfo));
            return(descriptors.ToArray());
        }
コード例 #18
0
        private void Awake()
        {
            m_localization = IOC.Resolve <ILocalization>();
            m_editor       = IOC.Resolve <IRTE>();
            m_editor.Tools.ToolChanging += OnEditorToolChanging;
            m_wm = IOC.Resolve <IWindowManager>();
            m_wm.WindowCreated += OnWindowCreated;
            m_wm.AfterLayout   += OnAfterLayout;

            Projector = Instantiate(m_terrainProjectorPrefab, m_editor.Root);
            Projector.gameObject.SetActive(false);

            if (IOC.Resolve <ITerrainSelectionHandlesTool>() == null)
            {
                if (m_toggles[(int)EditorType.Selection_Handles])
                {
                    m_toggles[(int)EditorType.Selection_Handles].gameObject.SetActive(false);
                }
            }

            for (int i = 0; i < m_toggles.Length; ++i)
            {
                Toggle toggle = m_toggles[i];
                if (toggle != null)
                {
                    EditorType editorType = ToEditorType(i);
                    UnityEventHelper.AddListener(toggle, tog => tog.onValueChanged, v => OnToggleValueChanged(editorType, v));
                }
            }

            for (int i = 0; i < m_editors.Length; ++i)
            {
                m_editors[i].SetActive(false);
            }

            EditorType toolType       = (m_editor.Tools.Custom is EditorType) ? (EditorType)m_editor.Tools.Custom : EditorType.Empty;
            Toggle     selectedToggle = m_toggles[(int)toolType];

            if (selectedToggle != null)
            {
                selectedToggle.isOn = true;
            }
            else
            {
                GameObject emptyEditor = m_editors[(int)EditorType.Empty];
                if (emptyEditor)
                {
                    emptyEditor.gameObject.SetActive(true);
                }
            }

            if (m_paintToolSelector != null)
            {
                m_paintToolSelector.Init(this, this, Strong.PropertyInfo((TerrainEditor x) => x.SelectedPaintTool), null, m_localization.GetString("ID_RTTerrain_TerrainEditor_Tool", "Tool:"), null, null, null, false);
            }

            SubscribeSelectionChangingEvent(true);
        }
コード例 #19
0
        private void OnEnableDisable(bool enable)
        {
            PropertyInfo prop = Strong.PropertyInfo((GameObjectEditor x) => x.IsGameObjectActive, "IsGameObjectActive");
            GameObject   go   = m_editor.Selection.activeGameObject;

            m_editor.Undo.BeginRecordValue(go, this, prop);
            go.SetActive(enable);
            m_editor.Undo.EndRecordValue(go, this, prop, null);
        }
コード例 #20
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            MemberInfo materials = Strong.PropertyInfo((MeshRenderer x) => x.sharedMaterials, "sharedMaterials");

            return(new[]
            {
                new PropertyDescriptor("Materials", editor.Component, materials, materials),
            });
        }
コード例 #21
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            object[] converters = (object[])converter;

            ILocalization lc = IOC.Resolve <ILocalization>();

            PropertyEditorCallback valueChanged     = () => editor.BuildEditor();
            MemberInfo             projection       = Strong.PropertyInfo((CameraPropertyConverter x) => x.Projection, "Projection");
            MemberInfo             orthographic     = Strong.PropertyInfo((Camera x) => x.orthographic, "orthographic");
            MemberInfo             fov              = Strong.PropertyInfo((Camera x) => x.fieldOfView, "fieldOfView");
            MemberInfo             orthographicSize = Strong.PropertyInfo((Camera x) => x.orthographicSize, "orthographicSize");
            MemberInfo             cullingMask      = Strong.PropertyInfo((Camera x) => x.cullingMask, "cullingMask");

            List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>();

            descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Projection", "Projection"), converters, projection, orthographic, valueChanged));

            Camera[] cameras = editor.NotNullComponents.OfType <Camera>().ToArray();
            if (cameras.Length > 0)
            {
                bool isCameraOrthographic = cameras[0].orthographic;
                for (int i = 1; i < cameras.Length; ++i)
                {
                    if (cameras[i].orthographic != isCameraOrthographic)
                    {
                        return(descriptors.ToArray());
                    }
                }

                if (!isCameraOrthographic)
                {
                    descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Fov", "Field Of View"), editor.Components, fov, "field of view"));
                }
                else
                {
                    descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_Size", "Size"), editor.Components, orthographicSize, "orthographic size"));
                }

                List <RangeOptions.Option> flags = new List <RangeOptions.Option>();
                LayersInfo layersInfo            = LayersEditor.LoadedLayers;
                foreach (LayersInfo.Layer layer in layersInfo.Layers)
                {
                    if (!string.IsNullOrEmpty(layer.Name))
                    {
                        flags.Add(new RangeOptions.Option(layer.Name, layer.Index));
                    }
                }


                descriptors.Add(new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_Camera_CullingMask", "Culling Mask"), editor.Components, cullingMask)
                {
                    Range = new RangeFlags(flags.ToArray())
                });
            }

            return(descriptors.ToArray());
        }
コード例 #22
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            MemberInfo sharedMeshInfo = Strong.PropertyInfo((MeshFilter x) => x.sharedMesh, "sharedMesh");

            return(new[]
            {
                new PropertyDescriptor("Mesh", editor.Component, sharedMeshInfo, sharedMeshInfo)
            });
        }
コード例 #23
0
 private void Start()
 {
     SelectedPaintTool = (PaintTool)PlayerPrefs.GetInt("TerrainEditor.SelectedPaintTool", (int)PaintTool.Raise_Or_Lower_Terrain);
     UpdatePaintToolVisibility();
     if (m_paintToolSelector != null)
     {
         m_paintToolSelector.Init(this, this, Strong.PropertyInfo((TerrainEditor x) => x.SelectedPaintTool), null, m_localization.GetString("ID_RTTerrain_TerrainEditor_Tool", "Tool:"), null, null, null, false);
     }
 }
コード例 #24
0
ファイル: BoundsEditor.cs プロジェクト: lbm7926/Imp
        protected override void InitOverride(object target, object accessor, MemberInfo memberInfo, Action <object, object> eraseTargetCallback, string label = null)
        {
            base.InitOverride(target, accessor, memberInfo, eraseTargetCallback, label);

            BoundsAccessor boundsAccessor = new BoundsAccessor(this);

            m_center.Init(boundsAccessor, boundsAccessor, Strong.PropertyInfo((BoundsAccessor x) => x.Center, "Center"), null, "Center", OnValueChanging, null, OnEndEdit, false);
            m_extents.Init(boundsAccessor, boundsAccessor, Strong.PropertyInfo((BoundsAccessor x) => x.Extents, "Extents"), null, "Extents", OnValueChanging, null, OnEndEdit, false);
        }
コード例 #25
0
        protected override void InitOverride(object target, MemberInfo memberInfo, string label = null)
        {
            base.InitOverride(target, memberInfo, label);

            BoundsAccessor accessor = new BoundsAccessor(this);

            m_center.Init(accessor, Strong.PropertyInfo((BoundsAccessor x) => x.Center, "Center"), "Center", OnValueChanging, null, OnEndEdit, false);
            m_extents.Init(accessor, Strong.PropertyInfo((BoundsAccessor x) => x.Extents, "Extents"), "Extents", OnValueChanging, null, OnEndEdit, false);
        }
コード例 #26
0
        private void Awake()
        {
            m_editorsMap = IOC.Resolve <IEditorsMap>();
            m_editor     = IOC.Resolve <IRuntimeEditor>();
            m_editor.Object.ComponentAdded += OnComponentAdded;

            GameObject[] selectedObjects = m_editor.Selection.gameObjects;
            foreach (GameObject go in m_editor.Selection.gameObjects)
            {
                ExposeToEditor exposeToEditor = go.GetComponent <ExposeToEditor>();
                if (exposeToEditor.GetType().Name == typeof(MyExposeToEditor).Name)
                {
                    MyExposeToEditor myExposeToEditor = (MyExposeToEditor)exposeToEditor;
                    if (myExposeToEditor.CanRename)
                    {
                        Header.SetActive(true);
                    }
                    else
                    {
                        Header.SetActive(false);
                    }
                }
            }
            InputName.text = GetObjectName(selectedObjects);
            InputName.onEndEdit.AddListener(OnEndEditName);

            m_selectedGameObjects = m_editor.Selection.gameObjects.Select(go => new GameObjectWrapper(go)).ToArray();
            IsActiveEditor.Init(m_selectedGameObjects, Strong.PropertyInfo((GameObjectWrapper x) => x.IsActive), string.Empty);


            m_editor.IsBusy = true;
            LayersEditor.LoadLayers(layersInfo =>
            {
                m_editor.IsBusy = false;
                List <RangeOptions.Option> layers = new List <RangeOptions.Option>();

                foreach (LayersInfo.Layer layer in layersInfo.Layers)
                {
                    if (!string.IsNullOrEmpty(layer.Name))
                    {
                        layers.Add(new RangeOptions.Option(string.Format("{0}: {1}", layer.Index, layer.Name), layer.Index));
                    }
                }

                LayerEditor.Options = layers.ToArray();
                LayerEditor.Init(m_editor.Selection.gameObjects, Strong.PropertyInfo((GameObject x) => x.layer), string.Empty);

                List <List <Component> > groups = GetComponentGroups(selectedObjects);
                for (int i = 0; i < groups.Count; ++i)
                {
                    List <Component> group = groups[i];
                    CreateComponentEditor(group);
                }

                UnityEventHelper.AddListener(EditLayersButton, btn => btn.onClick, OnEditLayersClick);
            });
        }
コード例 #27
0
 protected override void OnTerrainChanged()
 {
     base.OnTerrainChanged();
     if (m_heightEditor != null && TerrainEditor.Terrain != null && TerrainEditor.Terrain.terrainData != null)
     {
         m_heightEditor.Min = 0;
         m_heightEditor.Max = TerrainEditor.Terrain.terrainData.size.y;
         m_height           = m_heightEditor.Max / 3;
         m_heightEditor.Init(this, this, Strong.PropertyInfo((TerrainStampEditor x) => x.Height));
     }
 }
コード例 #28
0
        public override PropertyDescriptor[] GetProperties(ComponentEditor editor, object converter)
        {
            ILocalization lc = IOC.Resolve <ILocalization>();

            MemberInfo sharedMeshInfo = Strong.PropertyInfo((MeshFilter x) => x.sharedMesh, "sharedMesh");

            return(new[]
            {
                new PropertyDescriptor(lc.GetString("ID_RTEditor_CD_MeshFilter_Mesh", "Mesh"), editor.Components, sharedMeshInfo, sharedMeshInfo)
            });
        }
コード例 #29
0
 protected override void OnTerrainChanged()
 {
     base.OnTerrainChanged();
     if (m_heightEditor != null && TerrainEditor.Terrain != null && TerrainEditor.Terrain.terrainData != null)
     {
         m_heightEditor.Min = 0;
         m_heightEditor.Max = TerrainEditor.Terrain.terrainData.size.y;
         m_height           = m_heightEditor.Max / 3;
         m_heightEditor.Init(this, this, Strong.PropertyInfo((TerrainStampEditor x) => x.Height), null, m_localization.GetString("ID_RTTerrain_TerrainStampEditor_Height", "Height"));
     }
 }
コード例 #30
0
        protected override void InitOverride(object target, object accessor, MemberInfo memberInfo, Action <object, object> eraseTargetCallback, string label = null)
        {
            base.InitOverride(target, accessor, memberInfo, eraseTargetCallback, label);

            ILocalization localization = IOC.Resolve <ILocalization>();

            BoundsAccessor boundsAccessor = new BoundsAccessor(this);

            m_center.Init(boundsAccessor, boundsAccessor, Strong.PropertyInfo((BoundsAccessor x) => x.Center, "Center"), null, localization.GetString("ID_RTEditor_PE_BoundsEditor_Center", "Center"), OnValueChanging, null, OnEndEdit, false);
            m_extents.Init(boundsAccessor, boundsAccessor, Strong.PropertyInfo((BoundsAccessor x) => x.Extents, "Extents"), null, localization.GetString("ID_RTEditor_PE_BoundsEditor_Extents", "Extents"), OnValueChanging, null, OnEndEdit, false);
        }