forked from bartvdbraak/blender
fix own error r41191 getting id property string lengths.
This commit is contained in:
parent
65b92d820a
commit
9905094f5d
@ -1179,31 +1179,7 @@ class WM_OT_copy_prev_settings(Operator):
|
||||
|
||||
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):
|
||||
"Test keyconfig for conflicts"
|
||||
bl_idname = "wm.keyconfig_test"
|
||||
@ -1395,9 +1371,9 @@ class WM_OT_keyitem_add(Operator):
|
||||
km = context.keymap
|
||||
|
||||
if km.is_modal:
|
||||
km.keymap_items.new_modal("", 'A', 'PRESS') #~ kmi
|
||||
km.keymap_items.new_modal("", 'A', 'PRESS')
|
||||
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
|
||||
if context.space_data.filter_text != "":
|
||||
|
@ -737,7 +737,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, Panel):
|
||||
col = layout.column()
|
||||
col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
|
||||
col.prop(tex_slot, "angle", text="")
|
||||
|
||||
|
||||
#col = layout.column()
|
||||
#col.prop(brush, "use_random_rotation")
|
||||
#col.active = (not brush.use_rake) and (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'}) and tex_slot.map_mode in {'FIXED'}
|
||||
@ -749,11 +749,11 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, Panel):
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Sample Bias:")
|
||||
col.prop(brush, "texture_sample_bias", slider=True, text="")
|
||||
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
|
||||
col.label(text="Overlay:")
|
||||
|
||||
|
||||
row = col.row()
|
||||
if brush.use_texture_overlay:
|
||||
row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
|
||||
@ -972,7 +972,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, Panel):
|
||||
row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
|
||||
row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
|
||||
row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
|
||||
|
||||
|
||||
layout.column().prop(sculpt, "radial_symmetry", text="Radial")
|
||||
layout.prop(sculpt, "use_symmetry_feather", text="Feather")
|
||||
|
||||
|
@ -65,9 +65,9 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
|
||||
switch ( prop->type ) {
|
||||
case IDP_STRING:
|
||||
#ifdef USE_STRING_COERCE
|
||||
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len);
|
||||
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
|
||||
#else
|
||||
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len);
|
||||
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
|
||||
#endif
|
||||
case IDP_INT:
|
||||
return PyLong_FromLong( (long)prop->data.val );
|
||||
@ -483,9 +483,9 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
|
||||
switch (prop->type) {
|
||||
case IDP_STRING:
|
||||
#ifdef USE_STRING_COERCE
|
||||
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len);
|
||||
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
|
||||
#else
|
||||
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len);
|
||||
return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
|
||||
#endif
|
||||
break;
|
||||
case IDP_FLOAT:
|
||||
@ -625,11 +625,11 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
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*/
|
||||
for (j=len; j<prop->len; j++) {
|
||||
@ -654,7 +654,7 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
|
||||
for (; loop; loop=loop->next, i++) {}
|
||||
|
||||
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*/
|
||||
/*call self again*/
|
||||
return BPy_Wrap_GetKeys(prop);
|
||||
@ -674,7 +674,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop)
|
||||
}
|
||||
|
||||
if (i != prop->len) {
|
||||
BPy_IDGroup_CorrectListLen(prop, seq, i);
|
||||
BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
|
||||
Py_DECREF(seq); /*free the list*/
|
||||
/*call self again*/
|
||||
return BPy_Wrap_GetValues(id, prop);
|
||||
@ -697,7 +697,7 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop)
|
||||
}
|
||||
|
||||
if (i != prop->len) {
|
||||
BPy_IDGroup_CorrectListLen(prop, seq, i);
|
||||
BPy_IDGroup_CorrectListLen(prop, seq, i, __func__);
|
||||
Py_DECREF(seq); /*free the list*/
|
||||
/*call self again*/
|
||||
return BPy_Wrap_GetItems(id, prop);
|
||||
|
Loading…
Reference in New Issue
Block a user