static EditorToolAttribute GetEditorToolAttribute(EditorTool tool) { if (tool == null) { return(null); } return(GetEditorToolAttribute(tool.GetType())); }
static bool CustomEditorToolIsMatch(Editor editor, Type toolType, EditorTool tool) { if (editor == null || toolType != tool.GetType()) { return(false); } // if it's an EditModeTool we need to be stricter about ownership for backwards compatibility. var editModeTool = tool as EditModeTool; if (editModeTool != null) { return(editModeTool.owner == (IToolModeOwner)editor || editModeTool.target == editor.target); } // otherwise just check if it's a valid type return(true); }
public bool IsEqual(EditorTool other) { if (editorToolType != (other == null ? null : other.GetType())) { return(false); } if (ReferenceEquals(targetObjects, other.m_Targets)) { return(true); } if (targetObjects == null || other.m_Targets == null) { return(false); } return(targetObjects.SequenceEqual(other.m_Targets)); }
public CustomEditorToolContext(EditorTool tool) { if (tool != null) { editorToolType = tool.GetType(); targetObject = tool.target; targetObjects = tool.targets.ToArray(); m_EditorToolState = EditorJsonUtility.ToJson(tool); } else { editorToolType = null; targetObject = null; targetObjects = null; m_EditorToolState = null; } m_EditorToolType = null; }
public ComponentToolCache(EditorToolContext context, EditorTool tool) { bool customTool = IsCustomEditorTool(tool); bool customContext = IsCustomToolContext(context); if (customTool || customContext) { toolType = customTool ? tool.GetType() : null; contextType = customContext ? context.GetType() : null; targetObject = tool.target; targetObjects = tool.targets.ToArray(); } else { toolType = null; contextType = null; targetObject = null; targetObjects = null; } m_ToolType = null; m_ContextType = null; }
static bool IsCustomEditorTool(EditorTool tool) { return(EditorToolUtility.IsCustomEditorTool(tool != null ? tool.GetType() : null)); }
internal static string GetToolMenuPath(EditorTool tool) { return(GetToolMenuPath(tool != null ? tool.GetType() : typeof(EditorTool))); }