forked from bartvdbraak/blender
fix own error r41191 getting id property string lengths.
This commit is contained in:
parent
65b92d820a
commit
9905094f5d
@ -1179,30 +1179,6 @@ class WM_OT_copy_prev_settings(Operator):
|
|||||||
|
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class WM_OT_blenderplayer_start(Operator):
|
|
||||||
'''Launches the Blenderplayer with the current blendfile'''
|
|
||||||
bl_idname = "wm.blenderplayer_start"
|
|
||||||
bl_label = "Start"
|
|
||||||
|
|
||||||
import os
|
|
||||||
blender_bin_path = bpy.app.binary_path
|
|
||||||
blender_bin_dir = os.path.dirname(blender_bin_path)
|
|
||||||
ext = os.path.splitext(blender_bin_path)[-1]
|
|
||||||
player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext)
|
|
||||||
|
|
||||||
def execute(self, context):
|
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
|
||||||
self.player_path = os.path.join(self.blender_bin_dir, '../../../blenderplayer.app/Contents/MacOS/blenderplayer')
|
|
||||||
|
|
||||||
filepath = bpy.app.tempdir + "game.blend"
|
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
|
|
||||||
subprocess.call([self.player_path, filepath])
|
|
||||||
return {'FINISHED'}
|
|
||||||
|
|
||||||
|
|
||||||
class WM_OT_keyconfig_test(Operator):
|
class WM_OT_keyconfig_test(Operator):
|
||||||
"Test keyconfig for conflicts"
|
"Test keyconfig for conflicts"
|
||||||
@ -1395,9 +1371,9 @@ class WM_OT_keyitem_add(Operator):
|
|||||||
km = context.keymap
|
km = context.keymap
|
||||||
|
|
||||||
if km.is_modal:
|
if km.is_modal:
|
||||||
km.keymap_items.new_modal("", 'A', 'PRESS') #~ kmi
|
km.keymap_items.new_modal("", 'A', 'PRESS')
|
||||||
else:
|
else:
|
||||||
km.keymap_items.new("none", 'A', 'PRESS') #~ kmi
|
km.keymap_items.new("none", 'A', 'PRESS')
|
||||||
|
|
||||||
# clear filter and expand keymap so we can see the newly added item
|
# clear filter and expand keymap so we can see the newly added item
|
||||||
if context.space_data.filter_text != "":
|
if context.space_data.filter_text != "":
|
||||||
|
@ -65,9 +65,9 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
|
|||||||
switch ( prop->type ) {
|
switch ( prop->type ) {
|
||||||
case IDP_STRING:
|
case IDP_STRING:
|
||||||
#ifdef USE_STRING_COERCE
|
#ifdef USE_STRING_COERCE
|
||||||
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len);
|
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
|
||||||
#else
|
#else
|
||||||
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len);
|
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
|
||||||
#endif
|
#endif
|
||||||
case IDP_INT:
|
case IDP_INT:
|
||||||
return PyLong_FromLong( (long)prop->data.val );
|
return PyLong_FromLong( (long)prop->data.val );
|
||||||
@ -483,9 +483,9 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
|
|||||||
switch (prop->type) {
|
switch (prop->type) {
|
||||||
case IDP_STRING:
|
case IDP_STRING:
|
||||||
#ifdef USE_STRING_COERCE
|
#ifdef USE_STRING_COERCE
|
||||||
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len);
|
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
|
||||||
#else
|
#else
|
||||||
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len);
|
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case IDP_FLOAT:
|
case IDP_FLOAT:
|
||||||
@ -625,11 +625,11 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* utility function */
|
/* utility function */
|
||||||
static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len)
|
static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len, const char *func)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
printf("ID Property Error found and corrected in BPy_IDGroup_GetKeys/Values/Items!\n");
|
printf("%s: ID Property Error found and corrected!\n", func);
|
||||||
|
|
||||||
/*fill rest of list with valid references to None*/
|
/*fill rest of list with valid references to None*/
|
||||||
for (j=len; j<prop->len; j++) {
|
for (j=len; j<prop->len; j++) {
|
||||||
@ -654,7 +654,7 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
|
|||||||
for (; loop; loop=loop->next, i++) {}
|
for (; loop; loop=loop->next, i++) {}
|
||||||
|
|
||||||
if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
|
if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
|
||||||
BPy_IDGroup_CorrectListLen(prop, seq, i);
|
BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
|
||||||
Py_DECREF(seq); /*free the list*/
|
Py_DECREF(seq); /*free the list*/
|
||||||
/*call self again*/
|
/*call self again*/
|
||||||
return BPy_Wrap_GetKeys(prop);
|
return BPy_Wrap_GetKeys(prop);
|
||||||
@ -674,7 +674,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i != prop->len) {
|
if (i != prop->len) {
|
||||||
BPy_IDGroup_CorrectListLen(prop, seq, i);
|
BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
|
||||||
Py_DECREF(seq); /*free the list*/
|
Py_DECREF(seq); /*free the list*/
|
||||||
/*call self again*/
|
/*call self again*/
|
||||||
return BPy_Wrap_GetValues(id, prop);
|
return BPy_Wrap_GetValues(id, prop);
|
||||||
@ -697,7 +697,7 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i != prop->len) {
|
if (i != prop->len) {
|
||||||
BPy_IDGroup_CorrectListLen(prop, seq, i);
|
BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
|
||||||
Py_DECREF(seq); /*free the list*/
|
Py_DECREF(seq); /*free the list*/
|
||||||
/*call self again*/
|
/*call self again*/
|
||||||
return BPy_Wrap_GetItems(id, prop);
|
return BPy_Wrap_GetItems(id, prop);
|
||||||
|
Loading…
Reference in New Issue
Block a user