formatting edits, no functional changes.

This commit is contained in:
2011-08-18 12:20:10 +00:00
parent 83c090a555
commit 2bd016fe3f
2 changed files with 250 additions and 95 deletions

View File

@@ -20,8 +20,12 @@
import bpy import bpy
from bpy.types import Menu, Operator from bpy.types import Menu, Operator
from bpy.props import StringProperty, BoolProperty, IntProperty, \ from bpy.props import (StringProperty,
FloatProperty, EnumProperty BoolProperty,
IntProperty,
FloatProperty,
EnumProperty,
)
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear 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'} return {'CANCELLED'}
rna_path_prop = StringProperty(name="Context Attributes", rna_path_prop = StringProperty(
description="rna context string", maxlen=1024, default="") name="Context Attributes",
description="rna context string",
maxlen=1024,
)
rna_reverse_prop = BoolProperty(name="Reverse", rna_reverse_prop = BoolProperty(
description="Cycle backwards", default=False) 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)", description="Apply relative to the current value (delta)",
default=False) default=False,
)
def context_path_validate(context, data_path): 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_idname = "brush.active_index_set"
bl_label = "Set Brush Number" bl_label = "Set Brush Number"
mode = StringProperty(name="mode", mode = StringProperty(
description="Paint mode to set brush for", maxlen=1024) name="mode",
index = IntProperty(name="number", description="Paint mode to set brush for",
description="Brush number") maxlen=1024,
)
index = IntProperty(
name="number",
description="Brush number",
)
_attr_dict = {"sculpt": "use_paint_sculpt", _attr_dict = {"sculpt": "use_paint_sculpt",
"vertex_paint": "use_paint_vertex", "vertex_paint": "use_paint_vertex",
"weight_paint": "use_paint_weight", "weight_paint": "use_paint_weight",
"image_paint": "use_paint_image"} "image_paint": "use_paint_image",
}
def execute(self, context): def execute(self, context):
attr = self._attr_dict.get(self.mode) attr = self._attr_dict.get(self.mode)
@@ -112,8 +130,11 @@ class WM_OT_context_set_boolean(Operator):
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = BoolProperty(name="Value", value = BoolProperty(
description="Assignment value", default=True) name="Value",
description="Assignment value",
default=True,
)
execute = execute_context_assign execute = execute_context_assign
@@ -125,7 +146,11 @@ class WM_OT_context_set_int(Operator): # same as enum
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop 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 relative = rna_relative_prop
execute = execute_context_assign execute = execute_context_assign
@@ -138,10 +163,16 @@ class WM_OT_context_scale_int(Operator):
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = FloatProperty(name="Value", description="Assign value", default=1.0) value = FloatProperty(
always_step = BoolProperty(name="Always Step", name="Value",
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.", description="Assign value",
default=True) 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): def execute(self, context):
if context_path_validate(context, self.data_path) is Ellipsis: if context_path_validate(context, self.data_path) is Ellipsis:
@@ -160,7 +191,8 @@ class WM_OT_context_scale_int(Operator):
else: else:
add = "-1" add = "-1"
func = "min" 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: else:
exec("context.%s *= value" % self.data_path) 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'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = FloatProperty(name="Value", value = FloatProperty(
description="Assignment value", default=0.0) name="Value",
description="Assignment value",
default=0.0,
)
relative = rna_relative_prop relative = rna_relative_prop
execute = execute_context_assign execute = execute_context_assign
@@ -188,8 +223,11 @@ class WM_OT_context_set_string(Operator): # same as enum
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = StringProperty(name="Value", value = StringProperty(
description="Assign value", maxlen=1024, default="") name="Value",
description="Assign value",
maxlen=1024,
)
execute = execute_context_assign execute = execute_context_assign
@@ -201,9 +239,11 @@ class WM_OT_context_set_enum(Operator):
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = StringProperty(name="Value", value = StringProperty(
name="Value",
description="Assignment value (as a string)", description="Assignment value (as a string)",
maxlen=1024, default="") maxlen=1024,
)
execute = execute_context_assign execute = execute_context_assign
@@ -215,9 +255,11 @@ class WM_OT_context_set_value(Operator):
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = StringProperty(name="Value", value = StringProperty(
name="Value",
description="Assignment value (as a string)", description="Assignment value (as a string)",
maxlen=1024, default="") maxlen=1024,
)
def execute(self, context): def execute(self, context):
if context_path_validate(context, self.data_path) is Ellipsis: 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'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value_1 = StringProperty(name="Value", \ value_1 = StringProperty(
description="Toggle enum", maxlen=1024, default="") name="Value",
description="Toggle enum",
value_2 = StringProperty(name="Value", \ maxlen=1024,
description="Toggle enum", maxlen=1024, default="") )
value_2 = StringProperty(
name="Value",
description="Toggle enum",
maxlen=1024,
)
def execute(self, context): def execute(self, context):
if context_path_validate(context, self.data_path) is Ellipsis: if context_path_validate(context, self.data_path) is Ellipsis:
return {'PASS_THROUGH'} return {'PASS_THROUGH'}
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \ exec("context.%s = ['%s', '%s'][context.%s!='%s']" %
(self.data_path, self.value_1,\ (self.data_path, self.value_1,
self.value_2, self.data_path, self.value_2, self.data_path,
self.value_2)) self.value_2,
))
return {'FINISHED'} return {'FINISHED'}
@@ -426,8 +474,11 @@ class WM_OT_context_set_id(Operator):
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path = rna_path_prop
value = StringProperty(name="Value", value = StringProperty(
description="Assign value", maxlen=1024, default="") name="Value",
description="Assign value",
maxlen=1024,
)
def execute(self, context): def execute(self, context):
value = self.value value = self.value
@@ -454,11 +505,18 @@ class WM_OT_context_set_id(Operator):
return {'FINISHED'} return {'FINISHED'}
doc_id = StringProperty(name="Doc ID", doc_id = StringProperty(
description="", maxlen=1024, default="", options={'HIDDEN'}) name="Doc ID",
description="",
maxlen=1024,
options={'HIDDEN'},
)
doc_new = StringProperty(name="Edit Description", doc_new = StringProperty(
description="", maxlen=1024, default="") name="Edit Description",
description="",
maxlen=1024,
)
data_path_iter = StringProperty( data_path_iter = StringProperty(
description="The data path relative to the context, must point to an iterable.") 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_iter = data_path_iter
data_path_item = data_path_item data_path_item = data_path_item
type = EnumProperty(items=( type = EnumProperty(
('TOGGLE', "Toggle", ""), name="Type",
('ENABLE', "Enable", ""), items=(('TOGGLE', "Toggle", ""),
('DISABLE', "Disable", ""), ('ENABLE', "Enable", ""),
), ('DISABLE', "Disable", ""),
name="Type") ),
)
def execute(self, context): def execute(self, context):
data_path_iter = self.data_path_iter 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_iter = data_path_iter
data_path_item = data_path_item data_path_item = data_path_item
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta") input_scale = FloatProperty(
invert = BoolProperty(default=False, description="Invert the mouse input") 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'}) initial_x = IntProperty(options={'HIDDEN'})
def _values_store(self, context): def _values_store(self, context):
@@ -613,7 +678,10 @@ class WM_OT_url_open(Operator):
bl_idname = "wm.url_open" bl_idname = "wm.url_open"
bl_label = "" bl_label = ""
url = StringProperty(name="URL", description="URL to open") url = StringProperty(
name="URL",
description="URL to open",
)
def execute(self, context): def execute(self, context):
import webbrowser import webbrowser
@@ -627,7 +695,11 @@ class WM_OT_path_open(Operator):
bl_idname = "wm.path_open" bl_idname = "wm.path_open"
bl_label = "" 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): def execute(self, context):
import sys import sys
@@ -662,9 +734,11 @@ class WM_OT_doc_view(Operator):
doc_id = doc_id doc_id = doc_id
if bpy.app.version_cycle == "release": 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: 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): def _nested_class_string(self, class_string):
ls = [] ls = []
@@ -682,8 +756,8 @@ class WM_OT_doc_view(Operator):
class_name, class_prop = id_split class_name, class_prop = id_split
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop): if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \ url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
(self._prefix, class_name, class_name, class_prop) (self._prefix, class_name, class_name, class_prop))
else: else:
# detect if this is a inherited member and use that name instead # 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 # It so happens that epydoc nests these, not sphinx
# class_name_full = self._nested_class_string(class_name) # class_name_full = self._nested_class_string(class_name)
url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \ url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
(self._prefix, class_name, class_name, class_prop) (self._prefix, class_name, class_name, class_prop))
else: else:
return {'PASS_THROUGH'} return {'PASS_THROUGH'}
@@ -780,17 +854,36 @@ class WM_OT_doc_edit(Operator):
return wm.invoke_props_dialog(self, width=600) return wm.invoke_props_dialog(self, width=600)
rna_path = StringProperty(name="Property Edit", rna_path = StringProperty(
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'}) name="Property Edit",
description="Property data_path edit",
maxlen=1024,
options={'HIDDEN'},
)
rna_value = StringProperty(name="Property Value", rna_value = StringProperty(
description="Property value edit", maxlen=1024, default="") name="Property Value",
description="Property value edit",
maxlen=1024,
)
rna_property = StringProperty(name="Property Name", rna_property = StringProperty(
description="Property name edit", maxlen=1024, default="") name="Property Name",
description="Property name edit",
maxlen=1024,
)
rna_min = FloatProperty(name="Min", default=0.0, precision=3) rna_min = FloatProperty(
rna_max = FloatProperty(name="Max", default=1.0, precision=3) name="Min",
default=0.0,
precision=3,
)
rna_max = FloatProperty(
name="Max",
default=1.0,
precision=3,
)
class WM_OT_properties_edit(Operator): class WM_OT_properties_edit(Operator):
@@ -804,7 +897,9 @@ class WM_OT_properties_edit(Operator):
value = rna_value value = rna_value
min = rna_min min = rna_min
max = rna_max max = rna_max
description = StringProperty(name="Tip", default="") description = StringProperty(
name="Tip",
)
def execute(self, context): def execute(self, context):
data_path = self.data_path data_path = self.data_path
@@ -908,7 +1003,10 @@ class WM_OT_properties_context_change(Operator):
bl_idname = "wm.properties_context_change" bl_idname = "wm.properties_context_change"
bl_label = "" bl_label = ""
context = StringProperty(name="Context", maxlen=32) context = StringProperty(
name="Context",
maxlen=32,
)
def execute(self, context): def execute(self, context):
context.space_data.context = (self.context) context.space_data.context = (self.context)
@@ -933,7 +1031,10 @@ class WM_OT_keyconfig_activate(Operator):
bl_idname = "wm.keyconfig_activate" bl_idname = "wm.keyconfig_activate"
bl_label = "Activate Keyconfig" bl_label = "Activate Keyconfig"
filepath = StringProperty(name="File Path", maxlen=1024) filepath = StringProperty(
name="File Path",
maxlen=1024,
)
def execute(self, context): def execute(self, context):
bpy.utils.keyconfig_set(self.filepath) bpy.utils.keyconfig_set(self.filepath)
@@ -961,7 +1062,10 @@ class WM_OT_appconfig_activate(Operator):
bl_idname = "wm.appconfig_activate" bl_idname = "wm.appconfig_activate"
bl_label = "Activate Application Configuration" bl_label = "Activate Application Configuration"
filepath = StringProperty(name="File Path", maxlen=1024) filepath = StringProperty(
name="File Path",
maxlen=1024,
)
def execute(self, context): def execute(self, context):
import os import os

View File

@@ -84,7 +84,9 @@ int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
{ {
if(pysrna->ptr.type) if(pysrna->ptr.type)
return 0; 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; return -1;
} }
@@ -790,18 +792,23 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
const char *name; const char *name;
if(!PYRNA_STRUCT_IS_VALID(self)) { 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 */ /* print name if available */
name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE); name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE);
if(name) { 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); MEM_freeN((void *)name);
return ret; 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) 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 */ return pyrna_struct_str(self); /* fallback */
if(RNA_struct_is_ID(self->ptr.type)) { 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 { else {
PyObject *ret; PyObject *ret;
const char *path; const char *path;
path= RNA_path_from_ID_to_struct(&self->ptr); path= RNA_path_from_ID_to_struct(&self->ptr);
if(path) { 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); MEM_freeN((void *)path);
} }
else { /* cant find, print something sane */ 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; return ret;
@@ -870,7 +885,11 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE); name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE);
if(name) { 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); MEM_freeN((void *)name);
return ret; return ret;
} }
@@ -878,11 +897,16 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
if(RNA_property_type(self->prop) == PROP_COLLECTION) { if(RNA_property_type(self->prop) == PROP_COLLECTION) {
PointerRNA r_ptr; PointerRNA r_ptr;
if(RNA_property_collection_type_get(&self->ptr, self->prop, &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) static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
@@ -902,7 +926,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
MEM_freeN((void *)path); MEM_freeN((void *)path);
} }
else { /* cant find, print something sane */ 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; return ret;
@@ -911,7 +938,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
static PyObject *pyrna_func_repr(BPy_FunctionRNA *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) { else if (self->ptr.type == &RNA_Context) {
bContext *C= self->ptr.data; bContext *C= self->ptr.data;
if(C==NULL) { 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; ret= NULL;
} }
else { else {
@@ -3054,7 +3086,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
} }
else { else {
#if 0 #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; ret= NULL;
#endif #endif
/* Include this incase this instance is a subtype of a python class /* 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); const char *attr_str= _PyUnicode_AsString(attr);
int ret= RNA_def_property_free_identifier(srna, attr_str); int ret= RNA_def_property_free_identifier(srna, attr_str);
if (ret == -1) { 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; 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 */ /* code just raises correct error, context prop's cant be set, unless its apart of the py class */
bContext *C= self->ptr.data; bContext *C= self->ptr.data;
if(C==NULL) { 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; return -1;
} }
else { 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); int done= CTX_data_get(C, name, &newptr, &newlb, &newtype);
if(done==1) { 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); BLI_freelistN(&newlb);
return -1; 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; return -1;
} }
@@ -4048,11 +4090,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
} }
/* error, invalid type given */ /* 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; return NULL;
} }
else { 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; return NULL;
} }
} }
@@ -4077,7 +4122,9 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UN
return (PyObject *)ret; return (PyObject *)ret;
} }
else { 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; return NULL;
} }
} }
@@ -4139,7 +4186,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
} }
break; break;
default: 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; ret= NULL;
break; break;
} }
@@ -4237,7 +4286,9 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
break; break;
} }
default: 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; ret= NULL;
break; break;
} }