Merge with trunk r39062
This commit is contained in:
@@ -253,6 +253,15 @@ if 'blenderlite' in B.targets:
|
||||
if k not in B.arguments:
|
||||
env[k] = v
|
||||
|
||||
# detect presence of 3D_CONNEXION_CLIENT_LIBRARY for OSX
|
||||
if env['OURPLATFORM']=='darwin':
|
||||
envi = Environment()
|
||||
conf = Configure(envi)
|
||||
if not conf.CheckCHeader('ConnexionClientAPI.h'): # CheckCXXHeader if it is c++ !
|
||||
print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
|
||||
env['WITH_BF_3DMOUSE'] = 0
|
||||
envi = conf.Finish()
|
||||
|
||||
|
||||
if env['WITH_BF_OPENMP'] == 1:
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
Physics Constraints (bge.constraints)
|
||||
=====================================
|
||||
|
||||
.. module:: bge.constraints
|
||||
|
||||
.. literalinclude:: ../examples/bge.constraints.py
|
||||
|
||||
.. function:: createConstraint(physicsid, physicsid2, constrainttype, [pivotX, pivotY, pivotZ, [axisX, axisY, axisZ, [flag]]]])
|
||||
|
||||
Creates a constraint.
|
||||
|
||||
@@ -36,6 +36,10 @@ When the texture object is deleted, the new texture is deleted and the old textu
|
||||
|
||||
.. module:: bge.texture
|
||||
|
||||
.. literalinclude:: ../examples/bge.texture.py
|
||||
|
||||
.. literalinclude:: ../examples/bge.texture.1.py
|
||||
|
||||
.. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0])
|
||||
|
||||
FFmpeg video source
|
||||
|
||||
@@ -15,7 +15,7 @@ collections of tutorials.
|
||||
The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning
|
||||
OpenGL}" and the online NeHe tutorials are two of the best resources.
|
||||
|
||||
..note::
|
||||
.. note::
|
||||
You can use the :class:`Image` type to load and set textures.
|
||||
See :class:`Image.gl_load` and :class:`Image.gl_load`,
|
||||
for example.
|
||||
@@ -1386,7 +1386,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
|
||||
bgl.glGetFloatv(bgl.GL_MODELVIEW_MATRIX, view_matrix)
|
||||
f = 1.0 / view_matrix[0]
|
||||
|
||||
# Instead of the usual glRasterPos2i(xval, yval)
|
||||
# Instead of the usual glRasterPos2i(xval, yval)
|
||||
bgl.glRasterPos2f(xval * f, yval * f)
|
||||
|
||||
|
||||
@@ -1848,10 +1848,13 @@ class Buffer:
|
||||
.. code-block:: python
|
||||
|
||||
import bgl
|
||||
|
||||
myByteBuffer = bgl.Buffer(bgl.GL_BYTE, [32, 32])
|
||||
bgl.glGetPolygonStipple(myByteBuffer)
|
||||
|
||||
print(myByteBuffer.dimensions)
|
||||
print(myByteBuffer.to_list())
|
||||
|
||||
sliceBuffer = myByteBuffer[0:16]
|
||||
print(sliceBuffer)
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WITH_INPUT_NDOF // use contents of this file
|
||||
|
||||
#include "GHOST_NDOFManagerWin32.h"
|
||||
|
||||
|
||||
@@ -39,3 +41,5 @@ bool GHOST_NDOFManagerWin32::available()
|
||||
// always available since RawInput is built into Windows
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // WITH_INPUT_NDOF
|
||||
|
||||
@@ -22,10 +22,13 @@
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _GHOST_NDOFMANAGERWIN32_H_
|
||||
#define _GHOST_NDOFMANAGERWIN32_H_
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
|
||||
#include "GHOST_NDOFManager.h"
|
||||
|
||||
|
||||
@@ -37,4 +40,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif // WITH_INPUT_NDOF
|
||||
#endif // #include guard
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "GHOST_Debug.h"
|
||||
#include "GHOST_DisplayManagerWin32.h"
|
||||
#include "GHOST_EventButton.h"
|
||||
#include "GHOST_EventCursor.h"
|
||||
@@ -72,7 +71,10 @@
|
||||
#include "GHOST_TimerManager.h"
|
||||
#include "GHOST_WindowManager.h"
|
||||
#include "GHOST_WindowWin32.h"
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
#include "GHOST_NDOFManagerWin32.h"
|
||||
#endif
|
||||
|
||||
// Key code values not found in winuser.h
|
||||
#ifndef VK_MINUS
|
||||
@@ -127,22 +129,32 @@
|
||||
|
||||
static void initRawInput()
|
||||
{
|
||||
RAWINPUTDEVICE devices[2];
|
||||
memset(devices, 0, 2 * sizeof(RAWINPUTDEVICE));
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
#define DEVICE_COUNT 2
|
||||
#else
|
||||
#define DEVICE_COUNT 1
|
||||
#endif
|
||||
|
||||
// multi-axis mouse (SpaceNavigator, etc.)
|
||||
devices[0].usUsagePage = 0x01;
|
||||
devices[0].usUsage = 0x08;
|
||||
RAWINPUTDEVICE devices[DEVICE_COUNT];
|
||||
memset(devices, 0, DEVICE_COUNT * sizeof(RAWINPUTDEVICE));
|
||||
|
||||
// Initiates WM_INPUT messages from keyboard
|
||||
// That way GHOST can retrieve true keys
|
||||
devices[1].usUsagePage = 0x01;
|
||||
devices[1].usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */
|
||||
devices[0].usUsagePage = 0x01;
|
||||
devices[0].usUsage = 0x06; /* http://msdn.microsoft.com/en-us/windows/hardware/gg487473.aspx */
|
||||
|
||||
if (RegisterRawInputDevices(devices, 2, sizeof(RAWINPUTDEVICE)))
|
||||
puts("registered for RawInput (spacenav & keyboard)");
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
// multi-axis mouse (SpaceNavigator, etc.)
|
||||
devices[1].usUsagePage = 0x01;
|
||||
devices[1].usUsage = 0x08;
|
||||
#endif
|
||||
|
||||
if (RegisterRawInputDevices(devices, DEVICE_COUNT, sizeof(RAWINPUTDEVICE)))
|
||||
; // yay!
|
||||
else
|
||||
printf("could not register for RawInput: %d\n", (int)GetLastError());
|
||||
|
||||
#undef DEVICE_COUNT
|
||||
}
|
||||
|
||||
GHOST_SystemWin32::GHOST_SystemWin32()
|
||||
@@ -808,6 +820,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
||||
case 1: // translation
|
||||
{
|
||||
short* axis = (short*)(data + 1);
|
||||
// massage into blender view coords (same goes for rotation)
|
||||
short t[3] = {axis[0], -axis[2], axis[1]};
|
||||
m_ndofManager->updateTranslation(t, now);
|
||||
|
||||
@@ -830,14 +843,6 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
||||
}
|
||||
case 3: // buttons
|
||||
{
|
||||
#if 0
|
||||
// I'm getting garbage bits -- examine whole report:
|
||||
printf("ndof: HID report for buttons [");
|
||||
for (int i = 0; i < raw.data.hid.dwSizeHid; ++i)
|
||||
printf(" %02X", data[i]);
|
||||
printf(" ]\n");
|
||||
#endif
|
||||
|
||||
int button_bits;
|
||||
memcpy(&button_bits, data + 1, sizeof(button_bits));
|
||||
m_ndofManager->updateButtons(button_bits, now);
|
||||
@@ -892,12 +897,12 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
GHOST_PRINT(" key ignored\n")
|
||||
}
|
||||
break;
|
||||
case RIM_TYPEHID:
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
case RIM_TYPEHID:
|
||||
if (system->processNDOF(raw))
|
||||
eventHandled = true;
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -88,8 +88,9 @@ class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Shading:")
|
||||
col.operator("object.shade_smooth", text="Smooth")
|
||||
col.operator("object.shade_flat", text="Flat")
|
||||
row = col.row(align=True)
|
||||
row.operator("object.shade_smooth", text="Smooth")
|
||||
row.operator("object.shade_flat", text="Flat")
|
||||
|
||||
draw_keyframing_tools(context, layout)
|
||||
|
||||
@@ -155,8 +156,9 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Shading:")
|
||||
col.operator("mesh.faces_shade_smooth", text="Smooth")
|
||||
col.operator("mesh.faces_shade_flat", text="Flat")
|
||||
row = col.row(align=True)
|
||||
row.operator("mesh.faces_shade_smooth", text="Smooth")
|
||||
row.operator("mesh.faces_shade_flat", text="Flat")
|
||||
|
||||
draw_repeat_tools(context, layout)
|
||||
|
||||
|
||||
@@ -211,7 +211,16 @@ int BLO_has_bfile_extension(char *str);
|
||||
*/
|
||||
int BLO_is_a_library(const char *path, char *dir, char *group);
|
||||
|
||||
struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, const char *filepath);
|
||||
|
||||
/**
|
||||
* Initialize the BlendHandle for appending or linking library data.
|
||||
*
|
||||
* @param mainvar The current main database eg G.main or CTX_data_main(C).
|
||||
* @param bh A blender file handle as returned by BLO_blendhandle_from_file or BLO_blendhandle_from_memory.
|
||||
* @param filepath Used for relative linking, copied to the lib->name
|
||||
* @return the library Main, to be passed to BLO_library_append_named_part as mainl.
|
||||
*/
|
||||
struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, const char *filepath);
|
||||
|
||||
|
||||
/**
|
||||
@@ -243,11 +252,6 @@ void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendH
|
||||
|
||||
void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
|
||||
|
||||
/* deprecated */
|
||||
#if 1
|
||||
void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Main *mainvar, struct Scene *scene, struct ReportList *reports);
|
||||
#endif
|
||||
|
||||
BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -13013,9 +13013,8 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
|
||||
|
||||
/* common routine to append/link something from a library */
|
||||
|
||||
static Main* library_append_begin(const bContext *C, FileData **fd, const char *filepath)
|
||||
static Main* library_append_begin(Main *mainvar, FileData **fd, const char *filepath)
|
||||
{
|
||||
Main *mainvar= CTX_data_main(C);
|
||||
Main *mainl;
|
||||
|
||||
/* make mains */
|
||||
@@ -13031,64 +13030,17 @@ static Main* library_append_begin(const bContext *C, FileData **fd, const char *
|
||||
return mainl;
|
||||
}
|
||||
|
||||
Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, const char *filepath)
|
||||
Main* BLO_library_append_begin(Main *mainvar, BlendHandle** bh, const char *filepath)
|
||||
{
|
||||
FileData *fd= (FileData*)(*bh);
|
||||
return library_append_begin(C, &fd, filepath);
|
||||
return library_append_begin(mainvar, &fd, filepath);
|
||||
}
|
||||
|
||||
static void append_do_cursor(Scene *scene, Library *curlib, short flag)
|
||||
{
|
||||
Base *centerbase;
|
||||
Object *ob;
|
||||
float *curs, centerloc[3], vec[3], min[3], max[3];
|
||||
int count= 0;
|
||||
|
||||
/* when not linking (appending)... */
|
||||
if(flag & FILE_LINK)
|
||||
return;
|
||||
|
||||
/* we're not appending at cursor */
|
||||
if((flag & FILE_ATCURSOR) == 0)
|
||||
return;
|
||||
|
||||
/* find the center of everything appended */
|
||||
INIT_MINMAX(min, max);
|
||||
centerbase= (scene->base.first);
|
||||
while(centerbase) {
|
||||
if(centerbase->object->id.lib==curlib && centerbase->object->parent==NULL) {
|
||||
VECCOPY(vec, centerbase->object->loc);
|
||||
DO_MINMAX(vec, min, max);
|
||||
count++;
|
||||
}
|
||||
centerbase= centerbase->next;
|
||||
}
|
||||
/* we haven't found any objects to move to cursor */
|
||||
if(!count)
|
||||
return;
|
||||
|
||||
/* move from the center of the appended objects to cursor */
|
||||
mid_v3_v3v3(centerloc, min, max);
|
||||
curs = scene->cursor;
|
||||
VECSUB(centerloc,curs,centerloc);
|
||||
|
||||
/* now translate the center of the objects */
|
||||
centerbase= (scene->base.first);
|
||||
while(centerbase) {
|
||||
if(centerbase->object->id.lib==curlib && centerbase->object->parent==NULL) {
|
||||
ob= centerbase->object;
|
||||
ob->loc[0] += centerloc[0];
|
||||
ob->loc[1] += centerloc[1];
|
||||
ob->loc[2] += centerloc[2];
|
||||
}
|
||||
centerbase= centerbase->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Context == NULL signifies not to do any scene manipulation */
|
||||
static void library_append_end(const bContext *C, Main *mainl, FileData **fd, int idcode, short flag)
|
||||
{
|
||||
Main *mainvar;
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Library *curlib;
|
||||
|
||||
/* make main consistent */
|
||||
@@ -13117,22 +13069,26 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
|
||||
lib_verify_nodetree(mainvar, FALSE);
|
||||
fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
|
||||
|
||||
/* give a base to loose objects. If group append, do it for objects too */
|
||||
if(scene) {
|
||||
const short is_link= (flag & FILE_LINK) != 0;
|
||||
if(idcode==ID_SCE) {
|
||||
/* dont instance anything when linking in scenes, assume the scene its self instances the data */
|
||||
}
|
||||
else {
|
||||
give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
|
||||
if(C) {
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
if (flag & FILE_GROUP_INSTANCE) {
|
||||
give_base_to_groups(mainvar, scene);
|
||||
/* give a base to loose objects. If group append, do it for objects too */
|
||||
if(scene) {
|
||||
const short is_link= (flag & FILE_LINK) != 0;
|
||||
if(idcode==ID_SCE) {
|
||||
/* dont instance anything when linking in scenes, assume the scene its self instances the data */
|
||||
}
|
||||
else {
|
||||
give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
|
||||
|
||||
if (flag & FILE_GROUP_INSTANCE) {
|
||||
give_base_to_groups(mainvar, scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("library_append_end, scene is NULL (objects wont get bases)\n");
|
||||
else {
|
||||
printf("library_append_end, scene is NULL (objects wont get bases)\n");
|
||||
}
|
||||
}
|
||||
/* has been removed... erm, why? s..ton) */
|
||||
/* 20040907: looks like they are give base already in append_named_part(); -Nathan L */
|
||||
@@ -13143,8 +13099,6 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
|
||||
blo_freefiledata( *fd );
|
||||
*fd = NULL;
|
||||
}
|
||||
|
||||
append_do_cursor(scene, curlib, flag);
|
||||
}
|
||||
|
||||
void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag)
|
||||
|
||||
@@ -1649,10 +1649,10 @@ static int open_exec(bContext *C, wmOperator *op)
|
||||
VFont *font;
|
||||
PropertyPointerRNA *pprop;
|
||||
PointerRNA idptr;
|
||||
char str[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", str);
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
|
||||
font = load_vfont(str);
|
||||
font= load_vfont(filepath);
|
||||
|
||||
if(!font) {
|
||||
if(op->customdata) MEM_freeN(op->customdata);
|
||||
|
||||
@@ -242,7 +242,9 @@ enum {
|
||||
|
||||
TH_DRAWEXTRA_EDGELEN,
|
||||
TH_DRAWEXTRA_FACEAREA,
|
||||
TH_DRAWEXTRA_FACEANG
|
||||
TH_DRAWEXTRA_FACEANG,
|
||||
|
||||
TH_NODE_CURVING
|
||||
};
|
||||
/* XXX WARNING: previous is saved in file, so do not change order! */
|
||||
|
||||
|
||||
@@ -360,7 +360,9 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
|
||||
cp= ts->syntaxv; break;
|
||||
case TH_NODE_GROUP:
|
||||
cp= ts->syntaxc; break;
|
||||
|
||||
case TH_NODE_CURVING:
|
||||
cp= &ts->noodle_curving; break;
|
||||
|
||||
case TH_SEQ_MOVIE:
|
||||
cp= ts->movie; break;
|
||||
case TH_SEQ_IMAGE:
|
||||
@@ -787,6 +789,7 @@ void ui_theme_init_default(void)
|
||||
SETCOL(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */
|
||||
SETCOL(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */
|
||||
SETCOL(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */
|
||||
btheme->tnode.noodle_curving = 5;
|
||||
|
||||
/* space logic */
|
||||
btheme->tlogic= btheme->tv3d;
|
||||
@@ -1553,7 +1556,14 @@ void init_userdef_do_versions(void)
|
||||
/* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
|
||||
U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
|
||||
}
|
||||
|
||||
|
||||
if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
|
||||
bTheme *btheme;
|
||||
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
||||
btheme->tnode.noodle_curving = 5;
|
||||
}
|
||||
}
|
||||
|
||||
/* GL Texture Garbage Collection (variable abused above!) */
|
||||
if (U.textimeout == 0) {
|
||||
U.texcollectrate = 60;
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* for events */
|
||||
#define NOTACTIVEFILE 0
|
||||
@@ -1079,8 +1080,18 @@ static void file_expand_directory(bContext *C)
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (sfile->params->dir[0] == '\0')
|
||||
if (sfile->params->dir[0] == '\0') {
|
||||
get_default_root(sfile->params->dir);
|
||||
}
|
||||
/* change "C:" --> "C:\", [#28102] */
|
||||
else if ( (isalpha(sfile->params->dir[0]) &&
|
||||
(sfile->params->dir[1] == ':')) &&
|
||||
(sfile->params->dir[2] == '\0')
|
||||
|
||||
) {
|
||||
sfile->params->dir[2]= '\\';
|
||||
sfile->params->dir[3]= '\0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1768,8 +1768,8 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
|
||||
vec[3][0]= snode->mx;
|
||||
vec[3][1]= snode->my;
|
||||
}
|
||||
|
||||
dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
|
||||
|
||||
dist= UI_GetThemeValue(TH_NODE_CURVING)*0.10f*ABS(vec[0][0] - vec[3][0]);
|
||||
|
||||
/* check direction later, for top sockets */
|
||||
vec[1][0]= vec[0][0]+dist;
|
||||
|
||||
@@ -1785,7 +1785,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
|
||||
se = give_stripelem(seq, cfra);
|
||||
|
||||
seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
|
||||
BLI_addtail(&ed->seqbase, seq_new);
|
||||
BLI_addtail(ed->seqbasep, seq_new);
|
||||
|
||||
seq_new->start= start_ofs;
|
||||
seq_new->type= SEQ_IMAGE;
|
||||
@@ -1839,7 +1839,6 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
|
||||
ot->description="On image sequences strips, it return a strip for each image";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= WM_operator_props_popup;
|
||||
ot->exec= sequencer_separate_images_exec;
|
||||
ot->poll= sequencer_edit_poll;
|
||||
|
||||
|
||||
@@ -703,7 +703,7 @@ enum FileSortTypeE {
|
||||
#define FILE_HIDE_DOT (1<<3)
|
||||
#define FILE_AUTOSELECT (1<<4)
|
||||
#define FILE_ACTIVELAY (1<<5)
|
||||
#define FILE_ATCURSOR (1<<6)
|
||||
/* #define FILE_ATCURSOR (1<<6) */ /* deprecated */
|
||||
#define FILE_DIRSEL_ONLY (1<<7)
|
||||
#define FILE_FILTER (1<<8)
|
||||
#define FILE_BOOKMARKS (1<<9)
|
||||
|
||||
@@ -220,7 +220,7 @@ typedef struct ThemeSpace {
|
||||
char console_cursor[4];
|
||||
|
||||
char vertex_size, outline_width, facedot_size;
|
||||
char bpad;
|
||||
char noodle_curving;
|
||||
|
||||
char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes
|
||||
char syntaxv[4], syntaxc[4];
|
||||
|
||||
@@ -4007,10 +4007,13 @@ void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||
|
||||
if(prop)
|
||||
if(prop) {
|
||||
RNA_property_string_get(ptr, prop, value);
|
||||
else
|
||||
}
|
||||
else {
|
||||
printf("RNA_string_get: %s.%s not found.\n", ptr->type->identifier, name);
|
||||
value[0]= '\0';
|
||||
}
|
||||
}
|
||||
|
||||
char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen)
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
|
||||
// #include "ED_mesh.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -544,7 +544,8 @@ void RNA_api_object(StructRNA *srna)
|
||||
/* location of point for test and max distance */
|
||||
parm= RNA_def_float_vector(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
RNA_def_float(func, "max_dist", sqrt(FLT_MAX), 0.0, FLT_MAX, "", "", 0.0, FLT_MAX);
|
||||
/* default is sqrt(FLT_MAX) */
|
||||
RNA_def_float(func, "max_dist", 1.844674352395373e+19, 0.0, FLT_MAX, "", "", 0.0, FLT_MAX);
|
||||
|
||||
/* return location and normal */
|
||||
parm= RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4);
|
||||
|
||||
@@ -1351,6 +1351,13 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Group Node", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop= RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
|
||||
RNA_def_property_int_default(prop, 5);
|
||||
RNA_def_property_range(prop, 0, 10);
|
||||
RNA_def_property_ui_text(prop, "Noodle curving", "Curving of the noodle");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_theme_space_logic(BlenderRNA *brna)
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
|
||||
#include "bpy_driver.h"
|
||||
|
||||
#include "../generic/py_capi_utils.h"
|
||||
|
||||
/* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */
|
||||
PyObject *bpy_pydriver_Dict= NULL;
|
||||
|
||||
@@ -89,7 +87,7 @@ int bpy_pydriver_create_dict(void)
|
||||
void BPY_driver_reset(void)
|
||||
{
|
||||
PyGILState_STATE gilstate;
|
||||
int use_gil= !PYC_INTERPRETER_ACTIVE;
|
||||
int use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
|
||||
|
||||
if(use_gil)
|
||||
gilstate= PyGILState_Ensure();
|
||||
@@ -120,9 +118,14 @@ static void pydriver_error(ChannelDriver *driver)
|
||||
/* This evals py driver expressions, 'expr' is a Python expression that
|
||||
* should evaluate to a float number, which is returned.
|
||||
*
|
||||
* note: PyGILState_Ensure() isnt always called because python can call the
|
||||
* bake operator which intern starts a thread which calls scene update which
|
||||
* does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE if PyGILState_Ensure() is needed.
|
||||
* (old)note: PyGILState_Ensure() isnt always called because python can call
|
||||
* the bake operator which intern starts a thread which calls scene update
|
||||
* which does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE
|
||||
* if PyGILState_Ensure() is needed - see [#27683]
|
||||
*
|
||||
* (new)note: checking if python is running is not threadsafe [#28114]
|
||||
* now release the GIL on python operator execution instead, using
|
||||
* PyEval_SaveThread() / PyEval_RestoreThread() so we dont lock up blender.
|
||||
*/
|
||||
float BPY_driver_exec(ChannelDriver *driver)
|
||||
{
|
||||
@@ -149,7 +152,7 @@ float BPY_driver_exec(ChannelDriver *driver)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
use_gil= !PYC_INTERPRETER_ACTIVE;
|
||||
use_gil= 1; /* !PYC_INTERPRETER_ACTIVE; */
|
||||
|
||||
if(use_gil)
|
||||
gilstate= PyGILState_Ensure();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_idcode.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
@@ -317,7 +318,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
|
||||
flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
|
||||
|
||||
/* here appending/linking starts */
|
||||
mainl= BLO_library_append_begin(BPy_GetContext(), &(self->blo_handle), self->relpath);
|
||||
mainl= BLO_library_append_begin(CTX_data_main(BPy_GetContext()), &(self->blo_handle), self->relpath);
|
||||
|
||||
{
|
||||
int i= 0, code;
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_context.h"
|
||||
|
||||
/* so operators called can spawn threads which aquire the GIL */
|
||||
#define BPY_RELEASE_GIL
|
||||
|
||||
|
||||
static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
@@ -219,7 +223,22 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
||||
reports= MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
|
||||
BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these dont move into global reports */
|
||||
|
||||
operator_ret= WM_operator_call_py(C, ot, context, &ptr, reports);
|
||||
#ifdef BPY_RELEASE_GIL
|
||||
/* release GIL, since a thread could be started from an operator
|
||||
* that updates a driver */
|
||||
/* note: I havve not seen any examples of code that does this
|
||||
* so it may not be officially supported but seems to work ok. */
|
||||
{
|
||||
PyThreadState *ts= PyEval_SaveThread();
|
||||
#endif
|
||||
|
||||
operator_ret= WM_operator_call_py(C, ot, context, &ptr, reports);
|
||||
|
||||
#ifdef BPY_RELEASE_GIL
|
||||
/* regain GIL */
|
||||
PyEval_RestoreThread(ts);
|
||||
}
|
||||
#endif
|
||||
|
||||
error_val= BPy_reports_to_error(reports, PyExc_RuntimeError, FALSE);
|
||||
|
||||
|
||||
@@ -1621,7 +1621,6 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
|
||||
int idcode, totfiles=0;
|
||||
short flag;
|
||||
|
||||
name[0] = '\0';
|
||||
RNA_string_get(op->ptr, "filename", name);
|
||||
RNA_string_get(op->ptr, "directory", dir);
|
||||
|
||||
@@ -1690,7 +1689,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
|
||||
flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
|
||||
|
||||
/* here appending/linking starts */
|
||||
mainl = BLO_library_append_begin(C, &bh, libname);
|
||||
mainl = BLO_library_append_begin(bmain, &bh, libname);
|
||||
if(totfiles == 0) {
|
||||
BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
|
||||
}
|
||||
|
||||
@@ -950,7 +950,6 @@ bool KX_BlenderSceneConverter::LinkBlendFilePath(const char *path, char *group,
|
||||
|
||||
bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options)
|
||||
{
|
||||
bContext *C;
|
||||
Main *main_newlib; /* stored as a dynamic 'main' until we free it */
|
||||
Main *main_tmp= NULL; /* created only for linking, then freed */
|
||||
LinkNode *names = NULL;
|
||||
@@ -981,12 +980,10 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
|
||||
}
|
||||
|
||||
main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain");
|
||||
C= CTX_create();
|
||||
CTX_data_main_set(C, main_newlib);
|
||||
BKE_reports_init(&reports, RPT_STORE);
|
||||
|
||||
/* here appending/linking starts */
|
||||
main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path);
|
||||
main_tmp = BLO_library_append_begin(main_newlib, &bpy_openlib, (char *)path);
|
||||
|
||||
int totnames_dummy;
|
||||
names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode, &totnames_dummy);
|
||||
@@ -1000,11 +997,11 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
|
||||
}
|
||||
BLI_linklist_free(names, free); /* free linklist *and* each node's data */
|
||||
|
||||
BLO_library_append_end(C, main_tmp, &bpy_openlib, idcode, flag);
|
||||
BLO_library_append_end(NULL, main_tmp, &bpy_openlib, idcode, flag);
|
||||
|
||||
/* now do another round of linking for Scenes so all actions are properly loaded */
|
||||
if (idcode==ID_SCE && options & LIB_LOAD_LOAD_ACTIONS) {
|
||||
main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path);
|
||||
main_tmp = BLO_library_append_begin(main_newlib, &bpy_openlib, (char *)path);
|
||||
|
||||
int totnames_dummy;
|
||||
names = BLO_blendhandle_get_datablock_names( bpy_openlib, ID_AC, &totnames_dummy);
|
||||
@@ -1018,12 +1015,11 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
|
||||
}
|
||||
BLI_linklist_free(names, free); /* free linklist *and* each node's data */
|
||||
|
||||
BLO_library_append_end(C, main_tmp, &bpy_openlib, ID_AC, flag);
|
||||
BLO_library_append_end(NULL, main_tmp, &bpy_openlib, ID_AC, flag);
|
||||
}
|
||||
|
||||
BLO_blendhandle_close(bpy_openlib);
|
||||
|
||||
CTX_free(C);
|
||||
|
||||
BKE_reports_clear(&reports);
|
||||
/* done linking */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user