[Bf-blender-cvs] [3d3cc30df48] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Joshua Leung
noreply at git.blender.org
Tue Apr 17 18:28:57 CEST 2018
Commit: 3d3cc30df489f6729cd626edaf30b0e5e065779c
Author: Joshua Leung
Date: Tue Apr 17 18:28:08 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3d3cc30df489f6729cd626edaf30b0e5e065779c
Merge branch 'blender2.8' into greasepencil-object
Tempting fate by merging in the Game Engine removal in here too...
We might as well do this now though, since it'll have to happen at
some time anyway!
# Conflicts:
# release/scripts/startup/bl_ui/properties_scene.py
# source/blender/blenkernel/intern/object.c
# source/blender/blenloader/intern/versioning_280.c
# source/blender/gpu/CMakeLists.txt
# source/blenderplayer/bad_level_call_stubs/stubs.c
===================================================================
===================================================================
diff --cc release/scripts/startup/bl_ui/__init__.py
index 29f84bda338,5c50cb74fdb..9c9129f67ac
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@@ -44,10 -43,8 +44,9 @@@ _modules =
"properties_data_lightprobe",
"properties_data_speaker",
"properties_data_workspace",
- "properties_game",
"properties_mask_common",
"properties_material",
+ "properties_material_gpencil",
"properties_object",
"properties_paint_common",
"properties_grease_pencil_common",
diff --cc release/scripts/startup/bl_ui/properties_scene.py
index d778a8a1954,d61e99f1e1e..a809a1ba8a4
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@@ -78,9 -75,7 +78,8 @@@ class SCENE_PT_scene(SceneButtonsPanel
layout.prop(scene, "camera")
layout.prop(scene, "background_set", text="Background")
- if context.engine != 'BLENDER_GAME':
- layout.prop(scene, "active_clip", text="Active Clip")
+ layout.prop(scene, "active_clip", text="Active Clip")
+ layout.prop(scene, "gpencil_object")
class SCENE_PT_unit(SceneButtonsPanel, Panel):
@@@ -440,38 -436,8 +439,38 @@@ class SCENE_PT_simplify(SceneButtonsPan
col.prop(rd, "use_simplify_triangulate")
+class SCENE_PT_gp_simplify(SceneButtonsPanel, Panel):
+ bl_label = "Simplify Grease Pencil"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
+
+ def draw_header(self, context):
+ ts = context.tool_settings
+ self.layout.prop(ts, "gpencil_simplify", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ ts = context.tool_settings
+
+ layout.active = ts.gpencil_simplify
+
+ row = layout.row()
+ row.prop(ts, "gpencil_simplify_onplay", text="Only on Play")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(ts, "gpencil_simplify_view_fill", text="Fill")
+ col.prop(ts, "gpencil_simplify_remove_lines", text="Remove Fill Lines")
+ col.prop(ts, "gpencil_simplify_view_modifier", text="Modifiers")
+ col.prop(ts, "gpencil_simplify_view_vfx", text="VFX")
+
+ row = layout.row()
+ row.prop(ts, "gpencil_disable_fast_drawing")
+
+
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel):
- COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
_context_path = "scene"
_property_type = bpy.types.Scene
diff --cc source/blender/blenkernel/intern/object.c
index 56a7572a735,addf84224ac..5ffdd98ddb9
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@@ -868,174 -796,6 +830,41 @@@ Object *BKE_object_add_from
return ob;
}
+/**
+ * Add a new object, but assign the given datablock as the ob->data
+ * for the newly created object.
+ *
+ * \param data The datablock to assign as ob->data for the new object.
+ * This is assumed to be of the correct type.
+ * \param add_user If true, id_us_plus() will be called on data when
+ * assigning it to the object.
+ */
+Object *BKE_object_add_for_data(
+ Main *bmain, Scene *scene, ViewLayer *view_layer,
+ int type, const char *name, ID *data, bool add_user)
+{
+ Object *ob;
+ Base *base;
+ LayerCollection *layer_collection;
+
+ /* same as object_add_common, except we don't create new ob->data */
+ ob = BKE_object_add_only_object(bmain, type, name);
+ ob->data = data;
+ if (add_user) id_us_plus(data);
+
+ BKE_view_layer_base_deselect_all(view_layer);
+ DEG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+
+ layer_collection = BKE_layer_collection_get_active_ensure(scene, view_layer);
+ BKE_collection_object_add(&scene->id, layer_collection->scene_collection, ob);
+
+ base = BKE_view_layer_base_find(view_layer, ob);
+ BKE_view_layer_base_select(view_layer, base);
+
+ return ob;
+}
+
+
- #ifdef WITH_GAMEENGINE
-
- void BKE_object_lod_add(Object *ob)
- {
- LodLevel *lod = MEM_callocN(sizeof(LodLevel), "LoD Level");
- LodLevel *last = ob->lodlevels.last;
-
- /* If the lod list is empty, initialize it with the base lod level */
- if (!last) {
- LodLevel *base = MEM_callocN(sizeof(LodLevel), "Base LoD Level");
- BLI_addtail(&ob->lodlevels, base);
- base->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT;
- base->source = ob;
- base->obhysteresis = 10;
- last = ob->currentlod = base;
- }
-
- lod->distance = last->distance + 25.0f;
- lod->obhysteresis = 10;
- lod->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT;
-
- BLI_addtail(&ob->lodlevels, lod);
- }
-
- static int lod_cmp(const void *a, const void *b)
- {
- const LodLevel *loda = a;
- const LodLevel *lodb = b;
-
- if (loda->distance < lodb->distance) return -1;
- return loda->distance > lodb->distance;
- }
-
- void BKE_object_lod_sort(Object *ob)
- {
- BLI_listbase_sort(&ob->lodlevels, lod_cmp);
- }
-
- bool BKE_object_lod_remove(Object *ob, int level)
- {
- LodLevel *rem;
-
- if (level < 1 || level > BLI_listbase_count(&ob->lodlevels) - 1)
- return false;
-
- rem = BLI_findlink(&ob->lodlevels, level);
-
- if (rem == ob->currentlod) {
- ob->currentlod = rem->prev;
- }
-
- BLI_remlink(&ob->lodlevels, rem);
- MEM_freeN(rem);
-
- /* If there are no user defined lods, remove the base lod as well */
- if (BLI_listbase_is_single(&ob->lodlevels)) {
- LodLevel *base = ob->lodlevels.first;
- BLI_remlink(&ob->lodlevels, base);
- MEM_freeN(base);
- ob->currentlod = NULL;
- }
-
- return true;
- }
-
- static LodLevel *lod_level_select(Object *ob, const float camera_position[3])
- {
- LodLevel *current = ob->currentlod;
- float dist_sq;
-
- if (!current) return NULL;
-
- dist_sq = len_squared_v3v3(ob->obmat[3], camera_position);
-
- if (dist_sq < SQUARE(current->distance)) {
- /* check for higher LoD */
- while (current->prev && dist_sq < SQUARE(current->distance)) {
- current = current->prev;
- }
- }
- else {
- /* check for lower LoD */
- while (current->next && dist_sq > SQUARE(current->next->distance)) {
- current = current->next;
- }
- }
-
- return current;
- }
-
- bool BKE_object_lod_is_usable(Object *ob, ViewLayer *view_layer)
- {
- bool active = (view_layer) ? ob == OBACT(view_layer) : false;
- return (ob->mode == OB_MODE_OBJECT || !active);
- }
-
- void BKE_object_lod_update(Object *ob, const float camera_position[3])
- {
- LodLevel *cur_level = ob->currentlod;
- LodLevel *new_level = lod_level_select(ob, camera_position);
-
- if (new_level != cur_level) {
- ob->currentlod = new_level;
- }
- }
-
- static Object *lod_ob_get(Object *ob, ViewLayer *view_layer, int flag)
- {
- LodLevel *current = ob->currentlod;
-
- if (!current || !BKE_object_lod_is_usable(ob, view_layer))
- return ob;
-
- while (current->prev && (!(current->flags & flag) || !current->source || current->source->type != OB_MESH)) {
- current = current->prev;
- }
-
- return current->source;
- }
-
- struct Object *BKE_object_lod_meshob_get(Object *ob, ViewLayer *view_layer)
- {
- return lod_ob_get(ob, view_layer, OB_LOD_USE_MESH);
- }
-
- struct Object *BKE_object_lod_matob_get(Object *ob, ViewLayer *view_layer)
- {
- return lod_ob_get(ob, view_layer, OB_LOD_USE_MAT);
- }
-
- #endif /* WITH_GAMEENGINE */
-
-
SoftBody *copy_softbody(const SoftBody *sb, const int flag)
{
SoftBody *sbn;
diff --cc source/blender/blenloader/intern/readfile.c
index 5c7c370d298,b40321f75d1..7016c147cd7
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -10193,13 -9751,8 +9904,10 @@@ static void expand_scene(FileData *fd,
}
}
- if (sce->r.dometext)
- expand_doit(fd, mainvar, sce->gm.dome.warptext);
-
if (sce->gpd)
expand_doit(fd, mainvar, sce->gpd);
+
+ expand_doit(fd, mainvar, sce->gp_object);
if (sce->ed) {
Sequence *seq;
diff --cc source/blender/blenloader/intern/versioning_280.c
index 0218729834b,71074aef9b6..10d4e8a2cc3
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -55,8 -54,8 +56,9 @@@
#include "DNA_workspace_types.h"
#include "BKE_collection.h"
+ #include "BKE_constraint.h"
#include "BKE_customdata.h"
+#include "BKE_colortools.h"
#include "BKE_freestyle.h"
#include "BKE_group.h"
#include "BKE_idprop.h"
@@@ -1087,25 -891,9 +1080,25 @@@ void blo_do_versions_280(FileData *fd,
do_version_view_layer_visibility(group->view_layer);
}
}
+
+ /* init grease pencil grids and paper */
+ if (!DNA_struct_elem_find(fd->filesdna, "gp_paper_opacity", "float", "gpencil_paper_color[3]")) {
+ for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->gpencil_grid_size[0] = GP_DEFAULT_GRID_SIZE;
+ v3d->gpencil_grid_size[1] = GP_DEFAULT_GRID_SIZE;
+ ARRAY_SET_ITEMS(v3d->gpencil_paper_color, 1.0f, 1.0f, 1.0f, 0.7f);
+ }
+ }
+ }
+ }
+ }
}
- {
+ if (!MAIN_VERSION_ATLEAST(main, 280, 6)) {
if (DNA_struct_elem_find(fd->filesdna, "SpaceOops", "int", "filter") == false) {
bScreen *sc;
ScrArea *sa;
@@@ -1145,14 -933,19 +1138,31 @@@
}
}
+ /* Hero open movie special code. This could removed later */
++ /* if (!MAIN_VERSION_ATLEAST(main, 280, 6)) */
+ {
+ /* rescale old grease pencil pixel factor (needed for Hero open movie files) */
+ for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+ /* old data was always bigger than 30 */
+ if (gpd->pixfactor > 30.0f) {
+ gpd->pixfactor = 1000.0f / gpd->pixfactor;
+ }
+ }
+ }
++
+ if (!MAIN_VERSION_ATLEAST(main, 280, 6)) {
+ for (Object
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list