Merge branch 'master' into blender2.8
This commit is contained in:
@@ -98,6 +98,7 @@ def main():
|
||||
|
||||
blenver = blenver_zip = ""
|
||||
api_name = ""
|
||||
branch = ""
|
||||
is_release = False
|
||||
|
||||
# I) Update local mirror using rsync.
|
||||
@@ -119,6 +120,7 @@ def main():
|
||||
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
|
||||
" branch = bpy.app.build_branch.split()[0].decode()\n"
|
||||
" f.write('%d\\n' % is_release)\n"
|
||||
" f.write('%s\\n' % branch)\n"
|
||||
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||
" if is_release else '%s\\n' % branch)\n"
|
||||
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||
@@ -127,7 +129,7 @@ def main():
|
||||
"--python-expr", getver_script, "--", getver_file)
|
||||
subprocess.run(get_ver_cmd)
|
||||
with open(getver_file) as f:
|
||||
is_release, blenver, blenver_zip = f.read().split("\n")
|
||||
is_release, branch, blenver, blenver_zip = f.read().split("\n")
|
||||
is_release = bool(int(is_release))
|
||||
os.remove(getver_file)
|
||||
|
||||
@@ -166,7 +168,7 @@ def main():
|
||||
with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f:
|
||||
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
|
||||
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
|
||||
else:
|
||||
elif branch == "master":
|
||||
with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f:
|
||||
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
|
||||
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
|
||||
|
||||
@@ -905,12 +905,13 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
|
||||
* can not control.
|
||||
*/
|
||||
typedef StackAllocator<256, int> LeafStackAllocator;
|
||||
typedef StackAllocator<256, float2> LeafTimeStackAllocator;
|
||||
typedef StackAllocator<256, BVHReference> LeafReferenceStackAllocator;
|
||||
|
||||
vector<int, LeafStackAllocator> p_type[PRIMITIVE_NUM_TOTAL];
|
||||
vector<int, LeafStackAllocator> p_index[PRIMITIVE_NUM_TOTAL];
|
||||
vector<int, LeafStackAllocator> p_object[PRIMITIVE_NUM_TOTAL];
|
||||
vector<float2, LeafStackAllocator> p_time[PRIMITIVE_NUM_TOTAL];
|
||||
vector<float2, LeafTimeStackAllocator> p_time[PRIMITIVE_NUM_TOTAL];
|
||||
vector<BVHReference, LeafReferenceStackAllocator> p_ref[PRIMITIVE_NUM_TOTAL];
|
||||
|
||||
/* TODO(sergey): In theory we should be able to store references. */
|
||||
@@ -964,7 +965,7 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
|
||||
vector<int, LeafStackAllocator> local_prim_type,
|
||||
local_prim_index,
|
||||
local_prim_object;
|
||||
vector<float2, LeafStackAllocator> local_prim_time;
|
||||
vector<float2, LeafTimeStackAllocator> local_prim_time;
|
||||
local_prim_type.resize(num_new_prims);
|
||||
local_prim_index.resize(num_new_prims);
|
||||
local_prim_object.resize(num_new_prims);
|
||||
|
||||
@@ -54,7 +54,8 @@ ccl_device_inline void compute_light_pass(KernelGlobals *kg,
|
||||
float rbsdf = path_state_rng_1D(kg, &rng, &state, PRNG_BSDF);
|
||||
shader_eval_surface(kg, sd, &rng, &state, rbsdf, state.flag, SHADER_CONTEXT_MAIN);
|
||||
|
||||
/* TODO, disable the closures we won't need */
|
||||
/* TODO, disable more closures we don't need besides transparent */
|
||||
shader_bsdf_disable_transparency(kg, sd);
|
||||
|
||||
#ifdef __BRANCHED_PATH__
|
||||
if(!kernel_data.integrator.branched) {
|
||||
|
||||
@@ -685,6 +685,18 @@ ccl_device float3 shader_bsdf_transparency(KernelGlobals *kg, ShaderData *sd)
|
||||
return eval;
|
||||
}
|
||||
|
||||
ccl_device void shader_bsdf_disable_transparency(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
for(int i = 0; i < ccl_fetch(sd, num_closure); i++) {
|
||||
ShaderClosure *sc = ccl_fetch_array(sd, closure, i);
|
||||
|
||||
if(sc->type == CLOSURE_BSDF_TRANSPARENT_ID) {
|
||||
sc->sample_weight = 0.0f;
|
||||
sc->weight = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device float3 shader_bsdf_alpha(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
float3 alpha = make_float3(1.0f, 1.0f, 1.0f) - shader_bsdf_transparency(kg, sd);
|
||||
|
||||
@@ -43,7 +43,9 @@ template <> class StaticAssertFailure<true> {};
|
||||
# endif /* __COUNTER__ */
|
||||
# endif /* C++11 or MSVC2015 */
|
||||
#else /* __KERNEL_GPU__ */
|
||||
# define static_assert(statement, message)
|
||||
# ifndef static_assert
|
||||
# define static_assert(statement, message)
|
||||
# endif
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
/* TODO(sergey): For until C++11 is a bare minimum for us,
|
||||
|
||||
@@ -274,6 +274,8 @@ def basic_force_field_settings_ui(self, context, field):
|
||||
col.prop(field, "use_global_coords", text="Global")
|
||||
elif field.type == 'HARMONIC':
|
||||
col.prop(field, "use_multiple_springs")
|
||||
if field.type == 'FORCE':
|
||||
col.prop(field, "use_gravity_falloff", text="Gravitation")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
||||
@@ -327,6 +327,11 @@ static void read_custom_data_ex(const ICompoundProperty &prop,
|
||||
}
|
||||
else if (data_type == CD_MLOOPUV) {
|
||||
IV2fGeomParam uv_param(prop, prop_header.getName());
|
||||
|
||||
if (!uv_param.isIndexed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
IV2fGeomParam::Sample sample;
|
||||
uv_param.getIndexed(sample, iss);
|
||||
|
||||
|
||||
@@ -691,7 +691,7 @@ static void assign_materials(Main *bmain, Object *ob, const std::map<std::string
|
||||
assigned_name = mat_iter->second;
|
||||
}
|
||||
|
||||
assign_material(ob, assigned_name, it->second, BKE_MAT_ASSIGN_OBJECT);
|
||||
assign_material(ob, assigned_name, it->second, BKE_MAT_ASSIGN_OBDATA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ extern "C" {
|
||||
#include "DNA_layer_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "PIL_time.h"
|
||||
}
|
||||
|
||||
std::string get_id_name(Object *ob)
|
||||
@@ -512,3 +514,15 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe
|
||||
|
||||
return reader;
|
||||
}
|
||||
|
||||
/* ********************** */
|
||||
|
||||
ScopeTimer::ScopeTimer(const char *message)
|
||||
: m_message(message)
|
||||
, m_start(PIL_check_seconds_timer())
|
||||
{}
|
||||
|
||||
ScopeTimer::~ScopeTimer()
|
||||
{
|
||||
fprintf(stderr, "%s: %fs\n", m_message, PIL_check_seconds_timer() - m_start);
|
||||
}
|
||||
|
||||
@@ -146,4 +146,23 @@ ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3])
|
||||
yup[2] = -zup[1];
|
||||
}
|
||||
|
||||
/* *************************** */
|
||||
|
||||
#undef ABC_DEBUG_TIME
|
||||
|
||||
class ScopeTimer {
|
||||
const char *m_message;
|
||||
double m_start;
|
||||
|
||||
public:
|
||||
ScopeTimer(const char *message);
|
||||
~ScopeTimer();
|
||||
};
|
||||
|
||||
#ifdef ABC_DEBUG_TIME
|
||||
# define SCOPE_TIMER(message) ScopeTimer prof(message)
|
||||
#else
|
||||
# define SCOPE_TIMER(message)
|
||||
#endif
|
||||
|
||||
#endif /* __ABC_UTIL_H__ */
|
||||
|
||||
@@ -558,6 +558,8 @@ ABC_INLINE bool is_mesh_and_strands(const IObject &object)
|
||||
|
||||
static void import_startjob(void *user_data, short *stop, short *do_update, float *progress)
|
||||
{
|
||||
SCOPE_TIMER("Alembic import, objects reading and creation");
|
||||
|
||||
ImportJobData *data = static_cast<ImportJobData *>(user_data);
|
||||
|
||||
data->stop = stop;
|
||||
@@ -693,6 +695,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
|
||||
|
||||
static void import_endjob(void *user_data)
|
||||
{
|
||||
SCOPE_TIMER("Alembic import, cleanup");
|
||||
|
||||
ImportJobData *data = static_cast<ImportJobData *>(user_data);
|
||||
|
||||
std::vector<AbcObjectReader *>::iterator iter;
|
||||
|
||||
@@ -848,6 +848,14 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
|
||||
break;
|
||||
case PFIELD_FORCE:
|
||||
normalize_v3(force);
|
||||
if (pd->flag & PFIELD_GRAVITATION){ /* Option: Multiply by 1/distance^2 */
|
||||
if (efd->distance < FLT_EPSILON){
|
||||
strength = 0.0f;
|
||||
}
|
||||
else {
|
||||
strength *= powf(efd->distance, -2.0f);
|
||||
}
|
||||
}
|
||||
mul_v3_fl(force, strength * efd->falloff);
|
||||
break;
|
||||
case PFIELD_VORTEX:
|
||||
|
||||
@@ -189,7 +189,7 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
|
||||
return name;
|
||||
}
|
||||
|
||||
static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment)
|
||||
static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment, float *extra_pixel)
|
||||
{
|
||||
/* available == 0 is unlimited */
|
||||
if (available == 0)
|
||||
@@ -199,16 +199,22 @@ static int ui_item_fit(int item, int pos, int all, int available, bool is_last,
|
||||
/* contents is bigger than available space */
|
||||
if (is_last)
|
||||
return available - pos;
|
||||
else
|
||||
return (item * available) / all;
|
||||
else {
|
||||
float width = *extra_pixel + (item * available) / (float)all;
|
||||
*extra_pixel = width - (int)width;
|
||||
return (int)width;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* contents is smaller or equal to available space */
|
||||
if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
|
||||
if (is_last)
|
||||
return available - pos;
|
||||
else
|
||||
return (item * available) / all;
|
||||
else {
|
||||
float width = *extra_pixel + (item * available) / (float)all;
|
||||
*extra_pixel = width - (int)width;
|
||||
return (int)width;
|
||||
}
|
||||
}
|
||||
else
|
||||
return item;
|
||||
@@ -302,6 +308,26 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h)
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_item_move(uiItem *item, int delta_xmin, int delta_xmax)
|
||||
{
|
||||
if (item->type == ITEM_BUTTON) {
|
||||
uiButtonItem *bitem = (uiButtonItem *)item;
|
||||
|
||||
bitem->but->rect.xmin += delta_xmin;
|
||||
bitem->but->rect.xmax += delta_xmax;
|
||||
|
||||
ui_but_update(bitem->but); /* for strlen */
|
||||
}
|
||||
else {
|
||||
uiLayout *litem = (uiLayout *)item;
|
||||
|
||||
if (delta_xmin > 0)
|
||||
litem->x += delta_xmin;
|
||||
else
|
||||
litem->w += delta_xmax;
|
||||
}
|
||||
}
|
||||
|
||||
/******************** Special RNA Items *********************/
|
||||
|
||||
static int ui_layout_local_dir(uiLayout *layout)
|
||||
@@ -2099,9 +2125,10 @@ static int ui_litem_min_width(int itemw)
|
||||
|
||||
static void ui_litem_layout_row(uiLayout *litem)
|
||||
{
|
||||
uiItem *item;
|
||||
uiItem *item, *last_free_item = NULL;
|
||||
int x, y, w, tot, totw, neww, newtotw, itemw, minw, itemh, offset;
|
||||
int fixedw, freew, fixedx, freex, flag = 0, lastw = 0;
|
||||
float extra_pixel;
|
||||
|
||||
/* x = litem->x; */ /* UNUSED */
|
||||
y = litem->y;
|
||||
@@ -2128,6 +2155,7 @@ static void ui_litem_layout_row(uiLayout *litem)
|
||||
x = 0;
|
||||
flag = 0;
|
||||
newtotw = totw;
|
||||
extra_pixel = 0.0f;
|
||||
|
||||
for (item = litem->items.first; item; item = item->next) {
|
||||
if (item->flag & UI_ITEM_FIXED)
|
||||
@@ -2137,7 +2165,7 @@ static void ui_litem_layout_row(uiLayout *litem)
|
||||
minw = ui_litem_min_width(itemw);
|
||||
|
||||
if (w - lastw > 0)
|
||||
neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment);
|
||||
neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment, &extra_pixel);
|
||||
else
|
||||
neww = 0; /* no space left, all will need clamping to minimum size */
|
||||
|
||||
@@ -2166,6 +2194,7 @@ static void ui_litem_layout_row(uiLayout *litem)
|
||||
|
||||
freex = 0;
|
||||
fixedx = 0;
|
||||
extra_pixel = 0.0f;
|
||||
x = litem->x;
|
||||
|
||||
for (item = litem->items.first; item; item = item->next) {
|
||||
@@ -2177,13 +2206,14 @@ static void ui_litem_layout_row(uiLayout *litem)
|
||||
if (item->type != ITEM_BUTTON && item->flag & UI_ITEM_MIN) {
|
||||
minw = itemw;
|
||||
}
|
||||
itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment);
|
||||
itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment, &extra_pixel);
|
||||
fixedx += itemw;
|
||||
}
|
||||
else {
|
||||
/* free size item */
|
||||
itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment);
|
||||
itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment, &extra_pixel);
|
||||
freex += itemw;
|
||||
last_free_item = item;
|
||||
}
|
||||
|
||||
/* align right/center */
|
||||
@@ -2205,6 +2235,16 @@ static void ui_litem_layout_row(uiLayout *litem)
|
||||
x += litem->space;
|
||||
}
|
||||
|
||||
/* add extra pixel */
|
||||
uiItem *last_item = litem->items.last;
|
||||
extra_pixel = litem->w - (x - litem->x);
|
||||
if (extra_pixel > 0 && litem->alignment == UI_LAYOUT_ALIGN_EXPAND &&
|
||||
last_free_item && last_item && last_item->flag & UI_ITEM_FIXED) {
|
||||
ui_item_move(last_free_item, 0, extra_pixel);
|
||||
for (item = last_free_item->next; item; item = item->next)
|
||||
ui_item_move(item, extra_pixel, extra_pixel);
|
||||
}
|
||||
|
||||
litem->w = x - litem->x;
|
||||
litem->h = litem->y - y;
|
||||
litem->x = x;
|
||||
|
||||
@@ -372,6 +372,7 @@ typedef struct SoftBody {
|
||||
#define PFIELD_DO_ROTATION (1<<15)
|
||||
#define PFIELD_GUIDE_PATH_WEIGHT (1<<16) /* apply curve weights */
|
||||
#define PFIELD_SMOKE_DENSITY (1<<17) /* multiply smoke force by density */
|
||||
#define PFIELD_GRAVITATION (1<<18) /* used for (simple) force */
|
||||
|
||||
/* pd->falloff */
|
||||
#define PFIELD_FALL_SPHERE 0
|
||||
|
||||
@@ -1312,8 +1312,12 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
|
||||
|
||||
static bConstraint *rna_Object_constraints_new(Object *object, int type)
|
||||
{
|
||||
bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type);
|
||||
|
||||
ED_object_constraint_tag_update(object, new_con);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
|
||||
return BKE_constraint_add_for_object(object, NULL, type);
|
||||
|
||||
return new_con;
|
||||
}
|
||||
|
||||
static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr)
|
||||
|
||||
@@ -1275,7 +1275,7 @@ static void rna_def_field(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "f_power");
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)");
|
||||
RNA_def_property_ui_text(prop, "Falloff Power", "");
|
||||
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
||||
|
||||
prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
|
||||
@@ -1394,6 +1394,11 @@ static void rna_def_field(BlenderRNA *brna)
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY);
|
||||
RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density");
|
||||
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
||||
prop = RNA_def_property(srna, "use_gravity_falloff", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GRAVITATION);
|
||||
RNA_def_property_ui_text(prop, "Gravity Falloff", "Multiply force by 1/distance²");
|
||||
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
|
||||
|
||||
|
||||
/* Pointer */
|
||||
|
||||
|
||||
@@ -524,12 +524,15 @@ static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA va
|
||||
BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
|
||||
}
|
||||
|
||||
static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type)
|
||||
static bConstraint *rna_PoseChannel_constraints_new(ID *id, bPoseChannel *pchan, Main *main, int type)
|
||||
{
|
||||
/*WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); */
|
||||
/* TODO, pass object also */
|
||||
/* TODO, new pose bones don't have updated draw flags */
|
||||
return BKE_constraint_add_for_pose(NULL, pchan, NULL, type);
|
||||
Object *ob = (Object *)id;
|
||||
bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, NULL, type);
|
||||
|
||||
ED_object_constraint_dependency_tag_update(main, ob, new_con);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, id);
|
||||
|
||||
return new_con;
|
||||
}
|
||||
|
||||
static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr)
|
||||
@@ -764,6 +767,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
||||
/* Constraint collection */
|
||||
func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
|
||||
RNA_def_function_ui_description(func, "Add a constraint to this object");
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */
|
||||
/* return type */
|
||||
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
@@ -445,8 +445,6 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
||||
{
|
||||
wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
|
||||
|
||||
BKE_sound_exit();
|
||||
|
||||
/* first wrap up running stuff, we assume only the active WM is running */
|
||||
/* modal handlers are on window level freed, others too? */
|
||||
/* note; same code copied in wm_files.c */
|
||||
@@ -595,6 +593,10 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
||||
|
||||
BLI_threadapi_exit();
|
||||
|
||||
/* No need to call this early, rather do it late so that other pieces of Blender using sound may exit cleanly,
|
||||
* see also T50676. */
|
||||
BKE_sound_exit();
|
||||
|
||||
BKE_blender_atexit();
|
||||
|
||||
if (MEM_get_memory_blocks_in_use() != 0) {
|
||||
|
||||
@@ -1394,10 +1394,11 @@ static int arg_handle_render_animation(int UNUSED(argc), const char **UNUSED(arg
|
||||
Render *re = RE_NewRender(scene->id.name);
|
||||
ReportList reports;
|
||||
BLI_begin_threaded_malloc();
|
||||
BKE_reports_init(&reports, RPT_PRINT);
|
||||
BKE_reports_init(&reports, RPT_STORE);
|
||||
RE_SetReports(re, &reports);
|
||||
RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
|
||||
RE_SetReports(re, NULL);
|
||||
BKE_reports_clear(&reports);
|
||||
BLI_end_threaded_malloc();
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user