Best JavaScript code snippet using tracetest
cs_num_control.py
Source:cs_num_control.py
1# ##### BEGIN GPL LICENSE BLOCK #####2#3# This program is free software; you can redistribute it and/or4# modify it under the terms of the GNU General Public License5# as published by the Free Software Foundation; either version 26# of the License, or (at your option) any later version.7#8# This program is distributed in the hope that it will be useful,9# but WITHOUT ANY WARRANTY; without even the implied warranty of10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11# GNU General Public License for more details.12#13# You should have received a copy of the GNU General Public License14# along with this program; if not, write to the Free Software Foundation,15# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.16#17# ##### END GPL LICENSE BLOCK #####18bl_info = {19 "name": "Numeric Selector",20 "category": "Cenda Tools",21 "author": "Cenek Strichel",22 "description": "Selecting bones with hotkeys",23 "location": "Hotkey"24}25import bpy26from bpy.props import StringProperty, IntProperty, BoolProperty, EnumProperty27class NumControlPanel(bpy.types.Panel):28 29 """Creates a Panel in the scene context of the properties editor"""30 bl_label = "Bone Selector"31 bl_idname = "NUMCONTROL_PT_layout"32 bl_space_type = 'PROPERTIES'33 bl_region_type = 'WINDOW'34 bl_context = "data"35 36 @classmethod37 def poll(cls, context):38 return context.object.type == 'ARMATURE'39 manipulatorsEnum = [40 ("NoChange", "No Change", "", "", 0),41 ("Translate", "Translate", "", "MAN_TRANS", 1),42 ("Rotate", "Rotate", "", "MAN_ROT", 2),43 ("Scale", "Scale", "", "MAN_SCALE", 3),44 ("TranslateRotate", "Translate & Rotate", "", 4),45 ("RotateScale", "Rotate & Scale", "", 5),46 ("ScaleTranslate", "Scale & Translate", "", 6)47 ]48 # R = Repeat, M = Manipulator, D = Double, S = Spare49 50 # 051 bpy.types.Object.Num0 = bpy.props.StringProperty( name = "Num 0", default = "", description = "" )52 bpy.types.Object.Num0R = bpy.props.StringProperty( name = "Num 0 Repeat", default = "", description = "")53 bpy.types.Object.Num0M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )54 bpy.types.Object.Num0MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )55 bpy.types.Object.Num0D = bpy.props.StringProperty( name = "Num 0 Double", default = "", description = "")56 bpy.types.Object.Num0MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )57 bpy.types.Object.Num0AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )58 bpy.types.Object.Num0AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )59 bpy.types.Object.Num0AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )60 bpy.types.Object.Num0S = bpy.props.StringProperty( name = "Num 0 Spare", default = "", description = "")61 bpy.types.Object.Num0AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )62 bpy.types.Object.Num0MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )63 64 bpy.types.Object.Num0SR = bpy.props.StringProperty( name = "Num 0 Spare Repeat", default = "", description = "")65 bpy.types.Object.Num0MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )66 bpy.types.Object.Num0AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )67 68 # 169 bpy.types.Object.Num1 = bpy.props.StringProperty(name = "Num 1", default = "", description = "")70 bpy.types.Object.Num1R = bpy.props.StringProperty(name = "Num 1 Repeat", default = "", description = "")71 bpy.types.Object.Num1M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )72 bpy.types.Object.Num1MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )73 bpy.types.Object.Num1D = bpy.props.StringProperty( name = "Num 1 Double", default = "", description = "")74 bpy.types.Object.Num1MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )75 bpy.types.Object.Num1AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )76 bpy.types.Object.Num1AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )77 bpy.types.Object.Num1AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )78 bpy.types.Object.Num1S = bpy.props.StringProperty( name = "Num 1 Spare", default = "", description = "")79 bpy.types.Object.Num1AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )80 bpy.types.Object.Num1MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )81 82 bpy.types.Object.Num1SR = bpy.props.StringProperty( name = "Num 1 Spare Repeat", default = "", description = "")83 bpy.types.Object.Num1MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )84 bpy.types.Object.Num1AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )85 86 # 287 bpy.types.Object.Num2 = bpy.props.StringProperty(name = "Num 2", default = "", description = "")88 bpy.types.Object.Num2R = bpy.props.StringProperty(name = "Num 2 Repeat", default = "", description = "")89 bpy.types.Object.Num2M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )90 bpy.types.Object.Num2MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )91 bpy.types.Object.Num2D = bpy.props.StringProperty( name = "Num 2 Double", default = "", description = "")92 bpy.types.Object.Num2MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )93 bpy.types.Object.Num2AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )94 bpy.types.Object.Num2AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )95 bpy.types.Object.Num2AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )96 bpy.types.Object.Num2S = bpy.props.StringProperty( name = "Num 2 Spare", default = "", description = "")97 bpy.types.Object.Num2AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )98 bpy.types.Object.Num2MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )99 100 bpy.types.Object.Num2SR = bpy.props.StringProperty( name = "Num 2 Spare Repeat", default = "", description = "")101 bpy.types.Object.Num2MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )102 bpy.types.Object.Num2AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )103 104 # 3105 bpy.types.Object.Num3 = bpy.props.StringProperty(name = "Num 3", default = "", description = "")106 bpy.types.Object.Num3R = bpy.props.StringProperty(name = "Num 3 Repeat", default = "", description = "")107 bpy.types.Object.Num3M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )108 bpy.types.Object.Num3MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )109 bpy.types.Object.Num3D = bpy.props.StringProperty( name = "Num 3 Double", default = "", description = "")110 bpy.types.Object.Num3MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )111 bpy.types.Object.Num3AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )112 bpy.types.Object.Num3AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )113 bpy.types.Object.Num3AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )114 bpy.types.Object.Num3S = bpy.props.StringProperty( name = "Num 3 Spare", default = "", description = "")115 bpy.types.Object.Num3AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )116 bpy.types.Object.Num3MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )117 118 bpy.types.Object.Num3SR = bpy.props.StringProperty( name = "Num 3 Spare Repeat", default = "", description = "")119 bpy.types.Object.Num3MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )120 bpy.types.Object.Num3AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )121 122 # 4123 bpy.types.Object.Num4 = bpy.props.StringProperty(name = "Num 4", default = "", description = "")124 bpy.types.Object.Num4R = bpy.props.StringProperty(name = "Num 4 Repeat", default = "", description = "")125 bpy.types.Object.Num4M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )126 bpy.types.Object.Num4MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )127 bpy.types.Object.Num4D = bpy.props.StringProperty( name = "Num 4 Double", default = "", description = "")128 bpy.types.Object.Num4MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )129 bpy.types.Object.Num4AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )130 bpy.types.Object.Num4AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )131 bpy.types.Object.Num4AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )132 bpy.types.Object.Num4S = bpy.props.StringProperty( name = "Num 4 Spare", default = "", description = "")133 bpy.types.Object.Num4AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )134 bpy.types.Object.Num4MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )135 136 bpy.types.Object.Num4SR = bpy.props.StringProperty( name = "Num 4 Spare Repeat", default = "", description = "")137 bpy.types.Object.Num4MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )138 bpy.types.Object.Num4AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )139 140 # 5141 bpy.types.Object.Num5 = bpy.props.StringProperty(name = "Num 5", default = "", description = "")142 bpy.types.Object.Num5R = bpy.props.StringProperty(name = "Num 5 Repeat", default = "", description = "")143 bpy.types.Object.Num5M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )144 bpy.types.Object.Num5MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )145 bpy.types.Object.Num5D = bpy.props.StringProperty( name = "Num 5 Double", default = "", description = "")146 bpy.types.Object.Num5MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )147 bpy.types.Object.Num5AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )148 bpy.types.Object.Num5AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )149 bpy.types.Object.Num5AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )150 bpy.types.Object.Num5S = bpy.props.StringProperty( name = "Num 5 Spare", default = "", description = "")151 bpy.types.Object.Num5AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )152 bpy.types.Object.Num5MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )153 154 bpy.types.Object.Num5SR = bpy.props.StringProperty( name = "Num 5 Spare Repeat", default = "", description = "")155 bpy.types.Object.Num5MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )156 bpy.types.Object.Num5AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )157 158 # 6159 bpy.types.Object.Num6 = bpy.props.StringProperty(name = "Num 6", default = "", description = "")160 bpy.types.Object.Num6R = bpy.props.StringProperty(name = "Num 6 Repeat", default = "", description = "")161 bpy.types.Object.Num6M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )162 bpy.types.Object.Num6MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )163 bpy.types.Object.Num6D = bpy.props.StringProperty( name = "Num 6 Double", default = "", description = "")164 bpy.types.Object.Num6MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )165 bpy.types.Object.Num6AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )166 bpy.types.Object.Num6AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )167 bpy.types.Object.Num6AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )168 bpy.types.Object.Num6S = bpy.props.StringProperty( name = "Num 6 Spare", default = "", description = "")169 bpy.types.Object.Num6AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )170 bpy.types.Object.Num6MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )171 172 bpy.types.Object.Num6SR = bpy.props.StringProperty( name = "Num 6 Spare Repeat", default = "", description = "")173 bpy.types.Object.Num6MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )174 bpy.types.Object.Num6AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )175 176 # 7177 bpy.types.Object.Num7 = bpy.props.StringProperty(name = "Num 7", default = "", description = "")178 bpy.types.Object.Num7R = bpy.props.StringProperty(name = "Num 7 Repeat", default = "", description = "")179 bpy.types.Object.Num7M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )180 bpy.types.Object.Num7MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )181 bpy.types.Object.Num7D = bpy.props.StringProperty( name = "Num 7 Double", default = "", description = "")182 bpy.types.Object.Num7MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )183 bpy.types.Object.Num7AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )184 bpy.types.Object.Num7AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )185 bpy.types.Object.Num7AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )186 bpy.types.Object.Num7S = bpy.props.StringProperty( name = "Num 7 Spare", default = "", description = "")187 bpy.types.Object.Num7AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )188 bpy.types.Object.Num7MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )189 190 bpy.types.Object.Num7SR = bpy.props.StringProperty( name = "Num 7 Spare Repeat", default = "", description = "")191 bpy.types.Object.Num7MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )192 bpy.types.Object.Num7AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )193 194 # 8195 bpy.types.Object.Num8 = bpy.props.StringProperty(name = "Num 8", default = "", description = "")196 bpy.types.Object.Num8R = bpy.props.StringProperty(name = "Num 8 Repeat", default = "", description = "")197 bpy.types.Object.Num8M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )198 bpy.types.Object.Num8MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )199 bpy.types.Object.Num8D = bpy.props.StringProperty( name = "Num 8 Double", default = "", description = "")200 bpy.types.Object.Num8MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )201 bpy.types.Object.Num8AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )202 bpy.types.Object.Num8AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )203 bpy.types.Object.Num8AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )204 bpy.types.Object.Num8S = bpy.props.StringProperty( name = "Num 8 Spare", default = "", description = "")205 bpy.types.Object.Num8AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )206 bpy.types.Object.Num8MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )207 208 bpy.types.Object.Num8SR = bpy.props.StringProperty( name = "Num 8 Spare Repeat", default = "", description = "")209 bpy.types.Object.Num8MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )210 bpy.types.Object.Num8AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )211 212 # 9213 bpy.types.Object.Num9 = bpy.props.StringProperty(name = "Num 9", default = "", description = "")214 bpy.types.Object.Num9R = bpy.props.StringProperty(name = "Num 9 Repeat", default = "", description = "")215 bpy.types.Object.Num9M = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )216 bpy.types.Object.Num9MR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )217 bpy.types.Object.Num9D = bpy.props.StringProperty( name = "Num 9 Double", default = "", description = "")218 bpy.types.Object.Num9MD = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )219 bpy.types.Object.Num9AutoIKN = bpy.props.BoolProperty( name = "Auto IK N", description = "", default = False )220 bpy.types.Object.Num9AutoIKR = bpy.props.BoolProperty( name = "Auto IK R", description = "", default = False )221 bpy.types.Object.Num9AutoIKD = bpy.props.BoolProperty( name = "Auto IK D", description = "", default = False )222 bpy.types.Object.Num9S = bpy.props.StringProperty( name = "Num 9 Spare", default = "", description = "")223 bpy.types.Object.Num9AutoIKS = bpy.props.BoolProperty( name = "Auto IK S", description = "", default = False )224 bpy.types.Object.Num9MS = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )225 226 bpy.types.Object.Num9SR = bpy.props.StringProperty( name = "Num 9 Spare Repeat", default = "", description = "")227 bpy.types.Object.Num9MSR = bpy.props.EnumProperty( name = "Manipulator", description = "", items=manipulatorsEnum )228 bpy.types.Object.Num9AutoIKSR = bpy.props.BoolProperty( name = "Auto IK SR", description = "", default = False )229 230 231 def draw(self, context):232 233 layout = self.layout234 obj = context.object235 236 for i in range(10) :237 238 box = layout.box()239 box.label( "Num "+str(i) )240 # Normal241 c = layout.column()242 row = c.row()243 split = box.split(percentage=0.47)244 c = split.column()245 c.prop(obj, ("Num"+str(i)), text = "Normal" )246 247 split = split.split( align = True )248 c = split.column( align = True )249 c.operator("view3d.num_select_fill", text="", icon = 'EYEDROPPER').index = str(i)250 c = split.column(align = True)251 c.prop(obj, ("Num"+str(i)+"M"), text = "" )252 c = split.column(align = True)253 c.prop(obj, ("Num"+str(i)+"AutoIKN"), text = "Auto IK" )254 255 # Spare256 split = box.split(percentage=0.47)257 c = split.column()258 c.prop(obj, ("Num"+str(i)+"S"), text = "Spare" )259 260 split = split.split(align = True)261 c = split.column(align = True)262 c.operator("view3d.num_select_fill", text="", icon = 'EYEDROPPER').index = (str(i)+"S")263 c = split.column(align = True)264 c.prop(obj, ("Num"+str(i)+"MS"), text = "" )265 c = split.column(align = True)266 c.prop(obj, ("Num"+str(i)+"AutoIKS"), text = "Auto IK" )267 268 # Spare Repeat269 split = box.split(percentage=0.47)270 c = split.column()271 c.prop(obj, ("Num"+str(i)+"SR"), text = "Spare Repeat" )272 273 split = split.split(align = True)274 c = split.column(align = True)275 c.operator("view3d.num_select_fill", text="", icon = 'EYEDROPPER').index = (str(i)+"SR")276 c = split.column(align = True)277 c.prop(obj, ("Num"+str(i)+"MSR"), text = "" )278 c = split.column(align = True)279 c.prop(obj, ("Num"+str(i)+"AutoIKSR"), text = "Auto IK" )280 281 # Separator282 c.separator()283 c.separator()284 285 # Repeat286 split = box.split(percentage=0.47)287 c = split.column()288 c.prop(obj, ("Num"+str(i)+"R"), text = "Repeat" )289 290 split = split.split(align = True)291 c = split.column(align = True)292 c.operator("view3d.num_select_fill", text="", icon = 'EYEDROPPER').index = (str(i)+"R")293 c = split.column(align = True)294 c.prop(obj, ("Num"+str(i)+"MR"), text = "" )295 c = split.column(align = True)296 c.prop(obj, ("Num"+str(i)+"AutoIKR"), text = "Auto IK" )297 298 # Double299 split = box.split(percentage=0.47)300 c = split.column()301 c.prop(obj, ("Num"+str(i)+"D"), text = "Double" )302 303 split = split.split(align = True)304 c = split.column(align = True)305 c.operator("view3d.num_select_fill", text="", icon = 'EYEDROPPER').index = (str(i)+"D")306 c = split.column(align = True)307 c.prop(obj, ("Num"+str(i)+"MD"), text = "" )308 c = split.column(align = True)309 c.prop(obj, ("Num"+str(i)+"AutoIKD"), text = "Auto IK" )310 # Separator311 c.separator()312 313 box = layout.box()314 box.label("Settings") 315 split = box.split()316 c = split.row(align = True)317 c.operator("view3d.num_select_default", text = "Fill Default Animal").preset = 0318 c.operator("view3d.num_select_default", text = "Fill Default Human").preset = 1319 320# selecting by num 321class NumControlSelect(bpy.types.Operator):322 """Creates a Panel in the scene context of the properties editor"""323 bl_label = "Numeric Selector"324 bl_idname = "view3d.num_select"325 326 numKeysEnum = [327 ("Num0", "Num 0", "", "", 0),328 ("Num1", "Num 1", "", "", 1),329 ("Num2", "Num 2", "", "", 2),330 ("Num3", "Num 3", "", "", 3),331 ("Num4", "Num 4", "", "", 4),332 ("Num5", "Num 5", "", "", 5),333 ("Num6", "Num 6", "", "", 6),334 ("Num7", "Num 7", "", "", 7),335 ("Num8", "Num 8", "", "", 8),336 ("Num9", "Num 9", "", "", 9),337 ("Num0D", "Num 0 Double", "", "", 10),338 ("Num1D", "Num 1 Double", "", "", 11),339 ("Num2D", "Num 2 Double", "", "", 12),340 ("Num3D", "Num 3 Double", "", "", 13),341 ("Num4D", "Num 4 Double", "", "", 14),342 ("Num5D", "Num 5 Double", "", "", 15),343 ("Num6D", "Num 6 Double", "", "", 16),344 ("Num7D", "Num 7 Double", "", "", 17),345 ("Num8D", "Num 8 Double", "", "", 18),346 ("Num9D", "Num 9 Double", "", "", 19)347 ]348 numKey = EnumProperty( name = "Num Key", description = "", items = numKeysEnum ) 349 350 351 def execute(self, context):352 353 ob = bpy.context.object354 355 for i in range(10) :356 357 num = str(i)358 359 # NORMAL & REPEAT360 if(self.numKey == 'Num'+num):361 362 repeat, spare = SelectBone(363 self, 364 ob, 365 (ob["Num"+num]), 366 (ob["Num"+num+"R"]),367 (ob["Num"+num+"M"]), 368 (ob["Num"+num+"MR"]), 369 (ob["Num"+num+"S"]), 370 (ob["Num"+num+"MS"]),371 (ob["Num"+num+"SR"]),372 (ob["Num"+num+"MSR"])373 )374 if(spare and repeat):375 AutoIKSetting(ob["Num"+num+"AutoIKSR"])376 elif(spare):377 AutoIKSetting(ob["Num"+num+"AutoIKS"]) 378 elif(repeat):379 AutoIKSetting(ob["Num"+num+"AutoIKR"])380 else:381 AutoIKSetting(ob["Num"+num+"AutoIKN"])382 383 # DOUBLE 384 elif(self.numKey == ('Num'+num+'D') ):385 386 repeat, spare = SelectBone(387 self,388 ob,389 (ob["Num"+num+"D"]),390 (ob["Num"+num+"D"]),391 (ob["Num"+num+"MD"]),392 (ob["Num"+num+"MD"]),393 (ob["Num"+num+"S"]),394 (ob["Num"+num+"MS"]),395 (ob["Num"+num+"S"]),396 (ob["Num"+num+"MS"])397 )398 399 AutoIKSetting(ob["Num"+num+"AutoIKD"])400 401 # for AutoIK toggle 402 # redraw 403 for area in bpy.context.screen.areas:404 if area.type == 'VIEW_3D':405 area.tag_redraw()406 407 return {'FINISHED'} 408 409def AutoIKSetting( state = False ):410 bpy.context.object.data.use_auto_ik = state411 412 413# selecting metod 414def SelectBone( self, ob, boneName, boneNameRepeat, manipulator, manipulatorRepeat, boneSpare, manipulatorSpare, boneSpareRepeat, manipulatorSpareRepeat ) :415 416 finalBone = ""417 finalManipulator = ""418 repeatKey = False419 spare = False420 421 # normal select422 if( bpy.context.active_pose_bone.name != boneName ) :423 finalBone = boneName424 finalManipulator = manipulator425 repeatKey = False426 427 # repeat select428 else :429 finalBone = boneNameRepeat430 finalManipulator = manipulatorRepeat431 repeatKey = True432 433 # spare434 if( finalBone != "" and ob.pose.bones[ finalBone ].bone.hide ):435 436 if(bpy.context.active_pose_bone.name == boneSpare):437 finalBone = boneSpareRepeat438 finalManipulator = manipulatorSpareRepeat439 repeatKey = True440 441 else: 442 finalBone = boneSpare443 finalManipulator = manipulatorSpare444 445 spare = True446 447 448 449 450 # contains multiple bones?451 multipleBones = False 452 if ";" in finalBone:453 multipleBones = True454 455 # if bone is not exist456 if( (ob.pose.bones.get( finalBone ) is None) and not multipleBones ):457 458 if( len(finalBone) > 0) :459 self.report({'WARNING'}, finalBone + " was not found")460 else :461 self.report({'WARNING'}, "Bone is not defined")462 463 else:464 465 # deselect bone if some is selected466 if( len(bpy.context.selected_pose_bones) > 0):467 bpy.ops.pose.select_all(action='TOGGLE')468 469 # multiple bones470 if(multipleBones):471 allBones = finalBone.split(";")472 for ab in allBones : 473 if(len(ab) > 0): # ";" ending474 ob.pose.bones[ ab ].bone.select = True475 ob.data.bones.active = ob.pose.bones[ ab ].bone476 477 # one bone 478 else:479 ob.pose.bones[ finalBone ].bone.select = True480 ob.data.bones.active = ob.pose.bones[ finalBone ].bone481 482 # manipulator 483 if(finalManipulator == 'Translate'):484 bpy.context.space_data.transform_manipulators = {'TRANSLATE'}485 486 elif(finalManipulator == 'Rotate'):487 bpy.context.space_data.transform_manipulators = {'ROTATE'}488 489 elif(finalManipulator == 'Scale'):490 bpy.context.space_data.transform_manipulators = {'SCALE'}491 492 elif(finalManipulator == 'TranslateRotate'):493 bpy.context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE'}494 495 elif(finalManipulator == 'RotateScale'):496 bpy.context.space_data.transform_manipulators = {'ROTATE', 'SCALE'}497 498 elif(finalManipulator == 'ScaleTranslate'):499 bpy.context.space_data.transform_manipulators = {'SCALE', 'TRANSLATE'}500 501 502 return [ repeatKey, spare ]503#############################504# HELPER METHODS ###########################################################################################505#############################506#507# pick bone from scene508#509class NumControlSelectPick(bpy.types.Operator):510 """Pick selected object (multiple selection supported)"""511 bl_label = "Fill numeric"512 bl_idname = "view3d.num_select_fill"513 514 index = StringProperty( name = "index" )515 516 def execute(self, context):517 518 selectedBone = ""519 bones = bpy.context.selected_pose_bones520 if(len(bones) > 1) :521 for b in bones :522 selectedBone += b.name +";"523 524 else: 525 selectedBone = bpy.context.active_pose_bone.name526 527 528 for i in range(10) :529 530 num = str(i)531 if(self.index == num):532 bpy.context.object['Num'+num] = selectedBone533 534 elif(self.index == (num+'R') ):535 bpy.context.object['Num'+num+'R'] = selectedBone536 537 elif(self.index == (num+'D') ):538 bpy.context.object['Num'+num+'D'] = selectedBone 539 540 elif(self.index == (num+'S') ):541 bpy.context.object['Num'+num+'S'] = selectedBone 542 543 elif(self.index == (num+'SR') ):544 bpy.context.object['Num'+num+'SR'] = selectedBone 545 546 return {'FINISHED'}547 548 549# Set default550class NumControlSelectDefault(bpy.types.Operator):551 """Set default values"""552 bl_label = "Fill Default"553 bl_idname = "view3d.num_select_default"554 555 preset = IntProperty( name = "preset", default = 0 )556 557 def execute(self, context):558 559 # RESET #560 561 562 # 0563 bpy.context.object.Num0 = ""564 bpy.context.object.Num0R = ""565 bpy.context.object.Num0D = ""566 bpy.context.object.Num0S = ""567 bpy.context.object.Num0M = 'NoChange'568 bpy.context.object.Num0MR = 'NoChange'569 bpy.context.object.Num0MD = 'NoChange'570 bpy.context.object.Num0MS = 'NoChange'571 bpy.context.object.Num0AutoIKN = False572 bpy.context.object.Num0AutoIKR = False573 bpy.context.object.Num0AutoIKD = False574 bpy.context.object.Num0AutoIKS = False575 576 bpy.context.object.Num0SR = ""577 bpy.context.object.Num0MSR = 'NoChange'578 bpy.context.object.Num0AutoIKSR = False579 580 # 1581 bpy.context.object.Num1 = ""582 bpy.context.object.Num1R = ""583 bpy.context.object.Num1D = ""584 bpy.context.object.Num1S = ""585 bpy.context.object.Num1M = 'NoChange'586 bpy.context.object.Num1MR = 'NoChange'587 bpy.context.object.Num1MD = 'NoChange'588 bpy.context.object.Num1MS = 'NoChange'589 bpy.context.object.Num1AutoIKN = False590 bpy.context.object.Num1AutoIKR = False591 bpy.context.object.Num1AutoIKD = False592 bpy.context.object.Num1AutoIKS = False593 594 bpy.context.object.Num1SR = ""595 bpy.context.object.Num1MSR = 'NoChange'596 bpy.context.object.Num1AutoIKSR = False597 598 599 # 2600 bpy.context.object.Num2 = ""601 bpy.context.object.Num2R = ""602 bpy.context.object.Num2D = ""603 bpy.context.object.Num2S = ""604 bpy.context.object.Num2M = 'NoChange'605 bpy.context.object.Num2MR = 'NoChange'606 bpy.context.object.Num2MD = 'NoChange'607 bpy.context.object.Num2MS = 'NoChange'608 bpy.context.object.Num2AutoIKN = False609 bpy.context.object.Num2AutoIKR = False610 bpy.context.object.Num2AutoIKD = False611 bpy.context.object.Num2AutoIKS = False612 613 bpy.context.object.Num2SR = ""614 bpy.context.object.Num2MSR = 'NoChange'615 bpy.context.object.Num2AutoIKSR = False616 617 618 # 3619 bpy.context.object.Num3 = ""620 bpy.context.object.Num3R = ""621 bpy.context.object.Num3D = ""622 bpy.context.object.Num3S = ""623 bpy.context.object.Num3M = 'NoChange'624 bpy.context.object.Num3MR = 'NoChange'625 bpy.context.object.Num3MD = 'NoChange'626 bpy.context.object.Num3MS = 'NoChange'627 bpy.context.object.Num3AutoIKN = False628 bpy.context.object.Num3AutoIKR = False629 bpy.context.object.Num3AutoIKD = False630 bpy.context.object.Num3AutoIKS = False631 632 bpy.context.object.Num3SR = ""633 bpy.context.object.Num3MSR = 'NoChange'634 bpy.context.object.Num3AutoIKSR = False635 636 637 # 4638 bpy.context.object.Num4 = ""639 bpy.context.object.Num4R = ""640 bpy.context.object.Num4D = ""641 bpy.context.object.Num4S = ""642 bpy.context.object.Num4M = 'NoChange'643 bpy.context.object.Num4MR = 'NoChange'644 bpy.context.object.Num4MD = 'NoChange'645 bpy.context.object.Num4MS = 'NoChange'646 bpy.context.object.Num4AutoIKN = False647 bpy.context.object.Num4AutoIKR = False648 bpy.context.object.Num4AutoIKD = False649 bpy.context.object.Num4AutoIKS = False650 651 bpy.context.object.Num4SR = ""652 bpy.context.object.Num4MSR = 'NoChange'653 bpy.context.object.Num4AutoIKSR = False654 655 656 # 5657 bpy.context.object.Num5 = ""658 bpy.context.object.Num5R = ""659 bpy.context.object.Num5D = ""660 bpy.context.object.Num5S = ""661 bpy.context.object.Num5M = 'NoChange'662 bpy.context.object.Num5MR = 'NoChange'663 bpy.context.object.Num5MD = 'NoChange'664 bpy.context.object.Num5MS = 'NoChange'665 bpy.context.object.Num5AutoIKN = False666 bpy.context.object.Num5AutoIKR = False667 bpy.context.object.Num5AutoIKD = False668 bpy.context.object.Num5AutoIKS = False669 670 bpy.context.object.Num5SR = ""671 bpy.context.object.Num5MSR = 'NoChange'672 bpy.context.object.Num5AutoIKSR = False673 674 675 # 6676 bpy.context.object.Num6 = ""677 bpy.context.object.Num6R = ""678 bpy.context.object.Num6D = ""679 bpy.context.object.Num6S = ""680 bpy.context.object.Num6M = 'NoChange'681 bpy.context.object.Num6MR = 'NoChange'682 bpy.context.object.Num6MD = 'NoChange'683 bpy.context.object.Num6MS = 'NoChange'684 bpy.context.object.Num6AutoIKN = False685 bpy.context.object.Num6AutoIKR = False686 bpy.context.object.Num6AutoIKD = False687 bpy.context.object.Num6AutoIKS = False688 689 bpy.context.object.Num6SR = ""690 bpy.context.object.Num6MSR = 'NoChange'691 bpy.context.object.Num6AutoIKSR = False692 693 694 # 7695 bpy.context.object.Num7 = ""696 bpy.context.object.Num7R = ""697 bpy.context.object.Num7D = ""698 bpy.context.object.Num7S = ""699 bpy.context.object.Num7M = 'NoChange'700 bpy.context.object.Num7MR = 'NoChange'701 bpy.context.object.Num7MD = 'NoChange'702 bpy.context.object.Num7MS = 'NoChange'703 bpy.context.object.Num7AutoIKN = False704 bpy.context.object.Num7AutoIKR = False705 bpy.context.object.Num7AutoIKD = False706 bpy.context.object.Num7AutoIKS = False707 708 bpy.context.object.Num7SR = ""709 bpy.context.object.Num7MSR = 'NoChange'710 bpy.context.object.Num7AutoIKSR = False711 712 713 # 8714 bpy.context.object.Num8 = ""715 bpy.context.object.Num8R = ""716 bpy.context.object.Num8D = ""717 bpy.context.object.Num8S = ""718 bpy.context.object.Num8M = 'NoChange'719 bpy.context.object.Num8MR = 'NoChange'720 bpy.context.object.Num8MD = 'NoChange'721 bpy.context.object.Num8MS = 'NoChange'722 bpy.context.object.Num8AutoIKN = False723 bpy.context.object.Num8AutoIKR = False724 bpy.context.object.Num8AutoIKD = False725 bpy.context.object.Num8AutoIKS = False726 727 bpy.context.object.Num8SR = ""728 bpy.context.object.Num8MSR = 'NoChange'729 bpy.context.object.Num8AutoIKSR = False730 731 732 # 9733 bpy.context.object.Num9 = ""734 bpy.context.object.Num9R = ""735 bpy.context.object.Num9D = ""736 bpy.context.object.Num9S = ""737 bpy.context.object.Num9M = 'NoChange'738 bpy.context.object.Num9MR = 'NoChange'739 bpy.context.object.Num9MD = 'NoChange'740 bpy.context.object.Num9MS = 'NoChange'741 bpy.context.object.Num9AutoIKN = False742 bpy.context.object.Num9AutoIKR = False743 bpy.context.object.Num9AutoIKD = False744 bpy.context.object.Num9AutoIKS = False745 bpy.context.object.Num9SR = ""746 bpy.context.object.Num9MSR = 'NoChange'747 bpy.context.object.Num9AutoIKSR = False748 # ANIMAL #749 if(self.preset == 0):750 751 # 0752 bpy.context.object.Num0 = "Pelvis"753 bpy.context.object.Num0R = ""754 bpy.context.object.Num0D = ""755 756 # 1757 bpy.context.object.Num1 = "BackLeg_R"758 bpy.context.object.Num1R = "BackLegAnkle_R"759 bpy.context.object.Num1D = "BackLegLowerPV_R"760 761 # 2762 bpy.context.object.Num2 = "Hips"763 bpy.context.object.Num2R = "Spine1"764 bpy.context.object.Num2D = "Hips"765 766 # 3767 bpy.context.object.Num3 = "BackLeg_L"768 bpy.context.object.Num3R = "BackLegAnkle_L"769 bpy.context.object.Num3D = "BackLegLowerPV_L"770 771 # 4772 bpy.context.object.Num4 = "FrontLeg_R"773 bpy.context.object.Num4R = "FrontLegAnkle_R"774 bpy.context.object.Num4D = "FrontLegLowerPV_R" 775 776 # 5777 bpy.context.object.Num5 = "Chest"778 bpy.context.object.Num5R = "Spine2"779 bpy.context.object.Num5D = "Chest"780 781 # 6782 bpy.context.object.Num6 = "FrontLeg_L"783 bpy.context.object.Num6R = "FrontLegAnkle_L"784 bpy.context.object.Num6D = "FrontLegLowerPV_L"785 # 7786 bpy.context.object.Num7 = "FrontLegUpper_R"787 bpy.context.object.Num7R = "BackLegUpper_R"788 bpy.context.object.Num7D = "FrontLegUpper_R"789 790 # 8791 bpy.context.object.Num8 = "Head"792 bpy.context.object.Num8R = "Neck"793 bpy.context.object.Num8D = "Head"794 795 # 9796 bpy.context.object.Num9 = "FrontLegUpper_L"797 bpy.context.object.Num9R = "BackLegUpper_L"798 bpy.context.object.Num9D = "FrontLegUpper_L"799 800 # HUMAN #801 elif(self.preset == 1):802 803 # 0804 bpy.context.object.Num0 = "LegRoll_L"805 bpy.context.object.Num0R = "LegRoll_R"806 807 # bpy.context.object.Num0M = 'TranslateRotate'808 # bpy.context.object.Num0MR = 'TranslateRotate'809 # bpy.context.object.Num0MD = 'TranslateRotate'810 811 # 1812 bpy.context.object.Num1 = "Leg_R"813 bpy.context.object.Num1R = "LegPV_R"814 bpy.context.object.Num1D = "LegTip_R"815 816 # bpy.context.object.Num1M = 'TranslateRotate'817 # bpy.context.object.Num1MR = 'TranslateRotate'818 # bpy.context.object.Num1MD = 'Translate'819 820 # 2821 bpy.context.object.Num2 = "Pelvis"822 bpy.context.object.Num2R = "Hips"823 bpy.context.object.Num2D = "Spine"824 825 # bpy.context.object.Num2M = 'TranslateRotate'826 # bpy.context.object.Num2MR = 'TranslateRotate'827 # bpy.context.object.Num2MD = 'TranslateRotate'828 829 # 3830 bpy.context.object.Num3 = "Leg_L"831 bpy.context.object.Num3R = "LegPV_L"832 bpy.context.object.Num3D = "LegTip_L"833 834 # bpy.context.object.Num3M = 'TranslateRotate'835 # bpy.context.object.Num3MR = 'TranslateRotate'836 # bpy.context.object.Num3MD = 'Translate'837 838 # 4839 bpy.context.object.Num4 = "Hand_R"840 bpy.context.object.Num4R = "LowerArm_R"841 bpy.context.object.Num4D = "Digits_R"842 843 # bpy.context.object.Num4M = 'Rotate'844 # bpy.context.object.Num4MR = 'TranslateRotate'845 # bpy.context.object.Num4MD = 'Rotate'846 847 bpy.context.object.Num4AutoIKN = True848 # bpy.context.object.Num4MS = 'Translate'849 bpy.context.object.Num4S = 'ArmIK_R'850 bpy.context.object.Num4SR = "ArmPV_R"851 852 # 5853 bpy.context.object.Num5 = "Chest"854 bpy.context.object.Num5R = "Spine"855 bpy.context.object.Num5D = "Chest"856 857 # bpy.context.object.Num5M = 'TranslateRotate'858 # bpy.context.object.Num5MR = 'TranslateRotate'859 # bpy.context.object.Num5MD = 'TranslateRotate'860 861 # 6862 bpy.context.object.Num6 = "Hand_L"863 bpy.context.object.Num6R = "LowerArm_L"864 bpy.context.object.Num6D = "Digits_L"865 866 # bpy.context.object.Num6M = 'Rotate'867 # bpy.context.object.Num6MR = 'TranslateRotate'868 # bpy.context.object.Num6MD = 'Rotate'869 870 bpy.context.object.Num6AutoIKN = True871 # bpy.context.object.Num6MS = 'Translate'872 bpy.context.object.Num6S = 'ArmIK_L'873 bpy.context.object.Num6SR = "ArmPV_L"874 # 7875 bpy.context.object.Num7 = "UpperArm_R"876 bpy.context.object.Num7R = "Clavicle_R"877 bpy.context.object.Num7D = "UpperArm_R"878 879 # bpy.context.object.Num7M = 'Rotate'880 # bpy.context.object.Num7MR = 'Rotate'881 # bpy.context.object.Num7MD = 'Rotate'882 883 # 8884 bpy.context.object.Num8 = "Head"885 bpy.context.object.Num8R = "Neck"886 bpy.context.object.Num8D = "Head"887 888 # bpy.context.object.Num8M = 'Rotate'889 # bpy.context.object.Num8MR = 'Rotate'890 # bpy.context.object.Num8MD = 'Rotate'891 892 # 9893 bpy.context.object.Num9 = "UpperArm_L"894 bpy.context.object.Num9R = "Clavicle_L"895 bpy.context.object.Num9D = "UpperArm_L"896 897 # bpy.context.object.Num9M = 'Rotate'898 # bpy.context.object.Num9MR = 'Rotate'899 # bpy.context.object.Num9MD = 'Rotate'900 901 return {'FINISHED'}902 903############################################################################################904def register():905 bpy.utils.register_module(__name__)906 '''907 wm = bpy.context.window_manager908 km = wm.keyconfigs.addon.keymaps.new(name='Pose', space_type='EMPTY')909 910 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_0', 'PRESS' )911 addon_keymaps.append((km, kmi))912 913 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_1', 'PRESS' )914 addon_keymaps.append((km, kmi))915 916 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_2', 'PRESS' )917 addon_keymaps.append((km, kmi))918 919 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_3', 'PRESS' )920 addon_keymaps.append((km, kmi))921 922 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_4', 'PRESS' )923 addon_keymaps.append((km, kmi))924 925 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_5', 'PRESS' )926 addon_keymaps.append((km, kmi))927 928 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_6', 'PRESS' )929 addon_keymaps.append((km, kmi))930 931 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_7', 'PRESS' )932 addon_keymaps.append((km, kmi))933 934 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_8', 'PRESS' )935 addon_keymaps.append((km, kmi))936 937 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_9', 'PRESS' )938 addon_keymaps.append((km, kmi))939 940 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_0', 'DOUBLE_CLICK' )941 addon_keymaps.append((km, kmi))942 943 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_1', 'DOUBLE_CLICK' )944 addon_keymaps.append((km, kmi))945 946 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_2', 'DOUBLE_CLICK' )947 addon_keymaps.append((km, kmi))948 949 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_3', 'DOUBLE_CLICK' )950 addon_keymaps.append((km, kmi))951 952 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_4', 'DOUBLE_CLICK' )953 addon_keymaps.append((km, kmi))954 955 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_5', 'DOUBLE_CLICK' )956 addon_keymaps.append((km, kmi))957 958 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_6', 'DOUBLE_CLICK' )959 addon_keymaps.append((km, kmi))960 961 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_7', 'DOUBLE_CLICK' )962 addon_keymaps.append((km, kmi))963 964 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_8', 'DOUBLE_CLICK' )965 addon_keymaps.append((km, kmi))966 967 kmi = km.keymap_items.new(NumControlSelect.bl_idname, 'NUMPAD_9', 'DOUBLE_CLICK' )968 addon_keymaps.append((km, kmi))969 '''970def unregister():971 '''972 for km, kmi in addon_keymaps:973 km.keymap_items.remove(kmi)974 addon_keymaps.clear()975 '''976 bpy.utils.unregister_module(__name__)977if __name__ == "__main__":...
settings.py
Source:settings.py
1# ##### BEGIN GPL LICENSE BLOCK #####2#3# This program is free software; you can redistribute it and/or4# modify it under the terms of the GNU General Public License5# as published by the Free Software Foundation; either version 36# of the License, or (at your option) any later version.7#8# This program is distributed in the hope that it will be useful,9# but WITHOUT ANY WARRANTY; without even the implied warranty of10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11# GNU General Public License for more details.12#13# You should have received a copy of the GNU General Public License14# along with this program; if not, write to the Free Software Foundation,15# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.16#17# ##### END GPL LICENSE BLOCK #####18# This script by Lionel Zamouth19import bpy20import os21from .labels import getLabel22from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty, FloatProperty23def addProperties():24 class OctaneTexture(bpy.types.PropertyGroup):25 pass26 class OctaneRenderSettings(bpy.types.PropertyGroup):27 pass28 bpy.utils.register_class(OctaneTexture)29 bpy.utils.register_class(OctaneRenderSettings)30 bpy.types.Scene.octane_render = PointerProperty(type=OctaneRenderSettings, name="Octane Render", description="Octane Render Settings")31 # Octane Render Plug-in32 OctaneRenderSettings.export_mode = EnumProperty(33 items=(34 ("MODE_IMAGE", "Image", "Export still image"),35 ("MODE_ANIMATION", "Animation", "Export animation"),36 ("MODE_GEOMETRY", "Geometry", "Export OBJ/MTL only. Dont start Octane"),37 ),38 name="Panel Mode",39 description="Render/Export target",40 default="MODE_IMAGE")41 OctaneRenderSettings.export_camera_only = BoolProperty(42 name="Camera only",43 description="Export only the active camera",44 default=False)45 OctaneRenderSettings.output_mode = EnumProperty(46 items=(47 ("OUTPUT_PNG", "PNG", "Output to png"),48 ("OUTPUT_PNG16", "PNG16", "Output to png16"),49 ("OUTPUT_EXR", "EXR", "Output to exr"),50 ("OUTPUT_EXR_TM", "EXR-TM", "Output to exr-tm"),51 ),52 name="Output Mode",53 description="Output file format",54 default="OUTPUT_PNG")55 OctaneRenderSettings.import_render = BoolProperty(56 name="Import render in Blender",57 description="Guess what? It will import the render in Blender",58 default=False)59 OctaneRenderSettings.samples_still = IntProperty(60 name='Samples',61 description="Number of samples to render before pulling back the image",62 min=4,63 max=64000,64 default=1024)65 OctaneRenderSettings.image_output = StringProperty(66 name="Images Output",67 description="Output path for png images",68 maxlen=512,69 default="",70 subtype='FILE_PATH')71 OctaneRenderSettings.export_samples_per_image = IntProperty(72 attr="",73 name="Samples",74 description="Samples per image",75 min=4,76 max=64000,77 default=256)78 # OctaneRenderSettings.export_samples_presets = EnumProperty(79 # name="Presets",80 # description="Samples per image presets",81 # items=(82 # ("0", "Very Low (8)", ""),83 # ("1", "Low (32)", ""),84 # ("2", "Medium (256)", ""),85 # ("3", "Medium/High (512)", ""),86 # ("4", "High (1024)", ""),87 # ("5", "Very High (4096)", ""),88 # ("6", "Too High (8192)", ""),89 # ("7", "Insane (16384)", "")90 # ),91 # default="2")92 OctaneRenderSettings.export_samples_per_image_old = IntProperty(93 name="Previous Samples",94 description="Previous Samples",95 min=4,96 max=64000,97 default=256)98 OctaneRenderSettings.bucketX = IntProperty(99 name="Width",100 description="Tiles on X axis",101 min=2,102 max=16,103 default=2)104 OctaneRenderSettings.bucketY = IntProperty(105 name="Height",106 description="Tiles on Y axis",107 min=2,108 max=16,109 default=2)110# Octane Project Settings111 OctaneRenderSettings.path = StringProperty(112 name="Project Path",113 description="Requires Absolute Path",114 maxlen=512,115 default="",116 subtype='DIR_PATH')117 OctaneRenderSettings.project_name = StringProperty(118 name="Project name",119 description="Octane project name",120 maxlen=128,121 default="")122 OctaneRenderSettings.unit_size = EnumProperty(123 name="Native Unit Size",124 description="Native Units",125 items=(126 ("11", "Miles", ""),127 ("10", "Furlongs", ""),128 ("9", "Yards", ""),129 ("8", "Feets", ""),130 ("7", "Inches", ""),131 ("6", "Kilometers", ""),132 ("5", "Hectometers", ""),133 ("4", "Decameters", ""),134 ("3", "Meters", ""),135 ("2", "Decimeters", ""),136 ("1", "Centimeters", ""),137 ("0", "Milimeters", "")138 ),139 default="3")140 OctaneRenderSettings.export_camera = BoolProperty(141 name="Export camera",142 description="Exports the current active camera settings and writes them down in the selected RT node",143 default=True)144 OctaneRenderSettings.export_resolution = BoolProperty(145 name="Export resolution",146 description="Exports the current resolution from Blender and overwrites the one in Octane",147 default=True)148 OctaneRenderSettings.export_instances = BoolProperty(149 name="Export instances",150 description="Exports all the active particle systems into .csv files",151 default=True)152# Octane Environement Settings153 OctaneRenderSettings.replace_project = BoolProperty(154 name="Create or replace OCS file",155 description="Will create or overwrite the ocs file",156 default=False)157 OctaneRenderSettings.relink_obj = BoolProperty(158 name="Relink OBJ to existing OCS",159 description="Force OBJ mesh file to relink into rendered OCS",160 default=True)161 OctaneRenderSettings.write_ocs = BoolProperty(162 name="Write materials into OCS file",163 description="Will write some parameters directly into the ocs file - EXPERIMENTAL!",164 default=False)165 # Camera Properties166# Octane Export Settings167 # Context168 OctaneRenderSettings.export_sel_only = BoolProperty(169 name="Selection Only",170 description="Only export objects in visible selection. Else export whole scene",171 default=False)172 OctaneRenderSettings.export_remove_hidden = BoolProperty(173 name="Remove Hidden",174 description="Remove objects with restricted rendability from export result",175 default=False)176 OctaneRenderSettings.export_remove_invisible = BoolProperty(177 name="Remove Invisible",178 description="Remove objects with restricted visibility from export result",179 default=False)180 # Output Opyions181 OctaneRenderSettings.export_apply_modifiers = BoolProperty(182 name="Apply Modifiers",183 description="Use transformed mesh data from each object. May break vert order for morph targets",184 default=True)185 OctaneRenderSettings.export_ROTX90 = BoolProperty(186 name="Rotate X90",187 description="Rotate on export so Blenders UP is translated into OBJs UP",188 default=True)189 OctaneRenderSettings.export_copy_images = BoolProperty(190 name="Copy Images",191 description="Copy image files to the export directory, never overwrite",192 default=True)193 # Export Options194 OctaneRenderSettings.export_edges = BoolProperty(195 name="Edges",196 description="Edges not connected to faces",197 default=False)198 OctaneRenderSettings.export_tri = BoolProperty(199 name="Triangulate",200 description="Triangulate quads",201 default=False)202 OctaneRenderSettings.export_materials = BoolProperty(203 name="Materials",204 description="Write a separate MTL file with the OBJ",205 default=True)206 OctaneRenderSettings.export_UV = BoolProperty(207 name="UVs",208 description="Export texface UV coords",209 default=True)210 OctaneRenderSettings.export_normals = BoolProperty(211 name="Normals",212 description="Export vertex normal data (Ignored on import)",213 default=False)214 OctaneRenderSettings.export_HQ = BoolProperty(215 name="HQ",216 description="Calculate high quality normals for rendering",217 default=False)218 OctaneRenderSettings.export_polygroups = BoolProperty(219 name="Polygroups",220 description="Export vertex groups as OBJ groups (one group per face approximation)",221 default=False)222 OctaneRenderSettings.export_curves_as_nurbs = BoolProperty(223 name="Nurbs",224 description="Export 3D nurbs curves and polylines as OBJ curves, (bezier not supported)",225 default=False)226# Octane System settings227 OctaneRenderSettings.binary = StringProperty(228 name="Octane Binary",229 description="Requires Absolute Path",230 maxlen=512,231 default="",232 subtype='FILE_PATH')233 OctaneRenderSettings.GPU_selector = BoolProperty(234 name="GPU Devices to use",235 description="Custom GPU devices config",236 default=False)237 OctaneRenderSettings.GPU_use_list = StringProperty(238 name=getLabel('GPU_use_list'),239 description="List of GPUs to use (ex: 0 1 2)",240 maxlen=128,241 default="")242 OctaneRenderSettings.verbose = BoolProperty(243 name="Verbose logging in console",244 description="Log Octane plug-in events in console",245 default=True)246 OctaneRenderSettings.double_specular = BoolProperty(247 name="Double specularity in MTL file",248 description="Will double the specular value to cancel Octane import logic",249 default=False)250 OctaneRenderSettings.ignore_intensity = BoolProperty(251 name="Force intensity of color values to 1",252 description="Will force the intensity of diffuse/specular to 1",253 default=False)254 ###################################################255 # Added by Matej for instance transforms export256 ###################################################257 OctaneRenderSettings.instances_write_dupli = BoolProperty(258 name="Write dupli objects to file",259 description="Will create .obj/.mtl files for the duplication object(s)",260 default=True)261 OctaneRenderSettings.instances_export_mode = EnumProperty(262 name="Export mode",263 items=(('Auto', 'Auto', 'Exports all active particle systems'),264 ('Manual', 'Manual', 'Manually export the selected PS')),265 default='Auto',266 )267 OctaneRenderSettings.node_render_geometry = StringProperty(268 name="Geometry node",269 description="The name of the geometry node to render inside .ocs. If blank, project name will be used.",270 maxlen=128,271 default="")272 OctaneRenderSettings.node_render_target = StringProperty(273 name="Render Target",274 description="The name of the RenderTarget node to render inside .ocs. If set, takes precedence over geometry node",275 maxlen=128,276 default="")277# Add custom properties to World278# Mesh Preview Kernel279 bpy.types.World.OCT_kernel_use = BoolProperty(280 name="",281 description="Use blender to drive Mesh Preview Kernel",282 default=False)283 bpy.types.World.OCT_kernel = EnumProperty(284 items=(285 ("directlighting", "Direct Lightning", "Use directlight kernel"),286 ("pathtracing", "Path Tracing", "Use pathtracing kernel"),287 ),288 name="Preview Kernel Manager",289 description="Select which kernel to use",290 default="directlighting")291 # Common settings to DL and PT292 bpy.types.World.OCT_use_rayepsilon = BoolProperty(293 name="",294 description="Override OCS rayepsilon value",295 default=False)296 bpy.types.World.OCT_rayepsilon = FloatProperty(297 name="Ray Epsilon",298 description="Set OCS rayepsilon value",299 min=0.0001, max=0.10, step=1.0, precision=4, default=0.001)300 bpy.types.World.OCT_use_filtersize = BoolProperty(301 name="",302 description="Override OCS filtersize value",303 default=False)304 bpy.types.World.OCT_filtersize = FloatProperty(305 name="Filter Size",306 description="Override OCS filtersize value",307 min=1.5, max=8.0, step=10.0, default=1.5)308 bpy.types.World.OCT_use_alphachannel = BoolProperty(309 name="",310 description="Override OCS alphachannel value",311 default=False)312 bpy.types.World.OCT_alphachannel = EnumProperty(313 items=(314 ("true", "Use Alpha Channel", "Use Alpha Channel"),315 ("false", "No Alpha Channel", "Turn off Alpha Channel"),316 ),317 name="Alpha Channel",318 description="Set OCS alphachannel value",319 default="false")320 bpy.types.World.OCT_use_keep_environment = BoolProperty(321 name="",322 description="Override OCS keep_environment value",323 default=False)324 bpy.types.World.OCT_keep_environment = EnumProperty(325 items=(326 ("true", "Keep Environment", "Keep Environment"),327 ("false", "Hide Environment", "Hide Environment"),328 ),329 name="Keep Environment",330 description="Set OCS keep_environment value",331 default="false")332 # DL Settings333 bpy.types.World.OCT_use_speculardepth = BoolProperty(334 name="",335 description="Override OCS speculardepth value",336 default=False)337 bpy.types.World.OCT_speculardepth = IntProperty(338 name="Specular Depth",339 description="Set OCS speculardepth value",340 min=1, max=1024, step=1, default=5)341 bpy.types.World.OCT_use_glossydepth = BoolProperty(342 name="",343 description="Override OCS glossydepth value",344 default=False)345 bpy.types.World.OCT_glossydepth = IntProperty(346 name="Glossy Depth",347 description="Set OCS glossydepth value",348 min=1, max=1024, step=1, default=1)349 bpy.types.World.OCT_use_aodist = BoolProperty(350 name="",351 description="Override OCS aodist value",352 default=False)353 bpy.types.World.OCT_aodist = FloatProperty(354 name="AO distance",355 description="Set OCS aodist value",356 min=0.01, max=1024.0, step=100.0, default=3.0)357 # PT Settings358 bpy.types.World.OCT_use_maxdepth = BoolProperty(359 name="",360 description="Override OCS maxdepth value",361 default=False)362 bpy.types.World.OCT_maxdepth = IntProperty(363 name="Max Depth",364 description="Set OCS maxdepth value",365 min=1, max=2048, step=1, default=16)366 bpy.types.World.OCT_use_rrprob = BoolProperty(367 name="",368 description="Override OCS rrprob value",369 default=False)370 bpy.types.World.OCT_rrprob = FloatProperty(371 name="RR Prob",372 description="Set OCS rrprob value",373 min=0.0, max=1.0, step=1.0, default=0.0)374 bpy.types.World.OCT_use_alphashadows = BoolProperty(375 name="",376 description="Override OCS alphashadows value",377 default=False)378 bpy.types.World.OCT_alphashadows = EnumProperty(379 items=(380 ("true", "Use Alpha Shadows", "Use Alpha Shadows"),381 ("false", "No Alpha Shadows", "Turn off Alpha Shadows"),382 ),383 name="Alpha Shadows",384 description="Set OCS alphashadows value",385 default="false")386# Mesh Preview Environment387 bpy.types.World.OCT_environment_use = BoolProperty(388 name="",389 description="Use Blender to drive Mesh Preview Environment",390 default=False)391 bpy.types.World.OCT_environment = EnumProperty(392 items=(393 ("texture environment", "Texture", "Use Texture Environment"),394 ("daylight", "Daylight", "Use Daylight Environment"),395 ),396 name="Preview Environment Manager",397 description="Select which environment to use",398 default="texture environment")399 # Common settings400 bpy.types.World.OCT_use_power = BoolProperty(401 name="",402 description="Override OCS environment power value",403 default=False)404 bpy.types.World.OCT_power = FloatProperty(405 name="Power",406 description="Set OCS power value",407 min=0.0, max=1000.0, step=10.0, default=1.0)408 # Daylight409 bpy.types.World.OCT_active_light = StringProperty(410 name="Sun lamp",411 description="Set a Sun Light Source",412 maxlen=128,413 default="")414 bpy.types.World.OCT_use_turbidity = BoolProperty(415 name="",416 description="Override OCS turbidity power value",417 default=False)418 bpy.types.World.OCT_turbidity = FloatProperty(419 name="Turbidity",420 description="Set OCS turbidity value",421 min=0.0, max=16.0, step=1.0, default=2.20)422 bpy.types.World.OCT_use_northoffset = BoolProperty(423 name="",424 description="Override OCS northoffset power value",425 default=False)426 bpy.types.World.OCT_northoffset = FloatProperty(427 name="North Offset",428 description="Set OCS northoffset value",429 min=-1.0, max=1.0, step=1.0, default=0.0)430 # Texture431 bpy.types.World.OCT_texture_type = EnumProperty(432 items=(433 ("FLOAT", "Float", "Use Float Environment"),434 ("IMAGE", "Image", "Use Image Environment"),435 ),436 name="Texture type",437 description="Select which kind of texture to use",438 default="FLOAT")439 bpy.types.World.OCT_use_texture_float = BoolProperty(440 name="",441 description="Override OCS texture_float power value",442 default=False)443 bpy.types.World.OCT_texture_float = FloatProperty(444 name="Float",445 description="Set float value",446 min=0.0, max=1.0, step=1.0, default=1.0)447 bpy.types.World.OCT_use_texture_image = BoolProperty(448 name="",449 description="Override OCS texture_image power value",450 default=False)451 bpy.types.World.OCT_texture_image = StringProperty(452 name="Image File",453 description="Image will NOT be copied",454 maxlen=512,455 default="",456 subtype='FILE_PATH')457 bpy.types.World.OCT_use_texture_XY = BoolProperty(458 name="",459 description="Override OCS texture_X/Y value",460 default=False)461 bpy.types.World.OCT_texture_X = FloatProperty(462 name="X Rotation",463 description="Set OCS rotation X value",464 min=-1.0, max=1.0, step=1.0, precision=3, default=0.0)465 bpy.types.World.OCT_texture_Y = FloatProperty(466 name="Y Rotation",467 description="Set OCS rotation Y value",468 min=-1.0, max=1.0, step=1.0, precision=3, default=0.0)469# Mesh Preview Imager470 bpy.types.World.OCT_imager_use = BoolProperty(471 name="",472 description="Use Blender to drive Mesh Preview Imager",473 default=False)474 bpy.types.World.OCT_use_exposure = BoolProperty(475 name="",476 description="Override OCS exposure value",477 default=False)478 bpy.types.World.OCT_exposure = FloatProperty(479 name="Exposure",480 description="Set OCS exposure value",481 min=0.0, max=4096.0, step=1.0, precision=2, default=1.0)482 bpy.types.World.OCT_use_fstop = BoolProperty(483 name="",484 description="Override OCS fstop value",485 default=False)486 bpy.types.World.OCT_fstop = FloatProperty(487 name="F-Stop",488 description="Set OCS fstop value",489 min=0.0, max=64.0, step=1.0, precision=2, default=2.8)490 bpy.types.World.OCT_use_ISO = BoolProperty(491 name="",492 description="Override OCS ISO value",493 default=False)494 bpy.types.World.OCT_ISO = FloatProperty(495 name="ISO",496 description="Set OCS ISO value",497 min=1.0, max=800.0, step=100.0, precision=2, default=100.0)498 bpy.types.World.OCT_use_gamma = BoolProperty(499 name="",500 description="Override OCS gamma value",501 default=False)502 bpy.types.World.OCT_gamma = FloatProperty(503 name="Gamma",504 description="Set OCS gamma value",505 min=0.10, max=32.0, step=1.0, precision=2, default=1.0)506 bpy.types.World.OCT_use_response = BoolProperty(507 name="",508 description="Override OCS response value",509 default=False)510 bpy.types.World.OCT_response = EnumProperty(511 name="Response",512 description="Camera Response",513 items=(514 ("99", "Agfacolor Futura 100CD", ""),515 ("100", "Agfacolor Futura 200CD", ""),516 ("101", "Agfacolor Futura 400CD", ""),517 ("102", "Agfacolor Futura II 100CD", ""),518 ("103", "Agfacolor Futura II 200CD", ""),519 ("104", "Agfacolor Futura II 400CD", ""),520 ("105", "Agfacolor HDC 100 plusCD", ""),521 ("106", "Agfacolor HDC 200 plusCD", ""),522 ("107", "Agfacolor HDC 400 plusCD", ""),523 ("108", "Agfacolor Optima II 100CD", ""),524 ("109", "Agfacolor Optima II 200CD", ""),525 ("110", "Agfacolor ultra 050 CD", ""),526 ("111", "Agfacolor Vista 100CD", ""),527 ("112", "Agfacolor Vista 200CD", ""),528 ("113", "Agfacolor Vista 400CD", ""),529 ("114", "Agfacolor Vista 800CD", ""),530 ("115", "Agfachrome CT precisa 100CD", ""),531 ("116", "Agfachrome CT precisa 200CD", ""),532 ("117", "Agfachrome RSX2 050CD", ""),533 ("118", "Agfachrome RSX2 100CD", ""),534 ("119", "Agfachrome RSX2 200CD", ""),535 ("201", "Advantix 100CD", ""),536 ("202", "Advantix 200CD", ""),537 ("203", "Advantix 400CD", ""),538 ("204", "Gold 100CD", ""),539 ("205", "Gold 200CD", ""),540 ("206", "Max Zoom 800CD", ""),541 ("207", "Portra 100TCD", ""),542 ("208", "Portra 160NCCD", ""),543 ("209", "Portra 160VCCD", ""),544 ("210", "Portra 800CD", ""),545 ("211", "Portra 400VCCD", ""),546 ("212", "Portra 400NCCD", ""),547 ("213", "Ektachrome 100 plusCD", ""),548 ("214", "Ektachrome 320TCD", ""),549 ("215", "Ektachrome 400XCD", ""),550 ("216", "Ektachrome 64CD", ""),551 ("217", "Ektachrome 64TCD", ""),552 ("218", "Ektachrome E100SCD", ""),553 ("219", "Ektachrome 100CD", ""),554 ("220", "Kodachrome 200CD", ""),555 ("221", "Kodachrome 25", ""),556 ("222", "Kodachrome 64CD", ""),557 ("301", "F125CD", ""),558 ("302", "F250CD", ""),559 ("303", "F400CD", ""),560 ("304", "FCICD", ""),561 ("305", "dscs315_1", ""),562 ("306", "dscs315_2", ""),563 ("307", "dscs315_3", ""),564 ("308", "dscs315_4", ""),565 ("309", "dscs315_5", ""),566 ("310", "dscs315_6", ""),567 ("311", "FP2900Z", ""),568 ("400", "Linear/Off", ""),569 ),570 default="105")571 bpy.types.World.OCT_use_vignetting = BoolProperty(572 name="",573 description="Override OCS vignetting value",574 default=False)575 bpy.types.World.OCT_vignetting = FloatProperty(576 name="Vignetting",577 description="Set OCS vignetting value",578 min=0.0, max=1.0, step=1.0, precision=2, default=0.3)579 bpy.types.World.OCT_use_saturation = BoolProperty(580 name="",581 description="Override OCS saturation value",582 default=False)583 bpy.types.World.OCT_saturation = FloatProperty(584 name="Saturation",585 description="Set OCS saturation value",586 min=0.0, max=4.0, step=1.0, precision=2, default=1.0)587 bpy.types.World.OCT_use_hotpixel_removal = BoolProperty(588 name="",589 description="Override OCS hotpixel_removal value",590 default=False)591 bpy.types.World.OCT_hotpixel_removal = FloatProperty(592 name="Hotpixel Removal",593 description="Set OCS hotpixel_removal value",594 min=0.0, max=1.0, step=1.0, precision=2, default=1.0)595 bpy.types.World.OCT_use_premultiplied_alpha = BoolProperty(596 name="",597 description="Override OCS premultiplied_alpha value",598 default=False)599 bpy.types.World.OCT_premultiplied_alpha = EnumProperty(600 items=(601 ("true", "Enable Premult. Alpha", "Enable Premultiplied Alpha"),602 ("false", "Disable Premult. Alpha", "Disable Premultiplied Alpha"),603 ),604 name="Premultiplied Alpha",605 description="Set OCS premultiplied_alpha value",606 default="false")607# Add custom properties to Camera608 bpy.types.Camera.OCT_use_lens_aperture = BoolProperty(609 name=getLabel('lens_aperture'),610 description="Lens Aperture",611 default=False)612 bpy.types.Camera.OCT_lens_aperture = FloatProperty(613 attr="",614 name="Value",615 description="Value",616 min=0.01, max=100, step=100.0, default=1.0)617 bpy.types.Camera.OCT_use_camera_motion = BoolProperty(618 name="Camera motion",619 description="Use camera motion for animation",620 default=False)621 bpy.types.Camera.OCT_interpolate_frame = EnumProperty(622 name=getLabel('interpolate_frame'),623 description="Interpolate frame",624 items=(625 ("0", "Next Frame", ""),626 ("1", "Previous Frame", "")627 ),628 default="0")629# Add custom material properties630 bpy.types.Material.OCT_material_type = EnumProperty(631 name="Material type",632 description="Octane material type",633 items=(634 ("diffuse", "Diffuse", ""),635 ("glossy", "Glossy", ""),636 ("specular", "Specular", ""),637 ),638 default="glossy")639 bpy.types.Material.OCT_index = FloatProperty(640 name="Indice of Refraction",641 description="IOR",642 min=1.001, max=8.0, step=1.0, default=1.5, precision=3)643 bpy.types.Material.OCT_roughnessfloat = FloatProperty(644 name="Roughness",645 description="Roughness",646 min=0.0000001, max=1.0, step=1.0, default=0.001, precision=7)647 bpy.types.Material.OCT_filmwidth = FloatProperty(648 name="Film Width",649 description="Film Width",650 min=0.0, max=1.0, step=1.0, default=0.0, precision=3)651 bpy.types.Material.OCT_filmindex = FloatProperty(652 name="Film Index",653 description="Film Index",654 min=1.001, max=8.0, step=1.0, default=1.5, precision=3)655 bpy.types.Material.OCT_smooth = BoolProperty(656 name="Smooth",657 description="Smooth normals",658 default=True)659 bpy.types.Material.OCT_emitter_type = EnumProperty(660 name="Emitter type",661 description="Octane emitter type",662 items=(663 ("null emission", "null emission", ""),664 ("blackbody", "BlackBody", ""),665 ("texture", "Texture", ""),666 ),667 default="null emission")668 bpy.types.Material.OCT_temperature = FloatProperty(669 name="Temperature",670 description="Emitter Temperature",671 min=500, max=12000, step=1000.0, default=6250, precision=0)672 bpy.types.Material.OCT_power = FloatProperty(673 name="Power",674 description="Emitter Power",675 min=0.0, max=100.0, step=1.0, default=1.0)676 bpy.types.Material.OCT_normalize = BoolProperty(677 name="Normalize",678 description="Emitter Normalize",679 default=False)680 bpy.types.Material.OCT_diffuse = PointerProperty(type=OctaneTexture, name="diffuse", description="Octane Texture")681 bpy.types.Material.OCT_specular = PointerProperty(type=OctaneTexture, name="specular", description="Octane Texture")682 bpy.types.Material.OCT_bump = PointerProperty(type=OctaneTexture, name="bump", description="Octane Texture")683 bpy.types.Material.OCT_normal = PointerProperty(type=OctaneTexture, name="normal", description="Octane Texture")684 bpy.types.Material.OCT_opacity = PointerProperty(type=OctaneTexture, name="opacity", description="Octane Texture")685 bpy.types.Material.OCT_emission = PointerProperty(type=OctaneTexture, name="emission", description="Octane Texture")686 bpy.types.Material.OCT_roughness = PointerProperty(type=OctaneTexture, name="roughness", description="Octane Texture")687 OctaneTexture.diffuse = EnumProperty(688 name="Diffuse",689 description="Octane texture type",690 items=(691 ("RGBspectrum", "RGBspectrum", ""),692 ("image", "image", ""),693 ("alphaimage", "alphaimage", ""),694 ("floatimage", "floatimage", ""),695 ),696 default="RGBspectrum")697 OctaneTexture.specular = EnumProperty(698 name="Specular",699 description="Octane texture type",700 items=(701 ("RGBspectrum", "RGBspectrum", ""),702 ("image", "image", ""),703 ("alphaimage", "alphaimage", ""),704 ("floatimage", "floatimage", ""),705 ("floattexture", "floattexture", ""),706 ),707 default="RGBspectrum")708 OctaneTexture.bump = EnumProperty(709 name="Bump input",710 description="Octane texture type",711 items=(712 ("none", "none", ""),713 ("floatimage", "floatimage", ""),714 ),715 default="none")716 OctaneTexture.normal = EnumProperty(717 name="Normal input",718 description="Octane texture type",719 items=(720 ("none", "none", ""),721 ("image", "image", ""),722 ),723 default="none")724 OctaneTexture.opacity = EnumProperty(725 name="Opacity input",726 description="Octane texture type",727 items=(728 ("image", "image", ""),729 ("alphaimage", "alphaimage", ""),730 ("floatimage", "floatimage", ""),731 ("floattexture", "floattexture", ""),732 ),733 default="floattexture")734 OctaneTexture.emission = EnumProperty(735 name="Texture type",736 description="Octane texture type",737 items=(738 ("image", "image", ""),739 ("alphaimage", "alphaimage", ""),740 ("floatimage", "floatimage", ""),741 ("RGBspectrum", "RGBspectrum", ""),742 ),743 default="RGBspectrum")744 OctaneTexture.roughness = EnumProperty(745 name="Texture type",746 description="Octane texture type",747 items=(748 ("image", "image", ""),749 ("alphaimage", "alphaimage", ""),750 ("floatimage", "floatimage", ""),751 ("floattexture", "floattexture", ""),752 ),753 default="floattexture")754 OctaneTexture.floattexture = FloatProperty(755 name="Float",756 description="Float",757 min=0.0, max=1.0, step=1, default=1.0)758 OctaneTexture.texture = StringProperty(759 name="Texture",760 description="Octane texture",761 maxlen=128,762 default="")763 OctaneTexture.power = FloatProperty(764 name="Power",765 description="Power",766 min=0.0, max=1.0, step=1, default=1.0)767 OctaneTexture.gamma = FloatProperty(768 name="Gamma",769 description="Gamma",770 min=0.1, max=8.0, step=10, default=2.2)771 OctaneTexture.scale = FloatProperty(772 name="Scale",773 description="Scale",774 min=0.0, max=1000.0, step=10, default=1.0)775 OctaneTexture.invert = BoolProperty(776 name="Invert",777 description="Invert",778 default=False)779 #bpy.types.Material.OctaneTexture = CollectionProperty(type=OctaneTexture)780 # bpy.utils.register_class(OctaneTexture)781 #bpy.types.Material.OCT_diffuse = OctaneTexture("Diffuse")782 #bpy.types.Material.OCT_diffuse = PointerProperty(type=OctaneTexture)783 #OCT_dif = CollectionProperty(name="Diffuse", type=OctaneTexture)784 #bpy.types.Material.OCT_diffuse = PointerProperty(name="OCT_d", type=OCT_dif)785 #~ bpy.types.Material.OCT_specular = PointerProperty(type=OctaneTexture, name="OCT_s")786 #~ bpy.types.Material.OCT_normal = PointerProperty(type=OctaneTexture, name="OCT_n")787 #~ bpy.types.Material.OCT_bump = PointerProperty(type=OctaneTexture, name="OCT_b")788 #~ bpy.types.Material.OCT_opacity = PointerProperty(type=OctaneTexture, name="OCT_o")789 #~ bpy.types.Material.OCT_emitter = PointerProperty(type=OctaneTexture, name="OCT_e")790def register():791 bpy.utils.register_module(__name__)792def unregister():793 del bpy.types.Material.OCT_diffuse794 del bpy.types.Material.OCT_specular795 del bpy.types.Material.OCT_normal796 del bpy.types.Material.OCT_bump797 del bpy.types.Material.OCT_opacity798 del bpy.types.Material.OCT_emission...
extract_actions_test.py
Source:extract_actions_test.py
...246 return extract_actions.PrettyPrint(actions, actions_dict, comments)247 def testNoOwner(self):248 xml_result = self._GetProcessedAction(NO_VALUE, DESCRIPTION, NO_VALUE)249 self.assertEqual(NO_OWNER_EXPECTED_XML, xml_result)250 def testOneOwnerOneDescription(self):251 xml_result = self._GetProcessedAction(ONE_OWNER, DESCRIPTION, NO_VALUE)252 self.assertEqual(ONE_OWNER_EXPECTED_XML, xml_result)253 def testTwoOwners(self):254 xml_result = self._GetProcessedAction(TWO_OWNERS, DESCRIPTION, NO_VALUE)255 self.assertEqual(TWO_OWNERS_EXPECTED_XML, xml_result)256 def testNoDescription(self):257 xml_result = self._GetProcessedAction(TWO_OWNERS, NO_VALUE, NO_VALUE)258 self.assertEqual(NO_DESCRIPTION_EXPECTED_XML, xml_result)259 def testTwoDescriptions(self):260 current_xml = ACTIONS_XML.format(owners=TWO_OWNERS, obsolete=NO_VALUE,261 description=TWO_DESCRIPTIONS,262 comment=NO_VALUE,263 not_user_triggered=NO_VALUE)264 # Since there are two description tags, the function ParseActionFile will265 # raise SystemExit with exit code 1.266 with self.assertRaises(SystemExit) as cm:267 _, _ = extract_actions.ParseActionFile(current_xml)268 self.assertEqual(cm.exception.code, 1)269 def testObsolete(self):270 xml_result = self._GetProcessedAction(TWO_OWNERS, DESCRIPTION, OBSOLETE)...
conditionals_multiple.py
Source:conditionals_multiple.py
1#!/usr/bin/python2# Copyright 2008 Jurko Gospodnetic3# Distributed under the Boost Software License, Version 1.0.4# (See accompanying file LICENSE_1_0.txt or copy at5# http://www.boost.org/LICENSE_1_0.txt)6# Tests that properties conditioned on more than one other property work as7# expected.8import BoostBuild9###############################################################################10#11# test_multiple_conditions()12# --------------------------13#14###############################################################################15def test_multiple_conditions():16 """Basic tests for properties conditioned on multiple other properties."""17 t = BoostBuild.Tester(["--user-config=", "--ignore-site-config",18 "toolset=testToolset"], pass_toolset=False, use_test_config=False)19 t.write("testToolset.jam", """\20import feature ;21feature.extend toolset : testToolset ;22rule init ( ) { }23""")24 t.write("testToolset.py", """\25from b2.build import feature26feature.extend('toolset', ["testToolset"])27def init ( ): pass28""")29 t.write("jamroot.jam", """\30import feature ;31import notfile ;32import toolset ;33feature.feature description : : free incidental ;34feature.feature aaa : 1 0 : incidental ;35feature.feature bbb : 1 0 : incidental ;36feature.feature ccc : 1 0 : incidental ;37rule buildRule ( name : targets ? : properties * )38{39 for local description in [ feature.get-values description : $(properties) ]40 {41 ECHO "description:" /$(description)/ ;42 }43}44notfile testTarget1 : @buildRule : :45 <description>d46 <aaa>0:<description>a047 <aaa>1:<description>a148 <aaa>0,<bbb>0:<description>a0-b049 <aaa>0,<bbb>1:<description>a0-b150 <aaa>1,<bbb>0:<description>a1-b051 <aaa>1,<bbb>1:<description>a1-b152 <aaa>0,<bbb>0,<ccc>0:<description>a0-b0-c053 <aaa>0,<bbb>0,<ccc>1:<description>a0-b0-c154 <aaa>0,<bbb>1,<ccc>1:<description>a0-b1-c155 <aaa>1,<bbb>0,<ccc>1:<description>a1-b0-c156 <aaa>1,<bbb>1,<ccc>0:<description>a1-b1-c057 <aaa>1,<bbb>1,<ccc>1:<description>a1-b1-c1 ;58""")59 t.run_build_system(["aaa=1", "bbb=1", "ccc=1"])60 t.expect_output_lines("description: /d/" )61 t.expect_output_lines("description: /a0/" , False)62 t.expect_output_lines("description: /a1/" )63 t.expect_output_lines("description: /a0-b0/" , False)64 t.expect_output_lines("description: /a0-b1/" , False)65 t.expect_output_lines("description: /a1-b0/" , False)66 t.expect_output_lines("description: /a1-b1/" )67 t.expect_output_lines("description: /a0-b0-c0/", False)68 t.expect_output_lines("description: /a0-b0-c1/", False)69 t.expect_output_lines("description: /a0-b1-c1/", False)70 t.expect_output_lines("description: /a1-b0-c1/", False)71 t.expect_output_lines("description: /a1-b1-c0/", False)72 t.expect_output_lines("description: /a1-b1-c1/" )73 t.run_build_system(["aaa=0", "bbb=0", "ccc=1"])74 t.expect_output_lines("description: /d/" )75 t.expect_output_lines("description: /a0/" )76 t.expect_output_lines("description: /a1/" , False)77 t.expect_output_lines("description: /a0-b0/" )78 t.expect_output_lines("description: /a0-b1/" , False)79 t.expect_output_lines("description: /a1-b0/" , False)80 t.expect_output_lines("description: /a1-b1/" , False)81 t.expect_output_lines("description: /a0-b0-c0/", False)82 t.expect_output_lines("description: /a0-b0-c1/" )83 t.expect_output_lines("description: /a0-b1-c1/", False)84 t.expect_output_lines("description: /a1-b0-c1/", False)85 t.expect_output_lines("description: /a1-b1-c0/", False)86 t.expect_output_lines("description: /a1-b1-c1/", False)87 t.run_build_system(["aaa=0", "bbb=0", "ccc=0"])88 t.expect_output_lines("description: /d/" )89 t.expect_output_lines("description: /a0/" )90 t.expect_output_lines("description: /a1/" , False)91 t.expect_output_lines("description: /a0-b0/" )92 t.expect_output_lines("description: /a0-b1/" , False)93 t.expect_output_lines("description: /a1-b0/" , False)94 t.expect_output_lines("description: /a1-b1/" , False)95 t.expect_output_lines("description: /a0-b0-c0/" )96 t.expect_output_lines("description: /a0-b0-c1/", False)97 t.expect_output_lines("description: /a0-b1-c1/", False)98 t.expect_output_lines("description: /a1-b0-c1/", False)99 t.expect_output_lines("description: /a1-b1-c0/", False)100 t.expect_output_lines("description: /a1-b1-c1/", False)101 t.cleanup()102###############################################################################103#104# test_multiple_conditions_with_toolset_version()105# -----------------------------------------------106#107###############################################################################108def test_multiple_conditions_with_toolset_version():109 """110 Regression tests for properties conditioned on the toolset version111 subfeature and some additional properties.112 """113 toolset = "testToolset" ;114 t = BoostBuild.Tester(["--user-config=", "--ignore-site-config"],115 pass_toolset=False, use_test_config=False)116 t.write(toolset + ".jam", """\117import feature ;118feature.extend toolset : %(toolset)s ;119feature.subfeature toolset %(toolset)s : version : 0 1 ;120rule init ( version ? ) { }121""" % {"toolset": toolset})122 t.write("testToolset.py", """\123from b2.build import feature124feature.extend('toolset', ["%(toolset)s"])125feature.subfeature('toolset', "%(toolset)s", "version", ['0','1'])126def init (version=''): pass127""" % {"toolset": toolset})128 t.write("jamroot.jam", """\129import feature ;130import notfile ;131import toolset ;132toolset.using testToolset ;133feature.feature description : : free incidental ;134feature.feature aaa : 0 1 : incidental ;135feature.feature bbb : 0 1 : incidental ;136feature.feature ccc : 0 1 : incidental ;137rule buildRule ( name : targets ? : properties * )138{139 local ttt = [ feature.get-values toolset : $(properties) ] ;140 local vvv = [ feature.get-values toolset-testToolset:version : $(properties) ] ;141 local aaa = [ feature.get-values aaa : $(properties) ] ;142 local bbb = [ feature.get-values bbb : $(properties) ] ;143 local ccc = [ feature.get-values ccc : $(properties) ] ;144 ECHO "toolset:" /$(ttt)/ "version:" /$(vvv)/ "aaa/bbb/ccc:" /$(aaa)/$(bbb)/$(ccc)/ ;145 for local description in [ feature.get-values description : $(properties) ]146 {147 ECHO "description:" /$(description)/ ;148 }149}150notfile testTarget1 : @buildRule : :151 <toolset>testToolset,<aaa>0:<description>t-a0152 <toolset>testToolset,<aaa>1:<description>t-a1153 <toolset>testToolset-0,<aaa>0:<description>t0-a0154 <toolset>testToolset-0,<aaa>1:<description>t0-a1155 <toolset>testToolset-1,<aaa>0:<description>t1-a0156 <toolset>testToolset-1,<aaa>1:<description>t1-a1157 <toolset>testToolset,<aaa>0,<bbb>0:<description>t-a0-b0158 <toolset>testToolset,<aaa>0,<bbb>1:<description>t-a0-b1159 <toolset>testToolset,<aaa>1,<bbb>0:<description>t-a1-b0160 <toolset>testToolset,<aaa>1,<bbb>1:<description>t-a1-b1161 <aaa>0,<toolset>testToolset,<bbb>0:<description>a0-t-b0162 <aaa>0,<toolset>testToolset,<bbb>1:<description>a0-t-b1163 <aaa>1,<toolset>testToolset,<bbb>0:<description>a1-t-b0164 <aaa>1,<toolset>testToolset,<bbb>1:<description>a1-t-b1165 <aaa>0,<bbb>0,<toolset>testToolset:<description>a0-b0-t166 <aaa>0,<bbb>1,<toolset>testToolset:<description>a0-b1-t167 <aaa>1,<bbb>0,<toolset>testToolset:<description>a1-b0-t168 <aaa>1,<bbb>1,<toolset>testToolset:<description>a1-b1-t169 <toolset>testToolset-0,<aaa>0,<bbb>0:<description>t0-a0-b0170 <toolset>testToolset-0,<aaa>0,<bbb>1:<description>t0-a0-b1171 <toolset>testToolset-0,<aaa>1,<bbb>0:<description>t0-a1-b0172 <toolset>testToolset-0,<aaa>1,<bbb>1:<description>t0-a1-b1173 <toolset>testToolset-1,<aaa>0,<bbb>0:<description>t1-a0-b0174 <toolset>testToolset-1,<aaa>0,<bbb>1:<description>t1-a0-b1175 <toolset>testToolset-1,<aaa>1,<bbb>0:<description>t1-a1-b0176 <toolset>testToolset-1,<aaa>1,<bbb>1:<description>t1-a1-b1177 <aaa>0,<toolset>testToolset-1,<bbb>0:<description>a0-t1-b0178 <aaa>0,<toolset>testToolset-1,<bbb>1:<description>a0-t1-b1179 <aaa>1,<toolset>testToolset-0,<bbb>0:<description>a1-t0-b0180 <aaa>1,<toolset>testToolset-0,<bbb>1:<description>a1-t0-b1181 <bbb>0,<aaa>1,<toolset>testToolset-0:<description>b0-a1-t0182 <bbb>0,<aaa>0,<toolset>testToolset-1:<description>b0-a0-t1183 <bbb>0,<aaa>1,<toolset>testToolset-1:<description>b0-a1-t1184 <bbb>1,<aaa>0,<toolset>testToolset-1:<description>b1-a0-t1185 <bbb>1,<aaa>1,<toolset>testToolset-0:<description>b1-a1-t0186 <bbb>1,<aaa>1,<toolset>testToolset-1:<description>b1-a1-t1 ;187""")188 t.run_build_system(["aaa=1", "bbb=1", "ccc=1", "toolset=%s-0" % toolset])189 t.expect_output_lines("description: /t-a0/" , False)190 t.expect_output_lines("description: /t-a1/" )191 t.expect_output_lines("description: /t0-a0/" , False)192 t.expect_output_lines("description: /t0-a1/" )193 t.expect_output_lines("description: /t1-a0/" , False)194 t.expect_output_lines("description: /t1-a1/" , False)195 t.expect_output_lines("description: /t-a0-b0/" , False)196 t.expect_output_lines("description: /t-a0-b1/" , False)197 t.expect_output_lines("description: /t-a1-b0/" , False)198 t.expect_output_lines("description: /t-a1-b1/" )199 t.expect_output_lines("description: /a0-t-b0/" , False)200 t.expect_output_lines("description: /a0-t-b1/" , False)201 t.expect_output_lines("description: /a1-t-b0/" , False)202 t.expect_output_lines("description: /a1-t-b1/" )203 t.expect_output_lines("description: /a0-b0-t/" , False)204 t.expect_output_lines("description: /a0-b1-t/" , False)205 t.expect_output_lines("description: /a1-b0-t/" , False)206 t.expect_output_lines("description: /a1-b1-t/" )207 t.expect_output_lines("description: /t0-a0-b0/", False)208 t.expect_output_lines("description: /t0-a0-b1/", False)209 t.expect_output_lines("description: /t0-a1-b0/", False)210 t.expect_output_lines("description: /t0-a1-b1/" )211 t.expect_output_lines("description: /t1-a0-b0/", False)212 t.expect_output_lines("description: /t1-a0-b1/", False)213 t.expect_output_lines("description: /t1-a1-b0/", False)214 t.expect_output_lines("description: /t1-a1-b1/", False)215 t.expect_output_lines("description: /a0-t1-b0/", False)216 t.expect_output_lines("description: /a0-t1-b1/", False)217 t.expect_output_lines("description: /a1-t0-b0/", False)218 t.expect_output_lines("description: /a1-t0-b1/" )219 t.expect_output_lines("description: /b0-a1-t0/", False)220 t.expect_output_lines("description: /b0-a0-t1/", False)221 t.expect_output_lines("description: /b0-a1-t1/", False)222 t.expect_output_lines("description: /b1-a0-t1/", False)223 t.expect_output_lines("description: /b1-a1-t0/" )224 t.expect_output_lines("description: /b1-a1-t1/", False)225 t.run_build_system(["aaa=1", "bbb=1", "ccc=1", "toolset=%s-1" % toolset])226 t.expect_output_lines("description: /t-a0/" , False)227 t.expect_output_lines("description: /t-a1/" )228 t.expect_output_lines("description: /t0-a0/" , False)229 t.expect_output_lines("description: /t0-a1/" , False)230 t.expect_output_lines("description: /t1-a0/" , False)231 t.expect_output_lines("description: /t1-a1/" )232 t.expect_output_lines("description: /t-a0-b0/" , False)233 t.expect_output_lines("description: /t-a0-b1/" , False)234 t.expect_output_lines("description: /t-a1-b0/" , False)235 t.expect_output_lines("description: /t-a1-b1/" )236 t.expect_output_lines("description: /a0-t-b0/" , False)237 t.expect_output_lines("description: /a0-t-b1/" , False)238 t.expect_output_lines("description: /a1-t-b0/" , False)239 t.expect_output_lines("description: /a1-t-b1/" )240 t.expect_output_lines("description: /a0-b0-t/" , False)241 t.expect_output_lines("description: /a0-b1-t/" , False)242 t.expect_output_lines("description: /a1-b0-t/" , False)243 t.expect_output_lines("description: /a1-b1-t/" )244 t.expect_output_lines("description: /t0-a0-b0/", False)245 t.expect_output_lines("description: /t0-a0-b1/", False)246 t.expect_output_lines("description: /t0-a1-b0/", False)247 t.expect_output_lines("description: /t0-a1-b1/", False)248 t.expect_output_lines("description: /t1-a0-b0/", False)249 t.expect_output_lines("description: /t1-a0-b1/", False)250 t.expect_output_lines("description: /t1-a1-b0/", False)251 t.expect_output_lines("description: /t1-a1-b1/" )252 t.expect_output_lines("description: /a0-t1-b0/", False)253 t.expect_output_lines("description: /a0-t1-b1/", False)254 t.expect_output_lines("description: /a1-t0-b0/", False)255 t.expect_output_lines("description: /a1-t0-b1/", False)256 t.expect_output_lines("description: /b0-a1-t0/", False)257 t.expect_output_lines("description: /b0-a0-t1/", False)258 t.expect_output_lines("description: /b0-a1-t1/", False)259 t.expect_output_lines("description: /b1-a0-t1/", False)260 t.expect_output_lines("description: /b1-a1-t0/", False)261 t.expect_output_lines("description: /b1-a1-t1/" )262 t.cleanup()263###############################################################################264#265# main()266# ------267#268###############################################################################269test_multiple_conditions()...
html_generate.py
Source:html_generate.py
1import sys2import re3class SpaceType:4 """ storage structure info"""5 def __init__(self):6 self.space_type = "input"7 self.num = 08 self.temp_array = {0: [" ", " ", " ", " "], }9 self.in_array = {0: [" ", " ", " ", " "], }10 self.var_array = {0: [" ", " ", " ", " "], }11 self.out_array = {0: [" ", " ", " ", " "], }12 def add_var(self, name, type_var, size, description):13 self.temp_array[self.num] = [name, type_var, size, description]14 self.num += 115 def del_var_info(self):16 self.temp_array = {0: [" ", " ", " ", " "], }17 self.in_array = {0: [" ", " ", " ", " "], }18 self.var_array = {0: [" ", " ", " ", " "], }19 self.out_array = {0: [" ", " ", " ", " "], }20HTML_DOCTYPE = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">'21HTML_NAME = '<html><head><title>fb describe</title>'22HTML_CHARSET = '<meta charset="cp1251">'23HTML_CONTENT = '<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">'24HTML_CONTENT_NAME = '<meta content="MSHTML 6.00.2900.3698" name="GENERATOR">'25HTML_STYLE = '<style></style><!-- saved from url=(0038)http://192.168.1.232/sp.shtml --></head>'26HTML_TABLE_OPEN = '<table style="width: 961px; height: 30px;" border="1" cellpadding="1" cellspacing="1">'27def main():28 """build fb description """29 fb_name = open('fb_name.txt', 'w')30 fb_html_describe = open('html_describe.html', 'w')31 fb_html_describe.write(HTML_DOCTYPE)32 fb_html_describe.write(HTML_NAME)33 fb_html_describe.write(HTML_CHARSET)34 fb_html_describe.write(HTML_CONTENT)35 fb_html_describe.write(HTML_CONTENT_NAME)36 fb_html_describe.write(HTML_STYLE)37 fb_html_describe.write('<body>'+'\n')38 fb_name.write('Number FB and Name\n')39 current = 040 start_structure = 041 while 1:42 current += 143 if current == 108:44 fb_html_describe.write('</table>'+'\n')45 fb_html_describe.write('</body></html>')46 sys.exit(1)47 try:48 if current <= 9:49 fb_temp = open('FB/fb0000'+str(current)+'.h')50 elif current <= 99:51 fb_temp = open('FB/fb000'+str(current)+'.h')52 else:53 fb_temp = open('FB/fb00'+str(current)+'.h')54 except IOError:55 continue56 description_structure = SpaceType()57 line_number = 058 for line_full in fb_temp:59 try:60 if line_number == 0:61 fb_name.write(fb_temp.name+'\n')62 if (len(line_full)) > 2 & (line_full[0] == '/') & (line_full[1] == '*'):63 fb_html_describe.write('<table style="width: 961px; height: 30px;" '64 'border="1" cellspacing="1">'+'\n')65 fb_html_describe.write('<tr>'+'\n')66 fb_html_describe.write('<td style="font-weight:font-style:italic;font-family:Verdana;'67 'background-color:rgb(0,251,213);"><small><span style="color:black;">'+'\n')68 fb_html_describe.write(fb_temp.name+line_full+'</span> </small></td>')69 fb_html_describe.write('</tr>'+'\n')70 fb_name.write(line_full)71 else:72 fb_name.write("didn't find description")73 if '//' in line_full:74 start = line_full.find('//')75 line = line_full[:start]76 else:77 line = line_full78 if start_structure == 0:79 p = re.compile('^\s*typedef\s*(volatile)?\s*struct\W')80 if p.match(line):81 start_structure = 182 else:83 if start_structure == 1 & ('}'in line):84 p_type = re.compile('^\s*\}\s*((fb)|(FB))(?P<number>[\d]{5})_(?P<type>[\w]{2,3})_type')85 structure_close = p_type.match(line)86 if structure_close:87 l = p_type.search(line)88 description_structure.space_type = l.group('type')89 if description_structure.space_type == 'IN':90 for l in range(description_structure.num):91 description_structure.in_array[l] = description_structure.temp_array[l]92 elif description_structure.space_type == 'VAR':93 for l in range(description_structure.num):94 description_structure.var_array[l] = description_structure.temp_array[l]95 elif description_structure.space_type == 'OUT':96 for l in range(description_structure.num):97 description_structure.out_array[l] = description_structure.temp_array[l]98 #write struct type99 fb_name.write(description_structure.space_type+'\n')100 for j in range(description_structure.num):101 fb_name.write(description_structure.temp_array[j][0]+' '102 + description_structure.temp_array[j][1])103 if description_structure.temp_array[j][2]:104 fb_name.write(description_structure.temp_array[j][2]+' ')105 if description_structure.temp_array[j][3]:106 fb_name.write(description_structure.temp_array[j][3]+' ')107 fb_name.write('\n')108 else:109 fb_name.write("type_structure_error"+line)110 start_structure = 0111 description_structure.num = 0112 else:113 p_var = re.compile('^\s*Register_type\s+(?P<name>[\w\d]+)\s*(?P<size>\[[\d\w]+\])?\s*;'114 '\s*(//)?\s*(?P<type>[bit,int,uint,\d,/]*)\s*(?P<description>[\w\W]*$)')115 l = p_var.match(line_full)116 if l:117 r = p_var.search(line_full)118 description_structure.add_var(r.group('name'), r.group('type'),119 r.group('size'), r.group('description'))120 except IndexError:121 break122 line_number += 1123 lenght = len(description_structure.in_array)124 if len(description_structure.var_array) > lenght:125 lenght = len(description_structure.var_array)126 if len(description_structure.out_array) > lenght:127 lenght = len(description_structure.out_array)128 for i in range(lenght):129 fb_html_describe.write('<tr>'+'\n')130 fb_html_describe.write('<td ><small><span style="color:black;">'+'\n')131 if i < len(description_structure.in_array):132 if description_structure.in_array[i][0]:133 fb_html_describe.write(description_structure.in_array[i][0]+' ')134 if description_structure.in_array[i][1]:135 fb_html_describe.write(description_structure.in_array[i][1]+' ')136 if description_structure.in_array[i][2]:137 fb_html_describe.write(description_structure.in_array[i][2]+' ')138 if description_structure.in_array[i][3]:139 fb_html_describe.write(description_structure.in_array[i][3]+' ')140 fb_html_describe.write('</span> </small></td>')141 fb_html_describe.write('<td ><small><span style="color:black;">'+'\n')142 if i < len(description_structure.var_array):143 if description_structure.var_array[i][0]:144 fb_html_describe.write(description_structure.var_array[i][0]+' ')145 if description_structure.var_array[i][1]:146 fb_html_describe.write(description_structure.var_array[i][1]+' ')147 if description_structure.var_array[i][2]:148 fb_html_describe.write(description_structure.var_array[i][2]+' ')149 if description_structure.var_array[i][3]:150 fb_html_describe.write(description_structure.var_array[i][3]+' ')151 fb_html_describe.write('</span> </small></td>')152 fb_html_describe.write('<td ><small><span style="color:black;">'+'\n')153 if i < len(description_structure.out_array):154 if description_structure.out_array[i][0]:155 fb_html_describe.write(description_structure.out_array[i][0]+' ')156 if description_structure.out_array[i][1]:157 fb_html_describe.write(description_structure.out_array[i][1]+' ')158 if description_structure.out_array[i][2]:159 fb_html_describe.write(description_structure.out_array[i][2]+' ')160 if description_structure.out_array[i][3]:161 fb_html_describe.write(description_structure.out_array[i][3]+' ')162 fb_html_describe.write('</span> </small></td>')163 fb_html_describe.write('</tr>'+'\n')164 description_structure.del_var_info()165def int_to_char(cmd_x):166 """char to string array confersion"""167 i = 0168 cmd_r = ['~']169 while (i<len(cmd_x)):170 cmd_r += chr(int(cmd_x[i]))171 i+=1172 return cmd_r[1:]173def char_to_int(cmd_x,lenth):174 """char to string array confersion"""175 i = 0176 cmd_r = [0 for x in range(lenth)]177 while (i<lenth):178 cmd_r[i]=ord(cmd_x[i])179 i+=1180 return cmd_r181def print_hex(cmd,lenth):182 i = 0183 hexf=[0 for x in range(lenth)]184 while (i<lenth):185 hexf[i] = (hex(cmd[i]))186 i+=1187 print (hexf)188if __name__ == "__main__":...
constants_css_microsoft_extensions.py
Source:constants_css_microsoft_extensions.py
1"""2Microsoft CSS extensions.3"""4import textwrap5### START: Auto generated6CSS_MICROSOFT_DATA = {7 '-ms-accelerator': {8 'description': "Extension",9 },10 '-ms-background-position-x': {11 'description': "CSS3 - Working Draft",12 },13 '-ms-background-position-y': {14 'description': "CSS3 - Working Draft",15 },16 '-ms-behavior': {17 'description': "Extension",18 },19 '-ms-block-progression': {20 'description': "CSS3 - Editor's Draft",21 },22 '-ms-filter': {23 'description': "Extension - Sets or retrieves the filter or collection of filters applied to the object.",24 'values': {25 'progid:DXImageTransform.Microsoft.Alpha': "Adjusts the opacity of the content of the object.",26 'progid:DXImageTransform.Microsoft.BasicImage': "Adjusts the color processing, image rotation, or opacity of the content of the object.",27 'progid:DXImageTransform.Microsoft.Blur': "Blurs the content of the object so that it appears out of focus.",28 'progid:DXImageTransform.Microsoft.Chroma': "Displays a specific color of the content of the object as transparent.",29 'progid:DXImageTransform.Microsoft.Compositor': "Displays new content of the object as a logical color combination of the new and original content. The color and alpha values of each version of the content are evaluated to determine the final color on the output image.",30 'progid:DXImageTransform.Microsoft.DropShadow': "Creates a solid silhouette of the content of the object, offset in the specified direction. This creates the illusion that the content is floating and casting a shadow.",31 'progid:DXImageTransform.Microsoft.Emboss': "Displays the content of the object as an embossed texture using grayscale values.",32 'progid:DXImageTransform.Microsoft.Engrave': "Displays the content of the object as an engraved texture using grayscale values.",33 'progid:DXImageTransform.Microsoft.Glow': "Adds radiance around the outside edges of the content of the object so that it appears to glow.",34 'progid:DXImageTransform.Microsoft.ICMFilter': "Converts the color content of the object based on an Image Color Management (ICM) profile. This enables improved display of specific content, or simulated display for hardware devices, such as printers or monitors.",35 'progid:DXImageTransform.Microsoft.Light': "Creates the effect of a light shining on the content of the object.",36 'progid:DXImageTransform.Microsoft.MaskFilter': "Displays transparent pixels of the object content as a color mask, and makes the nontransparent pixels transparent.",37 'progid:DXImageTransform.Microsoft.Matrix': "Resizes, rotates, or reverses the content of the object using matrix transformation.",38 'progid:DXImageTransform.Microsoft.MotionBlur': "Causes the content of the object to appear to be in motion.",39 'progid:DXImageTransform.Microsoft.Shadow': "Creates a solid silhouette of the content of the object, offset in the specified direction. This creates the illusion of a shadow.",40 'progid:DXImageTransform.Microsoft.Wave': "Performs a sine wave distortion of the content of the object along the vertical axis.",41 }42 },43 '-ms-ime-mode': {44 'description': "Extension",45 },46 '-ms-layout-grid': {47 'description': "CSS3 - Editor's Draft",48 },49 '-ms-layout-grid-char': {50 'description': "CSS3 - Editor's Draft",51 },52 '-ms-layout-grid-line': {53 'description': "CSS3 - Editor's Draft",54 },55 '-ms-layout-grid-mode': {56 'description': "CSS3 - Editor's Draft",57 },58 '-ms-layout-grid-type': {59 'description': "CSS3 - Editor's Draft",60 },61 '-ms-line-break': {62 'description': "CSS3 - Working Draft",63 },64 '-ms-line-grid-mode': {65 'description': "CSS3 - Editor's Draft",66 },67 '-ms-interpolation-mode': {68 'description': "Extension",69 },70 '-ms-overflow-x': {71 'description': "CSS3 - Working Draft",72 },73 '-ms-overflow-y': {74 'description': "CSS3 - Working Draft",75 },76 '-ms-scrollbar-3dlight-color': {77 'description': "Extension",78 },79 '-ms-scrollbar-arrow-color': {80 'description': "Extension",81 },82 '-ms-scrollbar-base-color': {83 'description': "Extension",84 },85 '-ms-scrollbar-darkshadow-color': {86 'description': "Extension",87 },88 '-ms-scrollbar-face-color': {89 'description': "Extension",90 },91 '-ms-scrollbar-highlight-color': {92 'description': "Extension",93 },94 '-ms-scrollbar-shadow-color': {95 'description': "Extension",96 },97 '-ms-scrollbar-track-color': {98 'description': "Extension",99 },100 '-ms-text-align-last': {101 'description': "CSS3 - Working Draft",102 },103 '-ms-text-autospace': {104 'description': "CSS3 - Working Draft",105 },106 '-ms-text-justify': {107 'description': "CSS3 - Working Draft",108 },109 '-ms-text-kashida-space': {110 'description': "CSS3 - Working Draft",111 },112 '-ms-text-overflow': {113 'description': "CSS3 - Working Draft",114 },115 '-ms-text-underline-position': {116 'description': "Extension",117 },118 '-ms-word-break': {119 'description': "CSS3 - Working Draft",120 },121 '-ms-word-wrap': {122 'description': "CSS3 - Working Draft",123 },124 '-ms-writing-mode': {125 'description': "CSS3 - Editor's Draft",126 },127 '-ms-zoom': {128 'description': "Extension",129 },130}131### END: Auto generated132CSS_MICROSOFT_SPECIFIC_ATTRS_DICT = {}133CSS_MICROSOFT_SPECIFIC_CALLTIP_DICT = {}134for attr, details in CSS_MICROSOFT_DATA.items():135 values = details.get("values", {})136 versions = details.get("versions", [])137 attr_completions = sorted(values.keys())138 if attr_completions:139 CSS_MICROSOFT_SPECIFIC_ATTRS_DICT[attr] = attr_completions140 else:141 CSS_MICROSOFT_SPECIFIC_ATTRS_DICT[attr] = None142 description = details.get("description", '')143 if versions:144 description += "\nVersions: %s\n" % (", ".join(versions))145 if description:146 desc_lines = textwrap.wrap(description, width=60)147 if values:148 desc_lines.append("")149 for value, attr_desc in values.items():150 attr_desc = " %r: %s" % (value, attr_desc)151 attr_desc_lines = textwrap.wrap(attr_desc, width=50)152 for i in range(len(attr_desc_lines)):153 attr_line = attr_desc_lines[i]154 if i > 0:155 attr_line = " " + attr_line156 desc_lines.append(attr_line)...
errors.py
Source:errors.py
1"""Exception classes.2@sort: TLSError, TLSAbruptCloseError, TLSAlert, TLSLocalAlert, TLSRemoteAlert,3TLSAuthenticationError, TLSNoAuthenticationError, TLSAuthenticationTypeError,4TLSFingerprintError, TLSAuthorizationError, TLSValidationError, TLSFaultError5"""6from constants import AlertDescription, AlertLevel7class TLSError(Exception):8 """Base class for all TLS Lite exceptions."""9 pass10class TLSAbruptCloseError(TLSError):11 """The socket was closed without a proper TLS shutdown.12 The TLS specification mandates that an alert of some sort13 must be sent before the underlying socket is closed. If the socket14 is closed without this, it could signify that an attacker is trying15 to truncate the connection. It could also signify a misbehaving16 TLS implementation, or a random network failure.17 """18 pass19class TLSAlert(TLSError):20 """A TLS alert has been signalled."""21 pass22 _descriptionStr = {\23 AlertDescription.close_notify: "close_notify",\24 AlertDescription.unexpected_message: "unexpected_message",\25 AlertDescription.bad_record_mac: "bad_record_mac",\26 AlertDescription.decryption_failed: "decryption_failed",\27 AlertDescription.record_overflow: "record_overflow",\28 AlertDescription.decompression_failure: "decompression_failure",\29 AlertDescription.handshake_failure: "handshake_failure",\30 AlertDescription.no_certificate: "no certificate",\31 AlertDescription.bad_certificate: "bad_certificate",\32 AlertDescription.unsupported_certificate: "unsupported_certificate",\33 AlertDescription.certificate_revoked: "certificate_revoked",\34 AlertDescription.certificate_expired: "certificate_expired",\35 AlertDescription.certificate_unknown: "certificate_unknown",\36 AlertDescription.illegal_parameter: "illegal_parameter",\37 AlertDescription.unknown_ca: "unknown_ca",\38 AlertDescription.access_denied: "access_denied",\39 AlertDescription.decode_error: "decode_error",\40 AlertDescription.decrypt_error: "decrypt_error",\41 AlertDescription.export_restriction: "export_restriction",\42 AlertDescription.protocol_version: "protocol_version",\43 AlertDescription.insufficient_security: "insufficient_security",\44 AlertDescription.internal_error: "internal_error",\45 AlertDescription.user_canceled: "user_canceled",\46 AlertDescription.no_renegotiation: "no_renegotiation",\47 AlertDescription.unknown_srp_username: "unknown_srp_username",\48 AlertDescription.missing_srp_username: "missing_srp_username"}49class TLSLocalAlert(TLSAlert):50 """A TLS alert has been signalled by the local implementation.51 @type description: int52 @ivar description: Set to one of the constants in53 L{tlslite.constants.AlertDescription}54 @type level: int55 @ivar level: Set to one of the constants in56 L{tlslite.constants.AlertLevel}57 @type message: str58 @ivar message: Description of what went wrong.59 """60 def __init__(self, alert, message=None):61 self.description = alert.description62 self.level = alert.level63 self.message = message64 def __str__(self):65 alertStr = TLSAlert._descriptionStr.get(self.description)66 if alertStr == None:67 alertStr = str(self.description)68 if self.message:69 return alertStr + ": " + self.message70 else:71 return alertStr72class TLSRemoteAlert(TLSAlert):73 """A TLS alert has been signalled by the remote implementation.74 @type description: int75 @ivar description: Set to one of the constants in76 L{tlslite.constants.AlertDescription}77 @type level: int78 @ivar level: Set to one of the constants in79 L{tlslite.constants.AlertLevel}80 """81 def __init__(self, alert):82 self.description = alert.description83 self.level = alert.level84 def __str__(self):85 alertStr = TLSAlert._descriptionStr.get(self.description)86 if alertStr == None:87 alertStr = str(self.description)88 return alertStr89class TLSAuthenticationError(TLSError):90 """The handshake succeeded, but the other party's authentication91 was inadequate.92 This exception will only be raised when a93 L{tlslite.Checker.Checker} has been passed to a handshake function.94 The Checker will be invoked once the handshake completes, and if95 the Checker objects to how the other party authenticated, a96 subclass of this exception will be raised.97 """98 pass99class TLSNoAuthenticationError(TLSAuthenticationError):100 """The Checker was expecting the other party to authenticate with a101 certificate chain, but this did not occur."""102 pass103class TLSAuthenticationTypeError(TLSAuthenticationError):104 """The Checker was expecting the other party to authenticate with a105 different type of certificate chain."""106 pass107class TLSFingerprintError(TLSAuthenticationError):108 """The Checker was expecting the other party to authenticate with a109 certificate chain that matches a different fingerprint."""110 pass111class TLSAuthorizationError(TLSAuthenticationError):112 """The Checker was expecting the other party to authenticate with a113 certificate chain that has a different authorization."""114 pass115class TLSValidationError(TLSAuthenticationError):116 """The Checker has determined that the other party's certificate117 chain is invalid."""118 pass119class TLSFaultError(TLSError):120 """The other party responded incorrectly to an induced fault.121 This exception will only occur during fault testing, when a122 TLSConnection's fault variable is set to induce some sort of123 faulty behavior, and the other party doesn't respond appropriately.124 """...
database.py
Source:database.py
...138139 def prompt_create_system_description(self) -> None:140 description = click.prompt('system_description.description')141142 system_description = SystemDescription(description)143 self.database_manager.save(system_description)144145 print('System Description record saved successfully:')146 print(system_description)147148 def prompt_create_workload_description(self) -> int:149 description = click.prompt('workload_description.description')150151 workload_description = WorkloadDescription(description)152 self.database_manager.save(workload_description)153154 print('Workload Description record created successfully:')155 print(workload_description)156
...
Using AI Code Generation
1var tracetest = require('tracetest');2var module1 = require('./module1');3var module2 = require('./module2');4module1.method1();5module2.method2();6var tracetest = require('tracetest');7var module2 = require('./module2');8module.exports.method1 = function() {9 tracetest.Description('module1.method1');10 module2.method2();11};12var tracetest = require('tracetest');13module.exports.method2 = function() {14 tracetest.Description('module2.method2');15};
Using AI Code Generation
1const trace = require("./tracetest.js");2var description = new trace.Description("test");3description.log("test");4description.log("test2");5description.log("test3");6description.log("test4");7description.log("test5");8description.log("test6");9description.log("test7");10description.log("test8");11description.log("test9");12description.log("test10");13description.log("test11");14description.log("test12");15description.log("test13");16description.log("test14");17description.log("test15");18description.log("test16");19description.log("test17");20description.log("test18");21description.log("test19");22description.log("test20");23description.log("test21");24description.log("test22");25description.log("test23");26description.log("test24");27description.log("test25");28description.log("test26");29description.log("test27");30description.log("test28");31description.log("test29");32description.log("test30");33description.log("test31");34description.log("test32");35description.log("test33");36description.log("test34");37description.log("test35");38description.log("test36");39description.log("test37");40description.log("test38");41description.log("test39");42description.log("test40");43description.log("test41");44description.log("test42");45description.log("test43");46description.log("test44");47description.log("test45");48description.log("test46");49description.log("test47");50description.log("test48");51description.log("test49");52description.log("test50");53description.log("test51");54description.log("test52");55description.log("test53");56description.log("test54");57description.log("test55");58description.log("test56");59description.log("test57");60description.log("test58");61description.log("test59");62description.log("test60");63description.log("test61");64description.log("test62");65description.log("test63");66description.log("test64");67description.log("test65");68description.log("test66");69description.log("test67");70description.log("test68");71description.log("test69");72description.log("test70");73description.log("test71");74description.log("test72");75description.log("test73");76description.log("test74");77description.log("test75");78description.log("test76");79description.log("test77");80description.log("test78");81description.log("test79");82description.log("test80");
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!