本文整理汇总了Python中bpy.props.StringProperty方法的典型用法代码示例。如果您正苦于以下问题:Python props.StringProperty方法的具体用法?Python props.StringProperty怎么用?Python props.StringProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bpy.props
的用法示例。
在下文中一共展示了props.StringProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def register():
from bpy.types import Scene
from bpy.props import (BoolProperty,
IntProperty,
StringProperty,
)
Scene.pc_pc2_rotx = BoolProperty(default=True, name="Rotx = 90")
Scene.pc_pc2_world_space = BoolProperty(default=True, name="World Space")
Scene.pc_pc2_modifiers = BoolProperty(default=True, name="Apply Modifiers")
Scene.pc_pc2_subsurf = BoolProperty(default=True, name="Turn Off SubSurf")
Scene.pc_pc2_start = IntProperty(default=0, name="Frame Start")
Scene.pc_pc2_end = IntProperty(default=100, name="Frame End")
Scene.pc_pc2_group = StringProperty()
Scene.pc_pc2_folder = StringProperty(default="Set me Please!")
Scene.pc_pc2_exclude = StringProperty(default="*")
bpy.utils.register_module(__name__)
示例2: _create_id_property
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def _create_id_property(field_name):
def fn(*args, **kwargs):
""" the main class. """
value_key = _create_value_key(kwargs["name"])
validator = kwargs.pop("validator", None)
kwargs["get"] = create_getter(field_name, value_key)
kwargs["set"] = create_setter(field_name, value_key, validator)
payload = {
"field_name": field_name,
}
kwargs["description"] = json.dumps(payload)
prop = p.StringProperty(*args, **kwargs)
return prop
return fn
示例3: invoke
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
# class CreateNewSegment(bpy.types.Operator):
# """
# :term:`operator` for creating a new segment in the robot model.
#
#
# """
# bl_idname = config.OPERATOR_PREFIX + "createbone"
# bl_label = "Create new Bone"
#
# boneName = StringProperty(name="Enter new bone name:")
#
# def execute(self, context):
# try:
# parentBoneName = context.active_bone.name
# except:
# parentBoneName = None
#
# if not context.active_object.type == 'ARMATURE':
# raise Exception("BoneCreationException")
# # return{'FINISHED'}
# armatureName = context.active_object.name
# armatures.createBone(armatureName, self.boneName, parentBoneName)
#
# designer.ops.select_segment(boneName=self.boneName)
# armatures.updateKinematics(armatureName, self.boneName)
#
# # TODO: set parentMode according to own parent
# return {'FINISHED'}
#
# def invoke(self, context, event):
# return context.window_manager.invoke_props_dialog(self)
示例4: register
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def register():
Scene.archipack_progress = FloatProperty(
options={'SKIP_SAVE'},
default=-1,
subtype='PERCENTAGE',
precision=1,
min=-1,
soft_min=0,
soft_max=100,
max=101,
update=update)
Scene.archipack_progress_text = StringProperty(
options={'SKIP_SAVE'},
default="Progress",
update=update)
global info_header_draw
info_header_draw = bpy.types.INFO_HT_header.draw
def info_draw(self, context):
global info_header_draw
info_header_draw(self, context)
if (context.scene.archipack_progress > -1 and
context.scene.archipack_progress < 101):
self.layout.separator()
text = context.scene.archipack_progress_text
self.layout.prop(context.scene,
"archipack_progress",
text=text,
slider=True)
bpy.types.INFO_HT_header.draw = info_draw
示例5: register
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def register():
"""TODO Missing documentation"""
from bpy.types import WindowManager
from bpy.props import StringProperty, EnumProperty, BoolProperty
WindowManager.modelpreview = EnumProperty(items=getModelListForEnumProperty, name='Model')
WindowManager.category = EnumProperty(items=getCategoriesForEnumProperty, name='Category')
compileModelList()
示例6: copy
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def copy(self, orig_node):
for item in self.ramp_items:
# We have to update the parent node's name by hand because it's a StringProperty
item.node_name = self.name
示例7: register
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def register():
bpy.utils.register_module(__name__)
# space_userprefs.py
from bpy.props import StringProperty, EnumProperty
from bpy.types import WindowManager
def addon_filter_items(self, context):
import addon_utils
items = [('All', "All", "All Add-ons"),
('User', "User", "All Add-ons Installed by User"),
('Enabled', "Enabled", "All Enabled Add-ons"),
('Disabled', "Disabled", "All Disabled Add-ons"),
]
items_unique = set()
for mod in addon_utils.modules(refresh=False):
info = addon_utils.module_bl_info(mod)
items_unique.add(info["category"])
items.extend([(cat, cat, "") for cat in sorted(items_unique)])
return items
WindowManager.addon_search = StringProperty(
name="Search",
description="Search within the selected filter",
options={'TEXTEDIT_UPDATE'},
)
WindowManager.addon_filter = EnumProperty(
items=addon_filter_items,
name="Category",
description="Filter add-ons by category",
)
WindowManager.addon_support = EnumProperty(
items=[('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")
],
name="Support",
description="Display support level",
default={'OFFICIAL', 'COMMUNITY'},
options={'ENUM_FLAG'},
)
# done...
示例8: register
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def register():
from bpy.utils import register_class
for mod in _modules_loaded:
for cls in mod.classes:
register_class(cls)
# space_userprefs.py
from bpy.props import StringProperty, EnumProperty
from bpy.types import WindowManager
def addon_filter_items(self, context):
import addon_utils
items = [('All', "All", "All Add-ons"),
('User', "User", "All Add-ons Installed by User"),
('Enabled', "Enabled", "All Enabled Add-ons"),
('Disabled', "Disabled", "All Disabled Add-ons"),
]
items_unique = set()
for mod in addon_utils.modules(refresh=False):
info = addon_utils.module_bl_info(mod)
items_unique.add(info["category"])
items.extend([(cat, cat, "") for cat in sorted(items_unique)])
return items
WindowManager.addon_search = StringProperty(
name="Search",
description="Search within the selected filter",
options={'TEXTEDIT_UPDATE'},
)
WindowManager.addon_filter = EnumProperty(
items=addon_filter_items,
name="Category",
description="Filter add-ons by category",
)
WindowManager.addon_support = EnumProperty(
items=[('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")
],
name="Support",
description="Display support level",
default={'OFFICIAL', 'COMMUNITY'},
options={'ENUM_FLAG'},
)
# done...
示例9: execute
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def execute(self,context):
scn = bpy.context.scene
selected = bpy.context.selected_objects
shippart = selected.pop(0)
bpy.ops.object.select_all(action = 'DESELECT')
shippart.select = True
shipname = shippart["ship"]
mergelist = []
for obj in scn.objects:
if obj.type == 'MESH' and obj["ship"] == shipname and not obj.hide:
mergelist.append(obj)
bpy.ops.object.select_all(action = 'DESELECT')
for obj in mergelist:
obj.select = True
bpy.ops.object.join()
bpy.ops.object.parent_clear(type='CLEAR')
result = bpy.context.active_object
result.name = "RESULT"
#result.scale = (10,10,10)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.remove_doubles(threshold = 0.001)
bpy.ops.mesh.normals_make_consistent(inside = False)
bpy.ops.object.mode_set(mode='OBJECT')
return {'FINISHED'}
##class LoadFlagPartOperator(bpy.types.Operator, ImportHelper):
## bl_idname = "object.loadflag"
## bl_label = "Load Flag"
##
## filename_ext = "Image file"
## filter_glob = StringProperty(default="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP;*.tiff;*.TIFF", options={'HIDDEN'})
## #Add more file types if necessary, I guess
##
## def execute(self, context):
## from . import load_flag
##
##
示例10: invoke
# 需要导入模块: from bpy import props [as 别名]
# 或者: from bpy.props import StringProperty [as 别名]
def invoke(self, context, event):
self.filepath = context.active_object.RobotEditor.modelMeta.model_folder.replace(" ", "_")
if self.filepath == "":
self.filepath = global_properties.model_name.get(bpy.context.scene).replace(" ", "_")
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
#
#
# filepath = StringProperty(name="Filename", subtype='FILE_PATH')
# gazebo = BoolProperty(name="Export Gazebo tags", default=True)
#
# package_url = BoolProperty(name="Package URL", default=True)
#
# base_link_name = StringProperty(name="Base link:", default="root_link")
#
# @RDOperator.OperatorLogger
# @RDOperator.Postconditions(ModelSelected, ObjectMode)
# def execute(self, context):
# """
# Code snipped from `<http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory>`_
# """
# import zipfile
#
# if os.path.isdir(self.filepath):
# self.logger.debug(self.filepath)
# self.report({'ERROR'}, "No File selected!")
# return {'FINISHED'}
#
# def zipdir(path, ziph):
# # ziph is zipfile handle
# for root, dirs, files in os.walk(path):
# self.logger.debug("%s, %s, %s,", root, dirs, files)
# for file in files:
# file_path = os.path.join(root, file)
# ziph.write(file_path, os.path.relpath(file_path, path))
#
# with tempfile.TemporaryDirectory() as target:
# create_package(self, context, target, self.base_link_name)
#
# with zipfile.ZipFile(self.filepath, 'w') as zipf:
# zipdir(target, zipf)
#
# return {'FINISHED'}
#
# def invoke(self, context, event):
# context.window_manager.fileselect_add(self)
# return {'RUNNING_MODAL'}