Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/dynamicpaint.c
| Show All 37 Lines | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_dynamicpaint_types.h" | #include "DNA_dynamicpaint_types.h" | ||||
| #include "DNA_group_types.h" /*GroupObject*/ | #include "DNA_group_types.h" /*CollectionObject*/ | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_texture_types.h" | #include "DNA_texture_types.h" | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_bvhutils.h" /* bvh tree */ | #include "BKE_bvhutils.h" /* bvh tree */ | ||||
| #include "BKE_collection.h" | |||||
| #include "BKE_colorband.h" | #include "BKE_colorband.h" | ||||
| #include "BKE_cdderivedmesh.h" | #include "BKE_cdderivedmesh.h" | ||||
| #include "BKE_constraint.h" | #include "BKE_constraint.h" | ||||
| #include "BKE_customdata.h" | #include "BKE_customdata.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_dynamicpaint.h" | #include "BKE_dynamicpaint.h" | ||||
| #include "BKE_effect.h" | #include "BKE_effect.h" | ||||
| ▲ Show 20 Lines • Show All 420 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* dynamic paint subframes must be done on previous frame */ | /* dynamic paint subframes must be done on previous frame */ | ||||
| scene->r.cfra -= 1; | scene->r.cfra -= 1; | ||||
| scene->r.subframe = subframe; | scene->r.subframe = subframe; | ||||
| } | } | ||||
| static int surface_getBrushFlags(DynamicPaintSurface *surface, const ViewLayer *view_layer) | static int surface_getBrushFlags(DynamicPaintSurface *surface, const ViewLayer *view_layer) | ||||
| { | { | ||||
| Base *base = NULL; | Base *base = BKE_collection_or_layer_objects(NULL, NULL, view_layer, surface->brush_group); | ||||
| Object *brushObj = NULL; | Object *brushObj = NULL; | ||||
| ModifierData *md = NULL; | ModifierData *md = NULL; | ||||
| int flags = 0; | int flags = 0; | ||||
| if (surface->brush_group) | |||||
| base = FIRSTBASE(surface->brush_group->view_layer); | |||||
| else | |||||
| base = FIRSTBASE(view_layer); | |||||
| while (base) { | while (base) { | ||||
| brushObj = NULL; | brushObj = NULL; | ||||
| /* select object */ | /* select object */ | ||||
| brushObj = base->object; | brushObj = base->object; | ||||
| /* next item */ | /* next item */ | ||||
| base = base->next; | base = base->next; | ||||
| ▲ Show 20 Lines • Show All 5,393 Lines • ▼ Show 20 Lines | BLI_task_parallel_range(0, sData->total_points, | ||||
| dynamic_paint_surface_pre_step_cb, | dynamic_paint_surface_pre_step_cb, | ||||
| &settings); | &settings); | ||||
| } | } | ||||
| /* | /* | ||||
| * Loop through surface's target paint objects and do painting | * Loop through surface's target paint objects and do painting | ||||
| */ | */ | ||||
| { | { | ||||
| Base *base = NULL; | |||||
| Object *brushObj = NULL; | Object *brushObj = NULL; | ||||
| ModifierData *md = NULL; | ModifierData *md = NULL; | ||||
| ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); | ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); | ||||
| Base *base = BKE_collection_or_layer_objects(NULL, NULL, view_layer, surface->brush_group); | |||||
| /* backup current scene frame */ | /* backup current scene frame */ | ||||
| int scene_frame = scene->r.cfra; | int scene_frame = scene->r.cfra; | ||||
| float scene_subframe = scene->r.subframe; | float scene_subframe = scene->r.subframe; | ||||
| /* either from group or from all objects */ | |||||
| if (surface->brush_group) | |||||
| base = FIRSTBASE(surface->brush_group->view_layer); | |||||
| else | |||||
| base = FIRSTBASE(view_layer); | |||||
| while (base) { | while (base) { | ||||
| brushObj = NULL; | brushObj = NULL; | ||||
| /* select object */ | /* select object */ | ||||
| brushObj = base->object; | brushObj = base->object; | ||||
| /* next item */ | /* next item */ | ||||
| base = base->next; | base = base->next; | ||||
| ▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines | |||||