Skip to content

Instantly share code, notes, and snippets.

list1 = ['a', 'b', 'c']
list2 = map(lambda x: x+'z' if x == 'b' else x, list1)
print list2
>>>結果
['a', 'bz', 'c']
@ShikouYamaue
ShikouYamaue / dijkstras_for_Maya.py
Last active December 17, 2017 04:46
Dijkstras for Maya
# -*- coding: utf-8 -*-
#ダイクストラ法
from maya import cmds
from collections import OrderedDict
import maya.api.OpenMaya as om2
import math
import copy
import time
def dijkstras():
@ShikouYamaue
ShikouYamaue / a_star_for_maya.py
Last active December 18, 2017 15:56
A* for Maya
# -*- coding: utf-8 -*-
#A*アルゴリズム
from maya import cmds
from collections import OrderedDict
import maya.api.OpenMaya as om2
import math
import copy
import time
#ヒューリスティック関数,ゴールからのユークリッド距離を算出
@ShikouYamaue
ShikouYamaue / dijkstras_sphere.py
Last active December 17, 2017 08:01
Dijkstras Sphere
# -*- coding: utf-8 -*-
from maya import cmds
from maya import OpenMayaUI
from collections import OrderedDict
import maya.api.OpenMaya as om
import math
import copy
import time
import numpy as np
#PySide2、PySide両対応
@ShikouYamaue
ShikouYamaue / Mouse Rotation Input
Created January 16, 2018 13:38
マウスジェスチャーでUIにインプットするサンプル
# -*- coding: utf-8 -*-
import math
import imp
try:
imp.find_module('PySide2')
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
except ImportError:
from PySide.QtGui import *
@ShikouYamaue
ShikouYamaue / Lissajous figure in Maya
Created March 4, 2018 13:50
Visualize lissajuous figure in Maya UI
from maya import cmds
import math
import imp
try:
imp.find_module('PySide2')
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
except ImportError:
from PySide.QtGui import *
import imp
try:
imp.find_module('PySide2')
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
except ImportError:
from PySide.QtGui import *
from PySide.QtCore import *
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import imp
try:
imp.find_module('PySide2')
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
except ImportError:
from PySide.QtGui import *
from PySide.QtCore import *
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import imp
try:
imp.find_module('PySide2')
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
except ImportError:
from PySide.QtGui import *
from PySide.QtCore import *
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
@ShikouYamaue
ShikouYamaue / SampleEditor1.py
Last active April 20, 2019 11:15
Sample Editor 1 Cmds + QTableWidget
# -*- coding: utf-8 -*-
from maya import cmds
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import time
import imp
try:
imp.find_module('PySide2')
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *