Beispiel #1
0
        private void DrawReplaceSection()
        {
            using (new VerticalScope())
            {
                PropertyField(posMod);
                PropertyField(rotMod);
                PropertyField(scaleMod);

                using (new HorizontalScope())
                {
                    PropertyField(sample);

                    using (new EditorGUI.DisabledScope(sample.objectReferenceValue == null))
                    {
                        if (Button("Replace Selected With sample"))
                        {
                            tool.Replace();
                        }
                    }
                }
                PropertyField(showPreview);

                PropertyField(useOffset);
                if (useOffset.boolValue)
                {
                    PropertyField(offset);

                    using (new EditorGUI.DisabledScope(Selection.transforms.Length != 2))
                        using (new HorizontalScope())
                        {
                            if (Button("Set Offset To Selection Difference"))
                            {
                                //offset.managedReferenceValue = TransformValues.GetDifference(Selection.transforms[0], Selection.transforms[1]);
                                tool.offset = TransformValues.GetDifference(Selection.transforms[0], Selection.transforms[1]);
                                EditorUtility.SetDirty(target);
                                serializedObject.Update();
                            }
                        }
                }
            }
        }
Beispiel #2
0
        private void DrawOffsetSection()
        {
            using (new VerticalScope("box"))
            {
                Label("Offset");
                _offset.position = Vector3Field("position", _offset.position);
                _offset.rotation = Vector3Field("rotation", _offset.rotation);
                _offset.scale    = Vector3Field("scale", _offset.scale);

                using (new HorizontalScope())
                {
                    if (Button("Set Offset To Selection Difference") && Selection.transforms.Length == 2)
                    {
                        _offset = TransformValues.GetDifference(Selection.transforms[0], Selection.transforms[1]);
                    }

                    if (Button("Add Offset To Selection"))
                    {
                        TransformObjectsBy(Selection.transforms);
                    }
                }
            }
        }