Commit: d809346edafc8eecceb8585e7d024abd7cc34829 Author: Antonio Vazquez Date: Fri Jul 6 22:31:03 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rBd809346edafc8eecceb8585e7d024abd7cc34829
Merge branch 'blender2.8' into greasepencil-object Conflicts: release/scripts/startup/bl_ui/__init__.py source/blender/editors/object/object_add.c source/blender/editors/object/object_intern.h source/blender/editors/object/object_ops.c source/blender/editors/space_buttons/space_buttons.c source/blender/makesrna/intern/rna_internal.h =================================================================== =================================================================== diff --cc release/scripts/startup/bl_ui/__init__.py index 4abc336cd39,51ba45cdcd7..89aed37f055 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@@ -34,8 -34,7 +34,8 @@@ _modules = "properties_data_camera", "properties_data_curve", "properties_data_empty", + "properties_data_gpencil", - "properties_data_lamp", + "properties_data_light", "properties_data_lattice", "properties_data_mesh", "properties_data_metaball", diff --cc release/scripts/startup/bl_ui/space_view3d.py index 4134516978b,fa37197f3ff..4b26b3fb03a --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@@ -4562,10 -4527,11 +4649,11 @@@ classes = VIEW3D_MT_edit_gpencil_interpolate, VIEW3D_MT_object_mode_pie, VIEW3D_MT_view_pie, - VIEW3D_PT_grease_pencil, - VIEW3D_PT_grease_pencil_palettecolor, VIEW3D_PT_view3d_properties, + VIEW3D_PT_view3d_camera_lock, VIEW3D_PT_view3d_cursor, + VIEW3D_PT_grease_pencil, + VIEW3D_PT_gpencil_multi_frame, VIEW3D_PT_quad_view, VIEW3D_PT_view3d_stereo, VIEW3D_PT_shading, diff --cc source/blender/editors/object/object_add.c index e98c746277b,a8917f4c4aa..10901530871 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@@ -987,107 -985,9 +987,107 @@@ void OBJECT_OT_drop_named_image(wmOpera ED_object_add_generic_props(ot, false); } +/********************* Add Gpencil Operator ********************/ + +static int object_gpencil_add_exec(bContext *C, wmOperator *op) +{ + Object *ob = CTX_data_active_object(C); + bGPdata *gpd = (ob && (ob->type == OB_GPENCIL)) ? ob->data : NULL; + + const int type = RNA_enum_get(op->ptr, "type"); + + float loc[3], rot[3]; + unsigned int layer; + bool newob = false; + + /* Hack: Force view-align to be on by default + * since it's not nice for adding shapes in 2D + * for them to end up aligned oddly + */ + if (RNA_struct_property_is_set(op->ptr, "view_align") == false) + RNA_boolean_set(op->ptr, "view_align", true); + + /* Note: We use 'Y' here (not 'Z'), as */ + WM_operator_view3d_unit_defaults(C, op); + if (!ED_object_add_generic_get_opts(C, op, 'Y', loc, rot, NULL, &layer, NULL)) + return OPERATOR_CANCELLED; + + /* add new object if not currently editing a GP object, + * or if "empty" was chosen (i.e. user wants a blank GP canvas) + */ + if ((gpd == NULL) || (GPENCIL_ANY_MODE(gpd) == false) || (type == GP_EMPTY)) { + const char *ob_name = (type == GP_MONKEY) ? "Suzanne" : NULL; + float radius = RNA_float_get(op->ptr, "radius"); + + ob = ED_object_add_type(C, OB_GPENCIL, ob_name, loc, rot, true, layer); + gpd = ob->data; + newob = true; + + BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE * radius); + } + else { + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_ADDED, NULL); + } + + /* create relevant geometry */ + switch (type) { + case GP_MONKEY: + { + float radius = RNA_float_get(op->ptr, "radius"); + float mat[4][4]; + + ED_object_new_primitive_matrix(C, ob, loc, rot, mat); + mul_v3_fl(mat[0], radius); + mul_v3_fl(mat[1], radius); + mul_v3_fl(mat[2], radius); + + ED_gpencil_create_monkey(C, mat); + break; + } + + case GP_EMPTY: + /* do nothing */ + break; + + default: + BKE_report(op->reports, RPT_WARNING, "Not implemented"); + break; + } + + /* if this is a new object, initialise default stuff (colors, etc.) */ + if (newob) { + ED_gpencil_add_defaults(C); + } + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_gpencil_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Add GPencil"; + ot->description = "Add a grease pencil object to the scene"; + ot->idname = "OBJECT_OT_gpencil_add"; + + /* api callbacks */ + ot->invoke = WM_menu_invoke; + ot->exec = object_gpencil_add_exec; + ot->poll = ED_operator_scene_editable; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + ED_object_add_unit_props(ot); + ED_object_add_generic_props(ot, false); + + ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_gpencil_type_items, 0, "Type", ""); +} + - /********************* Add Lamp Operator ********************/ + /********************* Add Light Operator ********************/ - static const char *get_lamp_defname(int type) + static const char *get_light_defname(int type) { switch (type) { case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Point"); diff --cc source/blender/editors/object/object_intern.h index e34d88c38f4,1b5c6df2632..ef8653541f0 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@@ -115,8 -115,7 +115,8 @@@ void OBJECT_OT_armature_add(struct wmOp void OBJECT_OT_empty_add(struct wmOperatorType *ot); void OBJECT_OT_lightprobe_add(struct wmOperatorType *ot); void OBJECT_OT_drop_named_image(struct wmOperatorType *ot); +void OBJECT_OT_gpencil_add(struct wmOperatorType *ot); - void OBJECT_OT_lamp_add(struct wmOperatorType *ot); + void OBJECT_OT_light_add(struct wmOperatorType *ot); void OBJECT_OT_effector_add(struct wmOperatorType *ot); void OBJECT_OT_camera_add(struct wmOperatorType *ot); void OBJECT_OT_speaker_add(struct wmOperatorType *ot); diff --cc source/blender/editors/object/object_ops.c index 54547066e06,5a83d085aee..588ce2825cf --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@@ -114,8 -114,7 +114,8 @@@ void ED_operatortypes_object(void WM_operatortype_append(OBJECT_OT_empty_add); WM_operatortype_append(OBJECT_OT_lightprobe_add); WM_operatortype_append(OBJECT_OT_drop_named_image); + WM_operatortype_append(OBJECT_OT_gpencil_add); - WM_operatortype_append(OBJECT_OT_lamp_add); + WM_operatortype_append(OBJECT_OT_light_add); WM_operatortype_append(OBJECT_OT_camera_add); WM_operatortype_append(OBJECT_OT_speaker_add); WM_operatortype_append(OBJECT_OT_add); diff --cc source/blender/editors/space_buttons/space_buttons.c index ddd613fa18d,6f7a4ca971a..b7aba7110a8 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@@ -267,24 -251,7 +255,25 @@@ static void buttons_main_region_layout_ /* TODO */ } + /* for grease pencil we don't use tool system yet, so we need check outside + * workspace->tools_space_type because this value is not available + */ + switch (mode) { + case CTX_MODE_GPENCIL_PAINT: + ARRAY_SET_ITEMS(contexts, ".greasepencil_paint"); + break; + case CTX_MODE_GPENCIL_EDIT: + ARRAY_SET_ITEMS(contexts, ".greasepencil_edit"); + break; + case CTX_MODE_GPENCIL_SCULPT: + ARRAY_SET_ITEMS(contexts, ".greasepencil_sculpt"); + break; + case CTX_MODE_GPENCIL_WEIGHT: + ARRAY_SET_ITEMS(contexts, ".greasepencil_weight"); + break; + } + + const bool vertical = true; ED_region_panels_layout_ex(C, ar, contexts, -1, vertical); } diff --cc source/blender/makesrna/intern/rna_internal.h index 55e727ef36a,a57777f0630..ef8f55e5dfc --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@@ -153,11 -153,9 +153,11 @@@ void RNA_def_dynamic_paint(struct Blend void RNA_def_fluidsim(struct BlenderRNA *brna); void RNA_def_fcurve(struct BlenderRNA *brna); void RNA_def_gpencil(struct BlenderRNA *brna); +void RNA_def_greasepencil_modifier(struct BlenderRNA *brna); +void RNA_def_shader_fx(struct BlenderRNA *brna); void RNA_def_image(struct BlenderRNA *brna); void RNA_def_key(struct BlenderRNA *brna); - void RNA_def_lamp(struct BlenderRNA *brna); + void RNA_def_light(struct BlenderRNA *brna); void RNA_def_lattice(struct BlenderRNA *brna); void RNA_def_linestyle(struct BlenderRNA *brna); void RNA_def_main(struct BlenderRNA *brna); @@@ -285,8 -283,7 +285,8 @@@ void rna_TextureSlot_update(struct bCon bool rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value); bool rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value); bool rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_GPencil_object_poll(struct PointerRNA *ptr, struct PointerRNA value); - bool rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value); + bool rna_Light_object_poll(struct PointerRNA *ptr, struct PointerRNA value); bool rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value); bool rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value); diff --cc source/blender/makesrna/intern/rna_object.c index 462caea3d39,2bdfbade53a..9f2e5db9635 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@@ -154,10 -144,9 +154,10 @@@ const EnumPropertyItem rna_enum_object_ {OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, {OB_LATTICE, "LATTICE", 0, "Lattice", ""}, {OB_EMPTY, "EMPTY", 0, "Empty", ""}, + {OB_GPENCIL, "GPENCIL", 0, "GPencil", ""}, {0, "", 0, NULL, NULL}, {OB_CAMERA, "CAMERA", 0, "Camera", ""}, - {OB_LAMP, "LAMP", 0, "Lamp", ""}, + {OB_LAMP, "LIGHT", 0, "Light", ""}, {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""}, {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""}, {0, NULL, 0, NULL, NULL} _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs