Merge branch 'master' into blender2.8
This commit is contained in:
@@ -22,12 +22,10 @@ import bpy
|
||||
|
||||
def example_function(text, save_path, render_path):
|
||||
|
||||
scene = bpy.context.scene
|
||||
|
||||
# Clear existing objects.
|
||||
scene.camera = None
|
||||
for obj in scene.objects:
|
||||
scene.objects.unlink(obj)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
|
||||
scene = bpy.context.scene
|
||||
|
||||
txt_data = bpy.data.curves.new(name="MyText", type='FONT')
|
||||
|
||||
@@ -35,7 +33,7 @@ def example_function(text, save_path, render_path):
|
||||
txt_ob = bpy.data.objects.new(name="MyText", object_data=txt_data)
|
||||
scene.objects.link(txt_ob) # add the data to the scene as an object
|
||||
txt_data.body = text # the body text to the command line arg given
|
||||
txt_data.align = 'CENTER' # center text
|
||||
txt_data.align_x = 'CENTER' # center text
|
||||
|
||||
# Camera
|
||||
cam_data = bpy.data.cameras.new("MyCam")
|
||||
|
@@ -148,6 +148,9 @@ void BKE_brush_init(Brush *brush)
|
||||
BKE_brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* \note Resulting brush will have two users: one as a fake user, another is assumed to be used by the caller.
|
||||
*/
|
||||
Brush *BKE_brush_add(Main *bmain, const char *name, short ob_mode)
|
||||
{
|
||||
Brush *brush;
|
||||
@@ -1063,7 +1066,8 @@ struct ImBuf *BKE_brush_gen_radial_control_imbuf(Brush *br, bool secondary)
|
||||
for (i = 0; i < side; ++i) {
|
||||
for (j = 0; j < side; ++j) {
|
||||
const int col = texcache[i * side + j];
|
||||
im->rect_float[i * side + j] *= (((char *)&col)[0] + ((char *)&col)[1] + ((char *)&col)[2]) / 3.0f / 255.0f;
|
||||
im->rect_float[i * side + j] *=
|
||||
(((char *)&col)[0] + ((char *)&col)[1] + ((char *)&col)[2]) / 3.0f / 255.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -113,9 +113,9 @@ static void image_add_view(Image *ima, const char *viewname, const char *filepat
|
||||
/* quick lookup: supports 1 million frames, thousand passes */
|
||||
#define IMA_MAKE_INDEX(frame, index) (((frame) << 10) + (index))
|
||||
#define IMA_INDEX_FRAME(index) ((index) >> 10)
|
||||
/*
|
||||
#if 0
|
||||
#define IMA_INDEX_PASS(index) (index & ~1023)
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* ******** IMAGE CACHE ************* */
|
||||
|
||||
|
@@ -532,8 +532,10 @@ void BKE_paint_init(Scene *sce, ePaintMode mode, const char col[3])
|
||||
short ob_mode = BKE_paint_object_mode_from_paint_mode(mode);
|
||||
brush = BKE_brush_first_search(G.main, ob_mode);
|
||||
|
||||
if (!brush)
|
||||
if (!brush) {
|
||||
brush = BKE_brush_add(G.main, "Brush", ob_mode);
|
||||
id_us_min(&brush->id); /* fake user only */
|
||||
}
|
||||
BKE_paint_brush_set(paint, brush);
|
||||
}
|
||||
|
||||
|
@@ -128,7 +128,7 @@ bool BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2])
|
||||
|
||||
/**
|
||||
* \returns shortest distance from \a rect to x/y (0 if inside)
|
||||
*/
|
||||
*/
|
||||
|
||||
int BLI_rcti_length_x(const rcti *rect, const int x)
|
||||
{
|
||||
|
@@ -273,6 +273,7 @@ void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Fill");
|
||||
if (!br) {
|
||||
br = BKE_brush_add(bmain, "Fill", OB_MODE_TEXTURE_PAINT);
|
||||
id_us_min(&br->id); /* fake user only */
|
||||
br->imagepaint_tool = PAINT_TOOL_FILL;
|
||||
br->ob_mode = OB_MODE_TEXTURE_PAINT;
|
||||
}
|
||||
@@ -281,12 +282,14 @@ void BLO_update_defaults_startup_blend(Main *bmain)
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Average");
|
||||
if (!br) {
|
||||
br = BKE_brush_add(bmain, "Average", OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT);
|
||||
id_us_min(&br->id); /* fake user only */
|
||||
br->vertexpaint_tool = PAINT_BLEND_AVERAGE;
|
||||
br->ob_mode = OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT;
|
||||
}
|
||||
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Smear");
|
||||
if (!br) {
|
||||
br = BKE_brush_add(bmain, "Smear", OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT);
|
||||
id_us_min(&br->id); /* fake user only */
|
||||
br->vertexpaint_tool = PAINT_BLEND_SMEAR;
|
||||
br->ob_mode = OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT;
|
||||
}
|
||||
|
@@ -1692,7 +1692,7 @@ static void build_boundary_vertex_only(BevelParams *bp, BevVert *bv, bool constr
|
||||
* Special case of build_boundary when a single edge is beveled.
|
||||
* The 'width adjust' part of build_boundary has been done already,
|
||||
* and \a efirst is the first beveled edge at vertex \a bv.
|
||||
*/
|
||||
*/
|
||||
static void build_boundary_terminal_edge(BevelParams *bp, BevVert *bv, EdgeHalf *efirst, bool construct)
|
||||
{
|
||||
MemArena *mem_arena = bp->mem_arena;
|
||||
|
@@ -398,7 +398,7 @@ void EDBM_mesh_load(Object *ob)
|
||||
* of freed data on scene update, especially in cases when there are dependency
|
||||
* cycles.
|
||||
*/
|
||||
/*
|
||||
#if 0
|
||||
for (Object *other_object = G.main->object.first;
|
||||
other_object != NULL;
|
||||
other_object = other_object->id.next)
|
||||
@@ -407,7 +407,7 @@ void EDBM_mesh_load(Object *ob)
|
||||
BKE_object_free_derived_caches(other_object);
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -68,10 +68,13 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
Main *bmain = CTX_data_main(C);
|
||||
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
|
||||
|
||||
if (br)
|
||||
if (br) {
|
||||
br = BKE_brush_copy(bmain, br);
|
||||
else
|
||||
}
|
||||
else {
|
||||
br = BKE_brush_add(bmain, "Brush", BKE_paint_object_mode_from_paint_mode(mode));
|
||||
id_us_min(&br->id); /* fake user only */
|
||||
}
|
||||
|
||||
BKE_paint_brush_set(paint, br);
|
||||
|
||||
@@ -376,6 +379,7 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
|
||||
|
||||
if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) {
|
||||
brush = BKE_brush_add(bmain, tool_name, ob_mode);
|
||||
id_us_min(&brush->id); /* fake user only */
|
||||
brush_tool_set(brush, tool_offset, tool);
|
||||
brush->toggle_brush = brush_orig;
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@ typedef struct SculptUndoNode {
|
||||
} SculptUndoNode;
|
||||
|
||||
/* Factor of brush to have rake point following behind
|
||||
* (could be configurable but this is reasonable default). */
|
||||
* (could be configurable but this is reasonable default). */
|
||||
#define SCULPT_RAKE_BRUSH_FACTOR 0.25f
|
||||
|
||||
struct SculptRakeData {
|
||||
@@ -239,10 +239,10 @@ void sculpt_pbvh_calc_area_normal(
|
||||
float r_area_no[3]);
|
||||
|
||||
/* Cache stroke properties. Used because
|
||||
* RNA property lookup isn't particularly fast.
|
||||
*
|
||||
* For descriptions of these settings, check the operator properties.
|
||||
*/
|
||||
* RNA property lookup isn't particularly fast.
|
||||
*
|
||||
* For descriptions of these settings, check the operator properties.
|
||||
*/
|
||||
|
||||
typedef struct StrokeCache {
|
||||
/* Invariants */
|
||||
|
@@ -77,15 +77,15 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar)
|
||||
}
|
||||
|
||||
/* set color
|
||||
* - more intense for active/selected bones, less intense for unselected bones
|
||||
* - black for before current frame, green for current frame, blue for after current frame
|
||||
* - intensity decreases as distance from current frame increases
|
||||
*
|
||||
* If the user select custom color, the color is replaced for the color selected in UI panel
|
||||
* - 75% Darker color is used for previous frames
|
||||
* - 50% Darker color for current frame
|
||||
* - User selected color for next frames
|
||||
*/
|
||||
* - more intense for active/selected bones, less intense for unselected bones
|
||||
* - black for before current frame, green for current frame, blue for after current frame
|
||||
* - intensity decreases as distance from current frame increases
|
||||
*
|
||||
* If the user select custom color, the color is replaced for the color selected in UI panel
|
||||
* - 75% Darker color is used for previous frames
|
||||
* - 50% Darker color for current frame
|
||||
* - User selected color for next frames
|
||||
*/
|
||||
static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short sel, int sfra, int efra,
|
||||
float prev_color[3], float frame_color[3], float next_color[3], unsigned color)
|
||||
{
|
||||
|
@@ -141,7 +141,7 @@ struct SnapObjectContext {
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/** Common utilities
|
||||
* \{ */
|
||||
* \{ */
|
||||
|
||||
|
||||
typedef void(*IterSnapObjsCallback)(SnapObjectContext *sctx, bool is_obedit, Object *ob, float obmat[4][4], void *data);
|
||||
@@ -264,7 +264,7 @@ static int dm_looptri_to_poly_index(DerivedMesh *dm, const MLoopTri *lt);
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/** \name Ray Cast Funcs
|
||||
* \{ */
|
||||
* \{ */
|
||||
|
||||
/* Store all ray-hits
|
||||
* Support for storing all depths, not just the first (raycast 'all') */
|
||||
|
@@ -397,7 +397,7 @@ bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
|
||||
|
||||
/**
|
||||
* If needed, this adjusts \a r_mouse_xy so that drawn cursor and handled mouse position are matching visually.
|
||||
*/
|
||||
*/
|
||||
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int *r_mouse_xy)
|
||||
{
|
||||
if (!WM_stereo3d_enabled(win, false))
|
||||
|
Reference in New Issue
Block a user