This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.ShortcutManagement; | |
public static class AnimClipEventCopy | |
{ | |
static AnimationClip sourceClip; | |
[Shortcut("AnimClipEventCopy/Set Source Clip")] | |
public static void CopyEvents() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public static class SelectScript | |
{ | |
[MenuItem("CONTEXT/Component/Select Script File")] | |
static void SelectScriptFile(MenuCommand command) | |
{ | |
Selection.activeObject = AssetDatabase.LoadAssetAtPath<MonoScript>(AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets(MonoScript.FromMonoBehaviour(command.context as MonoBehaviour).name)[0])); | |
//Does not handle non monobehaviour/monoscript components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using static System.Reflection.BindingFlags; | |
using UnityEditor; | |
using UnityEditor.ShortcutManagement; | |
//https://github.com/Unity-Technologies/UnityCsReference/blob/e740821767d2290238ea7954457333f06e952bad/Editor/Mono/Annotation/AnnotationUtility.bindings.cs | |
public static class AnnotationUtilityEx | |
{ | |
[MenuItem("Tools/Editor/Toggle Gizmos & Selection Highlight"), Shortcut("Toggle Gizmos & Selection Highlight", UnityEngine.KeyCode.Space, ShortcutModifiers.Control)] | |
public static void ToggleSelectionOutlinesAndGizmos() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
#if UNITY_EDITOR | |
[System.AttributeUsage(System.AttributeTargets.Field)] | |
public class RenameAttribute : PropertyAttribute | |
{ | |
public string[] renamePairs; | |
public RenameAttribute(params string[] renamePairs) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TES3Birthsign.h" | |
#include "LuaManager.h" | |
#include "TES3ObjectLua.h" | |
namespace mwse { | |
namespace lua { | |
void bindTES3Birthsign() { | |
// Get our lua state. | |
auto stateHandle = LuaManager::getInstance().getThreadSafeStateHandle(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class TextureArrayWizard : ScriptableWizard | |
{ | |
[SerializeField] private Texture2D[] textures = null; | |
[MenuItem("Assets/Create/Texture Array")] | |
static void CreateWizard() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int num_valid_controls = 0; | |
cata::optional<tripoint> vehicle_position; | |
cata::optional<vpart_reference> vehicle_controls; | |
for( const tripoint elem : m.points_in_radius( g->u.pos(), 1 ) ) { | |
if( const optional_vpart_position vp = m.veh_at( elem ) ) { | |
vehicle_controls = *vp.part_with_feature( "CONTROLS", true ); | |
if( vehicle_controls ) { | |
num_valid_controls++; | |
vehicle_position = elem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function dropPlayerItems() | |
local equippedItems = {} | |
for _, stack in pairs(tes3.player.object.equipment) do | |
table.insert(equippedItems, stack.object) | |
end | |
for _, object in pairs(equippedItems) do | |
--tes3.mobilePlayer:unequip{item = object} | |
end | |
tes3ui.forcePlayerInventoryUpdate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function onItemTileUpdated(e) | |
if e.item.objectType == tes3.objectType.book then | |
if e.item.type == tes3.bookType.scroll then | |
if e.item.enchantment then | |
for i = 1, #e.item.enchantment.effects do | |
if e.item.enchantment.effects[i].id >= 0 then | |
-- local icon = e.element:createImage({ path = string.format("icons\\sc\\scroll_%s", e.item.enchantment.effects[i].id) }) | |
local icon = e.element:createImage({ path = string.format("icons\\%s", e.item.enchantment.effects[i].object.icon) }) | |
icon.consumeMouseEvents = false | |
icon.width = 16 |
NewerOlder