formatting edits, no functional changes.
This commit is contained in:
@@ -20,8 +20,12 @@
|
||||
|
||||
import bpy
|
||||
from bpy.types import Menu, Operator
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty, \
|
||||
FloatProperty, EnumProperty
|
||||
from bpy.props import (StringProperty,
|
||||
BoolProperty,
|
||||
IntProperty,
|
||||
FloatProperty,
|
||||
EnumProperty,
|
||||
)
|
||||
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||
|
||||
@@ -39,15 +43,23 @@ class MESH_OT_delete_edgeloop(Operator):
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
rna_path_prop = StringProperty(name="Context Attributes",
|
||||
description="rna context string", maxlen=1024, default="")
|
||||
rna_path_prop = StringProperty(
|
||||
name="Context Attributes",
|
||||
description="rna context string",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_reverse_prop = BoolProperty(name="Reverse",
|
||||
description="Cycle backwards", default=False)
|
||||
rna_reverse_prop = BoolProperty(
|
||||
name="Reverse",
|
||||
description="Cycle backwards",
|
||||
default=False,
|
||||
)
|
||||
|
||||
rna_relative_prop = BoolProperty(name="Relative",
|
||||
rna_relative_prop = BoolProperty(
|
||||
name="Relative",
|
||||
description="Apply relative to the current value (delta)",
|
||||
default=False)
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def context_path_validate(context, data_path):
|
||||
@@ -82,15 +94,21 @@ class BRUSH_OT_active_index_set(Operator):
|
||||
bl_idname = "brush.active_index_set"
|
||||
bl_label = "Set Brush Number"
|
||||
|
||||
mode = StringProperty(name="mode",
|
||||
description="Paint mode to set brush for", maxlen=1024)
|
||||
index = IntProperty(name="number",
|
||||
description="Brush number")
|
||||
mode = StringProperty(
|
||||
name="mode",
|
||||
description="Paint mode to set brush for",
|
||||
maxlen=1024,
|
||||
)
|
||||
index = IntProperty(
|
||||
name="number",
|
||||
description="Brush number",
|
||||
)
|
||||
|
||||
_attr_dict = {"sculpt": "use_paint_sculpt",
|
||||
"vertex_paint": "use_paint_vertex",
|
||||
"weight_paint": "use_paint_weight",
|
||||
"image_paint": "use_paint_image"}
|
||||
"image_paint": "use_paint_image",
|
||||
}
|
||||
|
||||
def execute(self, context):
|
||||
attr = self._attr_dict.get(self.mode)
|
||||
@@ -112,8 +130,11 @@ class WM_OT_context_set_boolean(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = BoolProperty(name="Value",
|
||||
description="Assignment value", default=True)
|
||||
value = BoolProperty(
|
||||
name="Value",
|
||||
description="Assignment value",
|
||||
default=True,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@@ -125,7 +146,11 @@ class WM_OT_context_set_int(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = IntProperty(name="Value", description="Assign value", default=0)
|
||||
value = IntProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
default=0,
|
||||
)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
@@ -138,10 +163,16 @@ class WM_OT_context_scale_int(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value", description="Assign value", default=1.0)
|
||||
always_step = BoolProperty(name="Always Step",
|
||||
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
|
||||
default=True)
|
||||
value = FloatProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
default=1.0,
|
||||
)
|
||||
always_step = BoolProperty(
|
||||
name="Always Step",
|
||||
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
|
||||
default=True,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
@@ -160,7 +191,8 @@ class WM_OT_context_scale_int(Operator):
|
||||
else:
|
||||
add = "-1"
|
||||
func = "min"
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" %
|
||||
(data_path, func, data_path, data_path, add))
|
||||
else:
|
||||
exec("context.%s *= value" % self.data_path)
|
||||
|
||||
@@ -174,8 +206,11 @@ class WM_OT_context_set_float(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value",
|
||||
description="Assignment value", default=0.0)
|
||||
value = FloatProperty(
|
||||
name="Value",
|
||||
description="Assignment value",
|
||||
default=0.0,
|
||||
)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
@@ -188,8 +223,11 @@ class WM_OT_context_set_string(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@@ -201,9 +239,11 @@ class WM_OT_context_set_enum(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@@ -215,9 +255,11 @@ class WM_OT_context_set_value(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
@@ -252,21 +294,27 @@ class WM_OT_context_toggle_enum(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value_1 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
|
||||
value_2 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
value_1 = StringProperty(
|
||||
name="Value",
|
||||
description="Toggle enum",
|
||||
maxlen=1024,
|
||||
)
|
||||
value_2 = StringProperty(
|
||||
name="Value",
|
||||
description="Toggle enum",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
|
||||
(self.data_path, self.value_1,\
|
||||
self.value_2, self.data_path,
|
||||
self.value_2))
|
||||
exec("context.%s = ['%s', '%s'][context.%s!='%s']" %
|
||||
(self.data_path, self.value_1,
|
||||
self.value_2, self.data_path,
|
||||
self.value_2,
|
||||
))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -426,8 +474,11 @@ class WM_OT_context_set_id(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
value = self.value
|
||||
@@ -454,11 +505,18 @@ class WM_OT_context_set_id(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
doc_id = StringProperty(name="Doc ID",
|
||||
description="", maxlen=1024, default="", options={'HIDDEN'})
|
||||
doc_id = StringProperty(
|
||||
name="Doc ID",
|
||||
description="",
|
||||
maxlen=1024,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
doc_new = StringProperty(name="Edit Description",
|
||||
description="", maxlen=1024, default="")
|
||||
doc_new = StringProperty(
|
||||
name="Edit Description",
|
||||
description="",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
data_path_iter = StringProperty(
|
||||
description="The data path relative to the context, must point to an iterable.")
|
||||
@@ -476,12 +534,13 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
type = EnumProperty(items=(
|
||||
('TOGGLE', "Toggle", ""),
|
||||
('ENABLE', "Enable", ""),
|
||||
('DISABLE', "Disable", ""),
|
||||
),
|
||||
name="Type")
|
||||
type = EnumProperty(
|
||||
name="Type",
|
||||
items=(('TOGGLE', "Toggle", ""),
|
||||
('ENABLE', "Enable", ""),
|
||||
('DISABLE', "Disable", ""),
|
||||
),
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path_iter = self.data_path_iter
|
||||
@@ -530,8 +589,14 @@ class WM_OT_context_modal_mouse(Operator):
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
||||
invert = BoolProperty(default=False, description="Invert the mouse input")
|
||||
input_scale = FloatProperty(
|
||||
description="Scale the mouse movement by this value before applying the delta",
|
||||
default=0.01,
|
||||
)
|
||||
invert = BoolProperty(
|
||||
description="Invert the mouse input",
|
||||
default=False,
|
||||
)
|
||||
initial_x = IntProperty(options={'HIDDEN'})
|
||||
|
||||
def _values_store(self, context):
|
||||
@@ -613,7 +678,10 @@ class WM_OT_url_open(Operator):
|
||||
bl_idname = "wm.url_open"
|
||||
bl_label = ""
|
||||
|
||||
url = StringProperty(name="URL", description="URL to open")
|
||||
url = StringProperty(
|
||||
name="URL",
|
||||
description="URL to open",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import webbrowser
|
||||
@@ -627,7 +695,11 @@ class WM_OT_path_open(Operator):
|
||||
bl_idname = "wm.path_open"
|
||||
bl_label = ""
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import sys
|
||||
@@ -662,9 +734,11 @@ class WM_OT_doc_view(Operator):
|
||||
|
||||
doc_id = doc_id
|
||||
if bpy.app.version_cycle == "release":
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s%s_release" %
|
||||
("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char))
|
||||
else:
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s" %
|
||||
"_".join(str(v) for v in bpy.app.version))
|
||||
|
||||
def _nested_class_string(self, class_string):
|
||||
ls = []
|
||||
@@ -682,8 +756,8 @@ class WM_OT_doc_view(Operator):
|
||||
class_name, class_prop = id_split
|
||||
|
||||
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
|
||||
url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
else:
|
||||
|
||||
# detect if this is a inherited member and use that name instead
|
||||
@@ -696,8 +770,8 @@ class WM_OT_doc_view(Operator):
|
||||
|
||||
# It so happens that epydoc nests these, not sphinx
|
||||
# class_name_full = self._nested_class_string(class_name)
|
||||
url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
|
||||
else:
|
||||
return {'PASS_THROUGH'}
|
||||
@@ -780,17 +854,36 @@ class WM_OT_doc_edit(Operator):
|
||||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
|
||||
rna_path = StringProperty(name="Property Edit",
|
||||
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
rna_path = StringProperty(
|
||||
name="Property Edit",
|
||||
description="Property data_path edit",
|
||||
maxlen=1024,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
rna_value = StringProperty(name="Property Value",
|
||||
description="Property value edit", maxlen=1024, default="")
|
||||
rna_value = StringProperty(
|
||||
name="Property Value",
|
||||
description="Property value edit",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_property = StringProperty(name="Property Name",
|
||||
description="Property name edit", maxlen=1024, default="")
|
||||
rna_property = StringProperty(
|
||||
name="Property Name",
|
||||
description="Property name edit",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_min = FloatProperty(name="Min", default=0.0, precision=3)
|
||||
rna_max = FloatProperty(name="Max", default=1.0, precision=3)
|
||||
rna_min = FloatProperty(
|
||||
name="Min",
|
||||
default=0.0,
|
||||
precision=3,
|
||||
)
|
||||
|
||||
rna_max = FloatProperty(
|
||||
name="Max",
|
||||
default=1.0,
|
||||
precision=3,
|
||||
)
|
||||
|
||||
|
||||
class WM_OT_properties_edit(Operator):
|
||||
@@ -804,7 +897,9 @@ class WM_OT_properties_edit(Operator):
|
||||
value = rna_value
|
||||
min = rna_min
|
||||
max = rna_max
|
||||
description = StringProperty(name="Tip", default="")
|
||||
description = StringProperty(
|
||||
name="Tip",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
@@ -908,7 +1003,10 @@ class WM_OT_properties_context_change(Operator):
|
||||
bl_idname = "wm.properties_context_change"
|
||||
bl_label = ""
|
||||
|
||||
context = StringProperty(name="Context", maxlen=32)
|
||||
context = StringProperty(
|
||||
name="Context",
|
||||
maxlen=32,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
context.space_data.context = (self.context)
|
||||
@@ -933,7 +1031,10 @@ class WM_OT_keyconfig_activate(Operator):
|
||||
bl_idname = "wm.keyconfig_activate"
|
||||
bl_label = "Activate Keyconfig"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
bpy.utils.keyconfig_set(self.filepath)
|
||||
@@ -961,7 +1062,10 @@ class WM_OT_appconfig_activate(Operator):
|
||||
bl_idname = "wm.appconfig_activate"
|
||||
bl_label = "Activate Application Configuration"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
|
@@ -84,7 +84,9 @@ int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
|
||||
{
|
||||
if(pysrna->ptr.type)
|
||||
return 0;
|
||||
PyErr_Format(PyExc_ReferenceError, "StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name);
|
||||
PyErr_Format(PyExc_ReferenceError,
|
||||
"StructRNA of type %.200s has been removed",
|
||||
Py_TYPE(pysrna)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -790,18 +792,23 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
|
||||
const char *name;
|
||||
|
||||
if(!PYRNA_STRUCT_IS_VALID(self)) {
|
||||
return PyUnicode_FromFormat("<bpy_struct, %.200s dead>", Py_TYPE(self)->tp_name);
|
||||
return PyUnicode_FromFormat("<bpy_struct, %.200s dead>",
|
||||
Py_TYPE(self)->tp_name);
|
||||
}
|
||||
|
||||
/* print name if available */
|
||||
name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
|
||||
if(name) {
|
||||
ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), name);
|
||||
ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
|
||||
RNA_struct_identifier(self->ptr.type),
|
||||
name);
|
||||
MEM_freeN((void *)name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return PyUnicode_FromFormat("<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
|
||||
return PyUnicode_FromFormat("<bpy_struct, %.200s at %p>",
|
||||
RNA_struct_identifier(self->ptr.type),
|
||||
self->ptr.data);
|
||||
}
|
||||
|
||||
static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
|
||||
@@ -811,18 +818,26 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
|
||||
return pyrna_struct_str(self); /* fallback */
|
||||
|
||||
if(RNA_struct_is_ID(self->ptr.type)) {
|
||||
return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
|
||||
return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]",
|
||||
BKE_idcode_to_name_plural(GS(id->name)),
|
||||
id->name+2);
|
||||
}
|
||||
else {
|
||||
PyObject *ret;
|
||||
const char *path;
|
||||
path= RNA_path_from_ID_to_struct(&self->ptr);
|
||||
if(path) {
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path);
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s",
|
||||
BKE_idcode_to_name_plural(GS(id->name)),
|
||||
id->name+2,
|
||||
path);
|
||||
MEM_freeN((void *)path);
|
||||
}
|
||||
else { /* cant find, print something sane */
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type));
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s",
|
||||
BKE_idcode_to_name_plural(GS(id->name)),
|
||||
id->name+2,
|
||||
RNA_struct_identifier(self->ptr.type));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -870,7 +885,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
|
||||
name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
|
||||
|
||||
if(name) {
|
||||
ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
|
||||
ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
|
||||
type_fmt,
|
||||
RNA_struct_identifier(self->ptr.type),
|
||||
RNA_property_identifier(self->prop),
|
||||
name);
|
||||
MEM_freeN((void *)name);
|
||||
return ret;
|
||||
}
|
||||
@@ -878,11 +897,16 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
|
||||
if(RNA_property_type(self->prop) == PROP_COLLECTION) {
|
||||
PointerRNA r_ptr;
|
||||
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
|
||||
return PyUnicode_FromFormat("<bpy_%.200s, %.200s>", type_fmt, RNA_struct_identifier(r_ptr.type));
|
||||
return PyUnicode_FromFormat("<bpy_%.200s, %.200s>",
|
||||
type_fmt,
|
||||
RNA_struct_identifier(r_ptr.type));
|
||||
}
|
||||
}
|
||||
|
||||
return PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s>", type_fmt, RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
|
||||
return PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s>",
|
||||
type_fmt,
|
||||
RNA_struct_identifier(self->ptr.type),
|
||||
RNA_property_identifier(self->prop));
|
||||
}
|
||||
|
||||
static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
|
||||
@@ -902,7 +926,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
|
||||
MEM_freeN((void *)path);
|
||||
}
|
||||
else { /* cant find, print something sane */
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop));
|
||||
ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s",
|
||||
BKE_idcode_to_name_plural(GS(id->name)),
|
||||
id->name+2,
|
||||
RNA_property_identifier(self->prop));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -911,7 +938,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
|
||||
|
||||
static PyObject *pyrna_func_repr(BPy_FunctionRNA *self)
|
||||
{
|
||||
return PyUnicode_FromFormat("<%.200s %.200s.%.200s()>", Py_TYPE(self)->tp_name, RNA_struct_identifier(self->ptr.type), RNA_function_identifier(self->func));
|
||||
return PyUnicode_FromFormat("<%.200s %.200s.%.200s()>",
|
||||
Py_TYPE(self)->tp_name,
|
||||
RNA_struct_identifier(self->ptr.type),
|
||||
RNA_function_identifier(self->func));
|
||||
}
|
||||
|
||||
|
||||
@@ -2995,7 +3025,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
|
||||
else if (self->ptr.type == &RNA_Context) {
|
||||
bContext *C= self->ptr.data;
|
||||
if(C==NULL) {
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context", name);
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"bpy_struct: Context is 'NULL', can't get \"%.200s\" from context",
|
||||
name);
|
||||
ret= NULL;
|
||||
}
|
||||
else {
|
||||
@@ -3054,7 +3086,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: attribute \"%.200s\" not found", name);
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"bpy_struct: attribute \"%.200s\" not found",
|
||||
name);
|
||||
ret= NULL;
|
||||
#endif
|
||||
/* Include this incase this instance is a subtype of a python class
|
||||
@@ -3170,7 +3204,9 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
|
||||
const char *attr_str= _PyUnicode_AsString(attr);
|
||||
int ret= RNA_def_property_free_identifier(srna, attr_str);
|
||||
if (ret == -1) {
|
||||
PyErr_Format(PyExc_TypeError, "struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"struct_meta_idprop.detattr(): '%s' not a dynamic property",
|
||||
attr_str);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -3208,7 +3244,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
|
||||
/* code just raises correct error, context prop's cant be set, unless its apart of the py class */
|
||||
bContext *C= self->ptr.data;
|
||||
if(C==NULL) {
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context", name);
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"bpy_struct: Context is 'NULL', can't set \"%.200s\" from context",
|
||||
name);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
@@ -3219,7 +3257,9 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject
|
||||
int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
|
||||
|
||||
if(done==1) {
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_struct: Context property \"%.200s\" is read-only", name);
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"bpy_struct: Context property \"%.200s\" is read-only",
|
||||
name);
|
||||
BLI_freelistN(&newlb);
|
||||
return -1;
|
||||
}
|
||||
@@ -3363,7 +3403,9 @@ static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pynam
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_Format(PyExc_AttributeError, "bpy_prop_collection: attribute \"%.200s\" not found", name);
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"bpy_prop_collection: attribute \"%.200s\" not found",
|
||||
name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -4048,11 +4090,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
|
||||
}
|
||||
|
||||
/* error, invalid type given */
|
||||
PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct", type->tp_name);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct",
|
||||
type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): expected a single argument");
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"bpy_struct.__new__(type): expected a single argument");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -4077,7 +4122,9 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
|
||||
return (PyObject *)ret;
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop", type->tp_name);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop",
|
||||
type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -4139,7 +4186,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PyErr_Format(PyExc_TypeError, "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)", type);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
|
||||
type);
|
||||
ret= NULL;
|
||||
break;
|
||||
}
|
||||
@@ -4237,7 +4286,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
||||
break;
|
||||
}
|
||||
default:
|
||||
PyErr_Format(PyExc_TypeError, "RNA Error: unknown type \"%d\" (pyrna_param_to_py)", type);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
|
||||
type);
|
||||
ret= NULL;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user