fix (actually nasty workaround), for groups incorrectly drawing in the object panel when the blend file has naming collisions with library data.
also minor style cleanup in bpy_rna.c
This commit is contained in:
parent
2f5735a9d4
commit
314a275850
@ -159,7 +159,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
ob = context.object
|
obj = context.object
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.operator("object.group_link", text="Add to Group")
|
row.operator("object.group_link", text="Add to Group")
|
||||||
@ -167,8 +167,13 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
|
|||||||
|
|
||||||
# XXX, this is bad practice, yes, I wrote it :( - campbell
|
# XXX, this is bad practice, yes, I wrote it :( - campbell
|
||||||
index = 0
|
index = 0
|
||||||
|
obj_name = obj.name
|
||||||
for group in bpy.data.groups:
|
for group in bpy.data.groups:
|
||||||
if ob.name in group.objects:
|
# XXX this is slow and stupid!, we need 2 checks, one thats fast
|
||||||
|
# and another that we can be sure its not a name collission
|
||||||
|
# from linked library data
|
||||||
|
group_objects = group.objects
|
||||||
|
if obj_name in group.objects and obj in group_objects[:]:
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
|
|
||||||
col.context_pointer_set("group", group)
|
col.context_pointer_set("group", group)
|
||||||
|
@ -873,7 +873,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
|
|||||||
if (path) {
|
if (path) {
|
||||||
if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
|
if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
|
||||||
ret = PyUnicode_FromFormat("bpy.data...%s",
|
ret = PyUnicode_FromFormat("bpy.data...%s",
|
||||||
path);
|
path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
|
ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
|
||||||
@ -980,7 +980,7 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
|
|||||||
if (path) {
|
if (path) {
|
||||||
if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
|
if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
|
||||||
ret = PyUnicode_FromFormat("bpy.data...%s",
|
ret = PyUnicode_FromFormat("bpy.data...%s",
|
||||||
path);
|
path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
|
ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
|
||||||
@ -2040,12 +2040,12 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
|
|||||||
* This is done for faster lookups. */
|
* This is done for faster lookups. */
|
||||||
#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \
|
#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \
|
||||||
if (keynum < 0) { \
|
if (keynum < 0) { \
|
||||||
keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \
|
keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \
|
||||||
if (keynum_abs < 0) { \
|
if (keynum_abs < 0) { \
|
||||||
PyErr_Format(PyExc_IndexError, \
|
PyErr_Format(PyExc_IndexError, \
|
||||||
"bpy_prop_collection[%d]: out of range.", keynum); \
|
"bpy_prop_collection[%d]: out of range.", keynum); \
|
||||||
return ret_err; \
|
return ret_err; \
|
||||||
} \
|
} \
|
||||||
} (void)0
|
} (void)0
|
||||||
|
|
||||||
|
|
||||||
@ -3508,8 +3508,8 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
|
|||||||
PyList_Append(ret, linkptr);
|
PyList_Append(ret, linkptr);
|
||||||
Py_DECREF(linkptr);
|
Py_DECREF(linkptr);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
/* should never happen */
|
/* should never happen */
|
||||||
BLI_assert(!"Invalid context type");
|
BLI_assert(!"Invalid context type");
|
||||||
|
Loading…
Reference in New Issue
Block a user