less copy protection, more size visualization
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

169 строки
4.6 KiB

  1. import bpy
  2. scene_props = {}
  3. collection_props = {}
  4. scene_props["mv_name"] = bpy.props.StringProperty(
  5. name = "Name",
  6. description = "The name of the thing",
  7. default = ""
  8. )
  9. scene_props["mv_kind"] = bpy.props.StringProperty(
  10. name = "Kind",
  11. description = "What category the entity belongs to",
  12. default = "objects"
  13. )
  14. scene_props["mv_trace_mode"] = bpy.props.FloatProperty(
  15. name = "Trace Alpha",
  16. description = "0 for polygonal; 1 for normal",
  17. min = 0,
  18. max = 2,
  19. soft_min = 0,
  20. soft_max = 1,
  21. default = 1
  22. )
  23. class MVView(bpy.types.PropertyGroup):
  24. view: bpy.props.EnumProperty(
  25. name = "View",
  26. description = "The angle to view from",
  27. items = (
  28. ("FRONT", "Front", ""),
  29. ("ANGLED", "Angled", ""),
  30. ("CORNER", "Corner", ""),
  31. ("SIDE", "Side", ""),
  32. ("BACK_CORNER", "Back Corner", ""),
  33. ("BACK", "Back", ""),
  34. ("TOP", "Top", ""),
  35. ("BOTTOM", "Bottom", "")
  36. )
  37. )
  38. name: bpy.props.StringProperty(name = "Name", description="What to call this view")
  39. class MVScientificNumber(bpy.types.PropertyGroup):
  40. base: bpy.props.FloatProperty(
  41. name = "Base",
  42. description = "The base of the number",
  43. default = 0,
  44. precision = 7
  45. )
  46. power: bpy.props.IntProperty(
  47. name = "Power",
  48. description = "The power of ten to multiply the base by",
  49. default = 0
  50. )
  51. scene_props["mv_views"] = bpy.props.CollectionProperty(
  52. name = "Views",
  53. description = "The views to view the object from",
  54. type = MVView
  55. )
  56. scene_props["mv_views_index"] = bpy.props.IntProperty(
  57. name = "Views index",
  58. description = "View list index"
  59. )
  60. scene_props["mv_scale_factor"] = bpy.props.IntProperty(
  61. name = "Scale Factor",
  62. description = "Scale lengths by 10^x",
  63. min = -20,
  64. max = 20,
  65. soft_min = -20,
  66. soft_max = 20,
  67. default = 0
  68. )
  69. scene_props["mv_material_mode"] = bpy.props.EnumProperty(
  70. name = "Material Mode",
  71. description = "How to decide what to replace each material with",
  72. items = (
  73. ('RANDOM', "Random", 'Randomly assign materials'),
  74. ('NAMES', "Names", 'Turn the specified names medium or light; the rest become dark'),
  75. ('FACE_MAPS', "Face Maps", "Assign a material for each face map"),
  76. ('OBJECT_NAMES', "Object Names", "Same as Names, but with object names, not material names")
  77. ),
  78. )
  79. scene_props["mv_material_names_bright"] = bpy.props.StringProperty(
  80. name = "Bright Colors",
  81. description = "Materials containing these words will become bright",
  82. default = ""
  83. )
  84. scene_props["mv_material_names_light"] = bpy.props.StringProperty(
  85. name = "Light Colors",
  86. description = "Materials containing these words will become light",
  87. default = ""
  88. )
  89. scene_props["mv_material_names_medium"] = bpy.props.StringProperty(
  90. name = "Medium Colors",
  91. description = "Materials containing these words will become medium",
  92. default = ""
  93. )
  94. scene_props["mv_entity_mass_mode"] = bpy.props.EnumProperty(
  95. name = "Mass",
  96. description = "How to compute the mass of entities",
  97. items = (
  98. ("OFF", "Off", "Do not include mass",),
  99. ("MANUAL", "Manual", "Use manually-specified mass",),
  100. ("DENSITY", "Density", "Use volume and manually-specified density")
  101. ),
  102. default = "OFF"
  103. )
  104. scene_props["mv_entity_volume_mode"] = bpy.props.EnumProperty(
  105. name = "Volume",
  106. description = "How to compute the volume of entities",
  107. items = (
  108. ("OFF", "Off", "Do not include volume",),
  109. ("MANUAL", "Manual", "Use manually-specified volume",),
  110. ("AUTO", "Auto", "Use auto-computed volume")
  111. ),
  112. default = "OFF"
  113. )
  114. scene_props["mv_clobber"] = bpy.props.BoolProperty(
  115. name = "Clobber",
  116. description = "Overwrite existing form data",
  117. default = False
  118. )
  119. scene_props["mv_sort"] = bpy.props.BoolProperty(
  120. name = "Sort",
  121. description = "Tell Macrovision to sort the forms",
  122. default = False
  123. )
  124. scene_props["mv_override_default_view"] = bpy.props.BoolProperty(
  125. name = "Override Default View",
  126. description = "Specify which view should be the default.",
  127. default = False
  128. )
  129. scene_props["mv_default_view"] = bpy.props.StringProperty(
  130. name = "Default View",
  131. description = "The default view to display for each form.",
  132. default = ""
  133. )
  134. collection_props["mv_entity_volume"] = bpy.props.PointerProperty(
  135. type = MVScientificNumber,
  136. )
  137. collection_props["mv_entity_mass"] = bpy.props.PointerProperty(
  138. type = MVScientificNumber,
  139. )
  140. collection_props["mv_entity_density"] = bpy.props.PointerProperty(
  141. type = MVScientificNumber,
  142. )
  143. clses = [
  144. MVView,
  145. MVScientificNumber
  146. ]