Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_brush.c
| Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
| /* ************************************************ */ | /* ************************************************ */ | ||||
| /* General Brush Editing Context */ | /* General Brush Editing Context */ | ||||
| /* Context for brush operators */ | /* Context for brush operators */ | ||||
| typedef struct tGP_BrushEditData { | typedef struct tGP_BrushEditData { | ||||
| /* Current editor/region/etc. */ | /* Current editor/region/etc. */ | ||||
| /* NOTE: This stuff is mainly needed to handle 3D view projection stuff... */ | /* NOTE: This stuff is mainly needed to handle 3D view projection stuff... */ | ||||
| Depsgraph *depsgraph; | Depsgraph *depsgraph; | ||||
| struct Main *bmain; | |||||
| Scene *scene; | Scene *scene; | ||||
| Object *object; | Object *object; | ||||
| ScrArea *sa; | ScrArea *sa; | ||||
| ARegion *ar; | ARegion *ar; | ||||
| /* Current GPencil datablock */ | /* Current GPencil datablock */ | ||||
| bGPdata *gpd; | bGPdata *gpd; | ||||
| ▲ Show 20 Lines • Show All 791 Lines • ▼ Show 20 Lines | static bool gp_brush_weight_apply( | ||||
| * Otherwise, good default values are in the range of 0.093 | * Otherwise, good default values are in the range of 0.093 | ||||
| */ | */ | ||||
| inf = gp_brush_influence_calc(gso, radius, co) / 10.0f; | inf = gp_brush_influence_calc(gso, radius, co) / 10.0f; | ||||
| /* need a vertex group */ | /* need a vertex group */ | ||||
| if (gso->vrgroup == -1) { | if (gso->vrgroup == -1) { | ||||
| if (gso->object) { | if (gso->object) { | ||||
| BKE_object_defgroup_add(gso->object); | BKE_object_defgroup_add(gso->object); | ||||
| DEG_relations_tag_update(gso->bmain); | |||||
| gso->vrgroup = 0; | gso->vrgroup = 0; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| bDeformGroup *defgroup = BLI_findlink(&gso->object->defbase, gso->vrgroup); | bDeformGroup *defgroup = BLI_findlink(&gso->object->defbase, gso->vrgroup); | ||||
| if (defgroup->flag & DG_LOCK_WEIGHT) { | if (defgroup->flag & DG_LOCK_WEIGHT) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 294 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| tGP_BrushEditData *gso; | tGP_BrushEditData *gso; | ||||
| /* setup operator data */ | /* setup operator data */ | ||||
| gso = MEM_callocN(sizeof(tGP_BrushEditData), "tGP_BrushEditData"); | gso = MEM_callocN(sizeof(tGP_BrushEditData), "tGP_BrushEditData"); | ||||
| op->customdata = gso; | op->customdata = gso; | ||||
| gso->depsgraph = CTX_data_depsgraph(C); | gso->depsgraph = CTX_data_depsgraph(C); | ||||
| gso->bmain = CTX_data_main(C); | |||||
| /* store state */ | /* store state */ | ||||
| gso->settings = gpsculpt_get_settings(scene); | gso->settings = gpsculpt_get_settings(scene); | ||||
| gso->gp_brush = gpsculpt_get_brush(scene, is_weight_mode); | gso->gp_brush = gpsculpt_get_brush(scene, is_weight_mode); | ||||
| gso->is_weight_mode = is_weight_mode; | gso->is_weight_mode = is_weight_mode; | ||||
| if (is_weight_mode) { | if (is_weight_mode) { | ||||
| gso->brush_type = gso->settings->weighttype; | gso->brush_type = gso->settings->weighttype; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 929 Lines • Show Last 20 Lines | |||||