Posts

Showing posts from December, 2019

UE4: Settings

Image
Installing an older version Click +button and add a new slot in Library tab. Choose an older version from dropdown list for the slot. Switching Languages (Editor Languages) / 言語変更 Editor in Menu > Editor Preferences : 編集 > エディタ環境設定 General/Region & Language : 一般-地域&言語 Internationalization/Editor Language : 国際化/エディタの言語

bpy: Location to save your python script files

Default installation location.     In python console, enter >>>print(bpy);     O utputs should be something like below.     <module 'bpy' from '...\Blender Foundation\\Blender 2.81\\2.81\\scripts\\modules\\bpy\\__init__.py'>     Save your python files in "modules" folder. Reloading your python files.    import importlib as iLib;iLib.reload(your python script file name without extension);    e.g.  iLib.reload(i3d); to reload  i3d.py in modules folder.

Python: Version, Merging dictionaries

# python version import sys; pv= sys.version_info; print pv; print str(pv.major)+"."+str(pv.minor); print '{0[0]}.{0[1]}'.format(pv); # merging dictionaries dictA= {'a':4,'b':-9,'c':-901.5}; dictB= {'b':-125,'d':1024,'c':99}; # 1 if pv < 3.5:     dictC= dict(dictA,**dictB); else:     dictC= {** dictA , ** dictB }; print dictC; # output {'a': 4, 'c': 99, 'b': -125, 'd': 1024} # 2 dictA.update(dictB); print dictA; # output {'a': 4, 'c': 99, 'b': -125, 'd': 1024}

Python: Dealing with small decimal values

# Creating a locator import maya.cmds as mc; sloc= mc.spaceLocator()[0]; # Set small decimal values to ty and sz attributes ty= sloc+".ty"; sz= sloc+".sz"; mc.setAttr(ty, 0.0000000001); mc.setAttr(sz, 1.000000000001); # Translate value tval= mc.getAttr(ty); print tval; # This prints "1e-10" if tval==0: print "test: translate value"; # This won't print # Scale value sval= mc.getAttr(sz); print sval; # This prints "1.0" if sval==1: print "test: scale value"; # This won't print # Using the decimal module from decimal import Decimal; print Decimal(tval); # This prints "1.0000000000000000364321973154977415791655470655996396089904010295867919921875E-10" print Decimal(sval); # This prints "1.0000000000010000889005823410116136074066162109375" # PI from math import pi as PI; print PI; #output: 3.14159265359 from decimal import Decimal; print Decimal(PI); #output: 3.14159265358979311599796...