コード例 #1
0
        public PropertiesInspector()
        {
            InitializeComponent();
            _currentPropertyNode = new ObjectModel.PropertiesModel.NodeProperties();

            _currentPropertyNode.SceneNodeNameChanged += CurrentPropertyNode_SceneNodeNameChanged;

            propertyGrid.PropertyValueChanged += PropertyGrid_PropertyValueChanged;
        }
コード例 #2
0
        private void CreateLightProperties(object light, bool externallySet)
        {
            if (propertyGrid.InvokeRequired)
            {
                var d = new ThreadSafePropertyGrid(CreateLightProperties);
                propertyGrid.Invoke(d, new object[] { light });
            }
            else
            {
                LightProperties lightProperties = new LightProperties();
                var             lightNode       = ((Node)light).GetComponent <Light>();

                if (light != null)
                {
                    lightProperties.Node     = lightNode;
                    lightProperties.Name     = lightNode.Node.Name;
                    lightProperties.Enabled  = lightNode.Enabled;
                    lightProperties.Position = lightNode.Node.Position;
                    lightProperties.Rotation = lightNode.Node.Rotation;
                    lightProperties.Scale    = lightNode.Node.Scale;

                    lightProperties.PulsarApplication = _mainApplication;
                    lightProperties.Scene             = _scene;

                    lightProperties.AspectRatio = lightNode.AspectRatio;
                    lightProperties.Brightness  = lightNode.Brightness;

                    lightProperties.Colour = System.Drawing.Color.FromArgb((int)lightNode.Color.A, (int)lightNode.Color.R, (int)lightNode.Color.G, (int)lightNode.Color.B);

                    lightProperties.ColourFromTemperature = System.Drawing.Color.FromArgb((int)lightNode.ColorFromTemperature.A, (int)lightNode.ColorFromTemperature.R, (int)lightNode.ColorFromTemperature.G, (int)lightNode.ColorFromTemperature.B);

                    lightProperties.EffectiveColour = System.Drawing.Color.FromArgb((int)lightNode.EffectiveColor.A, (int)lightNode.EffectiveColor.R, (int)lightNode.EffectiveColor.G, (int)lightNode.EffectiveColor.B);

                    lightProperties.Temperature                = lightNode.Temperature;
                    lightProperties.UsePhysicalValues          = lightNode.UsePhysicalValues;
                    lightProperties.EffectiveSpecularIntensity = lightNode.EffectiveSpecularIntensity;
                    lightProperties.SpecularIntensity          = lightNode.SpecularIntensity;
                    lightProperties.FadeDistance               = lightNode.FadeDistance;
                    lightProperties.FieldOfView                = lightNode.Fov;
                    lightProperties.Length                 = lightNode.Length;
                    lightProperties.LightType              = lightNode.LightType;
                    lightProperties.PerVertex              = lightNode.PerVertex;
                    lightProperties.Radius                 = lightNode.Radius;
                    lightProperties.Range                  = lightNode.Range;
                    lightProperties.ShadowFadeDistance     = lightNode.ShadowFadeDistance;
                    lightProperties.ShadowIntensity        = lightNode.ShadowIntensity;
                    lightProperties.ShadowMaximumExtrusion = lightNode.ShadowMaxExtrusion;
                    lightProperties.ShadowNearFarRatio     = lightNode.ShadowNearFarRatio;
                    lightProperties.ShadowResolution       = lightNode.ShadowResolution;

                    propertyGrid.SelectedObject = lightProperties;
                    _currentPropertyNode        = lightProperties;
                }
            }
        }
コード例 #3
0
        public void CreateNodeProperties(object node, bool externallySet)
        {
            if (propertyGrid.InvokeRequired)
            {
                var delegateNodeProperties = new ThreadSafePropertyGrid(CreateNodeProperties);
                if (delegateNodeProperties != null)
                {
                    propertyGrid.Invoke(delegateNodeProperties, new object[] { node, externallySet });
                }
            }
            else
            {
                if (node != null)
                {
                    //Debug.Print("PropertiesInspector.CreateNodeProperties - Found Node '" + ((Node)node).Name + "'");

                    //if externallySet is true, we currently have an existing nodeProperties object in _currentNodeObject
                    ObjectModel.PropertiesModel.NodeProperties nodeProperties;
                    if (!externallySet)
                    {
                        nodeProperties = new ObjectModel.PropertiesModel.NodeProperties
                        {
                            InCreation = true
                        };
                    }
                    else
                    {
                        nodeProperties = _currentPropertyNode;
                    }

                    nodeProperties.ExternallySet = externallySet;

                    var sceneNode = (Node)node;

                    nodeProperties.PulsarApplication = _mainApplication;
                    nodeProperties.Scene             = _scene;
                    nodeProperties.Node         = sceneNode;
                    nodeProperties.Name         = sceneNode.Name;
                    nodeProperties.Position     = sceneNode.Position;
                    nodeProperties.Rotation     = sceneNode.Rotation;
                    nodeProperties.Scale        = sceneNode.Scale;
                    nodeProperties.Enabled      = sceneNode.Enabled;
                    nodeProperties.InCreation   = false;
                    propertyGrid.SelectedObject = nodeProperties;
                    _currentPropertyNode        = nodeProperties;
                }
            }
        }
コード例 #4
0
        private void CreateCameraProperties(object camera, bool externallySet)
        {
            if (propertyGrid.InvokeRequired)
            {
                var d = new ThreadSafePropertyGrid(CreateCameraProperties);
                propertyGrid.Invoke(d, new object[] { camera });
            }
            else
            {
                if (camera != null)
                {
                    var cameraNode = _scene.SceneCamera;
                    CameraProperties cameraProperties;
                    cameraProperties = new CameraProperties(((Camera)camera).Node.Name)
                    {
                        IsMainCamera = cameraNode.IsMainCamera,

                        PulsarApplication = _mainApplication,
                        Scene             = _scene,
                        Node     = cameraNode.Camera,
                        Name     = cameraNode.Node.Name,
                        Enabled  = cameraNode.Enabled,
                        Position = cameraNode.Node.Position,
                        Rotation = cameraNode.Node.Rotation,
                        Scale    = cameraNode.Node.Scale,

                        AspectRatio       = cameraNode.Camera.AspectRatio,
                        AutoAspectRatio   = cameraNode.Camera.AutoAspectRatio,
                        FarClip           = cameraNode.Camera.FarClip,
                        NearClip          = cameraNode.Camera.NearClip,
                        UseClipping       = cameraNode.Camera.UseClipping,
                        FlipVertical      = cameraNode.Camera.FlipVertical,
                        Skew              = cameraNode.Camera.Skew,
                        FieldOfView       = cameraNode.Camera.Fov,
                        LevelOfDetailBias = cameraNode.Camera.LodBias,
                        Zoom              = cameraNode.Camera.Zoom,
                        ViewMask          = cameraNode.Camera.ViewMask,
                        Orthographic      = cameraNode.Camera.Orthographic,
                        OrthographicSize  = cameraNode.Camera.OrthoSize
                    };

                    propertyGrid.SelectedObject = cameraProperties;
                    _currentPropertyNode        = cameraProperties;
                }
            }
        }
コード例 #5
0
        private void CreatePlaneProperties(object plane, bool externallySet)
        {
            if (propertyGrid.InvokeRequired)
            {
                var d = new ThreadSafePropertyGrid(CreatePlaneProperties);
                propertyGrid.Invoke(d, new object[] { plane });
            }
            else
            {
                if (plane != null)
                {
                    PlaneProperties planeProperties = new PlaneProperties();

                    var planeNode = (StaticModel)plane;
                    planeProperties.PulsarApplication = _mainApplication;
                    planeProperties.Scene             = _scene;
                    planeProperties.Node     = planeNode.Node;
                    planeProperties.Name     = planeNode.Node.Name;
                    planeProperties.Enabled  = planeNode.Enabled;
                    planeProperties.Position = planeNode.Node.Position;
                    planeProperties.Rotation = planeNode.Node.Rotation;
                    planeProperties.Scale    = planeNode.Node.Scale;

                    planeProperties.AnimationEnabled = planeNode.AnimationEnabled;
                    planeProperties.CastShadows      = planeNode.CastShadows;
                    planeProperties.DrawDistance     = planeNode.DrawDistance;
                    planeProperties.LightMask        = planeNode.LightMask;
                    planeProperties.LodBias          = planeNode.LodBias;
                    planeProperties.MaxLights        = planeNode.MaxLights;
                    planeProperties.Occludee         = planeNode.Occludee;
                    planeProperties.Occluder         = planeNode.Occluder;
                    planeProperties.ShadowDistance   = planeNode.ShadowDistance;
                    planeProperties.ShadowMask       = planeNode.ShadowMask;
                    planeProperties.SortValue        = planeNode.SortValue;
                    planeProperties.ViewMask         = planeNode.ViewMask;
                    planeProperties.ZoneMask         = planeNode.ZoneMask;
                    planeProperties.BlockEvents      = planeNode.BlockEvents;

                    propertyGrid.SelectedObject = planeProperties;
                    _currentPropertyNode        = planeProperties;
                }
            }
        }