[Bf-blender-cvs] [e5c1b74ec98] soc-2019-npr: LANPR: use own operator registering function.
YimingWu
noreply at git.blender.org
Wed Jul 31 10:24:02 CEST 2019
Commit: e5c1b74ec98294071aecd6136283191ccfee8250
Author: YimingWu
Date: Wed Jul 31 16:23:32 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBe5c1b74ec98294071aecd6136283191ccfee8250
LANPR: use own operator registering function.
===================================================================
M source/blender/editors/include/ED_lanpr.h
M source/blender/editors/lanpr/CMakeLists.txt
A source/blender/editors/lanpr/lanpr_cpu.c
M source/blender/editors/lanpr/lanpr_ops.c
M source/blender/editors/render/render_intern.h
M source/blender/editors/render/render_ops.c
M source/blender/editors/space_api/spacetypes.c
===================================================================
diff --git a/source/blender/editors/include/ED_lanpr.h b/source/blender/editors/include/ED_lanpr.h
index e583b4bdca5..ff36f24027d 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -832,4 +832,6 @@ LANPR_BoundingArea *ED_lanpr_get_point_bounding_area_deep(LANPR_RenderBuffer *rb
void ED_lanpr_post_frame_update_external(struct Scene *s, struct Depsgraph *dg);
+void ED_operatortypes_lanpr(void);
+
#endif /* __ED_LANPR_H__ */
diff --git a/source/blender/editors/lanpr/CMakeLists.txt b/source/blender/editors/lanpr/CMakeLists.txt
index 44a8d294ff7..9319ed94ad0 100644
--- a/source/blender/editors/lanpr/CMakeLists.txt
+++ b/source/blender/editors/lanpr/CMakeLists.txt
@@ -33,6 +33,7 @@ set(INC_SYS
set(SRC
lanpr_ops.c
+ lanpr_cpu.c
lanpr_chain.c
lanpr_util.c
)
diff --git a/source/blender/editors/lanpr/lanpr_ops.c b/source/blender/editors/lanpr/lanpr_cpu.c
similarity index 100%
copy from source/blender/editors/lanpr/lanpr_ops.c
copy to source/blender/editors/lanpr/lanpr_cpu.c
diff --git a/source/blender/editors/lanpr/lanpr_ops.c b/source/blender/editors/lanpr/lanpr_ops.c
index 33c041144a5..142ff131bab 100644
--- a/source/blender/editors/lanpr/lanpr_ops.c
+++ b/source/blender/editors/lanpr/lanpr_ops.c
@@ -1,4497 +1,39 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/** \file
- * \ingroup editor/lanpr
- */
+#include <stdlib.h>
-/* Test commit for investigating git problems. */
-
-#include "ED_lanpr.h"
-
-#include "BLI_listbase.h"
-#include "BLI_linklist.h"
-#include "BLI_math_matrix.h"
-#include "BLI_task.h"
#include "BLI_utildefines.h"
-#include "BLI_alloca.h"
-
-#include "BKE_object.h"
-#include "DNA_mesh_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_text_types.h"
-#include "DNA_lanpr_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_meshdata_types.h"
-#include "BKE_customdata.h"
-#include "DEG_depsgraph_query.h"
-#include "BKE_camera.h"
-#include "BKE_gpencil.h"
-#include "BKE_collection.h"
-#include "BKE_report.h"
-#include "BKE_screen.h"
-#include "BKE_scene.h"
-#include "BKE_text.h"
-#include "BKE_context.h"
-#include "MEM_guardedalloc.h"
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "BLI_math.h"
-#include "BLI_callbacks.h"
-#include "BLI_string_utils.h"
-
-#include "bmesh.h"
-#include "bmesh_class.h"
-#include "bmesh_tools.h"
-
-#include "WM_types.h"
#include "WM_api.h"
-#include "ED_svg.h"
-#include "BKE_text.h"
-
-extern LANPR_SharedResource lanpr_share;
-extern const char *RE_engine_id_BLENDER_LANPR;
-struct Object;
-
-/* External defines */
-
-void lanpr_rebuild_all_command(SceneLANPR *lanpr);
-
-/* Own functions */
-
-static LANPR_BoundingArea *lanpr_get_first_possible_bounding_area(LANPR_RenderBuffer *rb,
- LANPR_RenderLine *rl);
-
-static void lanpr_link_line_with_bounding_area(LANPR_RenderBuffer *rb,
- LANPR_BoundingArea *RootBoundingArea,
- LANPR_RenderLine *rl);
-
-static LANPR_BoundingArea *lanpr_get_next_bounding_area(LANPR_BoundingArea *This,
- LANPR_RenderLine *rl,
- real x,
- real y,
- real k,
- int PositiveX,
- int PositiveY,
- real *NextX,
- real *NextY);
-static int lanpr_triangle_line_imagespace_intersection_v2(SpinLock *spl,
- LANPR_RenderTriangle *rt,
- LANPR_RenderLine *rl,
- Object *cam,
- tnsMatrix44d vp,
- real *CameraDir,
- double *From,
- double *To);
-static int lanpr_get_line_bounding_areas(LANPR_RenderBuffer *rb,
- LANPR_RenderLine *rl,
- int *rowBegin,
- int *rowEnd,
- int *colBegin,
- int *colEnd);
-
-/* Layer operations */
-
-static void lanpr_line_layer_unique_name(ListBase* list, LANPR_LineLayer* ll, const char *defname)
-{
- BLI_uniquename(list,ll,defname,'.',offsetof(LANPR_LineLayer, name),sizeof(ll->name));
-}
-
-int ED_lanpr_max_occlusion_in_line_layers(SceneLANPR *lanpr)
-{
- LANPR_LineLayer *lli;
- int max_occ = -1, max;
- for (lli = lanpr->line_layers.first; lli; lli = lli->next) {
- if (lli->use_multiple_levels) {
- max = MAX2(lli->qi_begin, lli->qi_end);
- }
- else {
- max = lli->qi_begin;
- }
- max_occ = MAX2(max, max_occ);
- }
- return max_occ;
-}
-LANPR_LineLayer *ED_lanpr_new_line_layer(SceneLANPR *lanpr)
-{
- LANPR_LineLayer *ll = MEM_callocN(sizeof(LANPR_LineLayer), "Line Layer");
-
- lanpr_line_layer_unique_name(&lanpr->line_layers,ll,"Layer");
-
- int max_occ = ED_lanpr_max_occlusion_in_line_layers(lanpr);
-
- ll->qi_begin = ll->qi_end = max_occ + 1;
- ll->use_same_style = 1;
- ll->thickness = 1.0f;
- copy_v3_fl(ll->color, 0.8);
- ll->color[3] = 1.0f;
- ll->contour.enabled = 1;
- ll->crease.enabled = 1;
- ll->material_separate.enabled = 1;
- ll->edge_mark.enabled = 1;
- ll->intersection.enabled = 1;
-
- lanpr->active_layer = ll;
- BLI_addtail(&lanpr->line_layers, ll);
-
- return ll;
-}
-LANPR_LineLayerComponent *ED_lanpr_new_line_component(SceneLANPR *lanpr)
-{
- if (!lanpr->active_layer) {
- return 0;
- }
- LANPR_LineLayer *ll = lanpr->active_layer;
-
- LANPR_LineLayerComponent *llc = MEM_callocN(sizeof(LANPR_LineLayerComponent), "Line Component");
- BLI_addtail(&ll->components, llc);
-
- return llc;
-}
-static int lanpr_add_line_layer_exec(struct bContext *C, struct wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_scene(C);
- SceneLANPR *lanpr = &scene->lanpr;
-
- ED_lanpr_new_line_layer(lanpr);
-
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
-
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
-
- return OPERATOR_FINISHED;
-}
-static int lanpr_delete_line_layer_exec(struct bContext *C, struct wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_scene(C);
- SceneLANPR *lanpr = &scene->lanpr;
-
- LANPR_LineLayer *ll = lanpr->active_layer;
-
- if (!ll) {
- return OPERATOR_FINISHED;
- }
-
- if (ll->prev) {
- lanpr->active_layer = ll->prev;
- }
- else if (ll->next) {
- lanpr->active_layer = ll->next;
- }
- else {
- lanpr->active_layer = 0;
- }
-
- BLI_remlink(&scene->lanpr.line_layers, ll);
-
- /* if (ll->batch) GPU_batch_discard(ll->batch); */
-
- MEM_freeN(ll);
-
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
-
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
-
- return OPERATOR_FINISHED;
-}
-static int lanpr_move_line_layer_exec(struct bContext *C, struct wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- SceneLANPR *lanpr = &scene->lanpr;
-
- LANPR_LineLayer *ll = lanpr->active_layer;
-
- if (!ll) {
- return OPERATOR_FINISHED;
- }
-
- int dir = RNA_enum_get(op->ptr, "direction");
-
- if (dir == 1 && ll->prev) {
- BLI_remlink(&lanpr->line_layers, ll);
- BLI_insertlinkbefore(&lanpr->line_layers, ll->prev, ll);
- }
- else if (dir == -1 && ll->next) {
- BLI_remlink(&lanpr->line_layers, ll);
- BLI_insertlinkafter(&lanpr->line_layers, ll->next, ll);
- }
-
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
-
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
-
- return OPERATOR_FINISHED;
-}
-static int lanpr_add_line_component_exec(struct bContext *C, struct wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_scene(C);
- SceneLANPR *lanpr = &scene->lanpr;
-
- ED_lanpr_new_line_component(lanpr);
-
- return OPERATOR_FINISHED;
-}
-static int lanpr_delete_line_component_exec(struct bContext *C, struct wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- SceneLANPR *lanpr = &scene->lanpr;
- LANPR_LineLayer *ll = lanpr->active_layer;
- LANPR_LineLayerComponent *llc;
- int i = 0;
-
- if (!ll) {
- return OPERATOR_FINISHED;
- }
-
- int index = RNA_int_get(op->ptr, "index");
-
- for (llc = ll->components.first; llc; llc = llc->next) {
- if (index == i) {
- break;
- }
- i++;
- }
-
- if (llc) {
- BLI_remlink(&ll->components, llc);
- MEM_freeN(llc);
- }
-
- return OPERATOR_FINISHED;
-}
-
-static int lanpr_rebuild_all_commands_exec(struct bContext *C, struct wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_scene(C);
- SceneLANPR *lanpr = &scene->lanpr;
-
- lanpr_rebuild_all_command(lanpr);
-
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
-
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
-
- return OPERATOR_FINISHED;
-}
-static int lanpr_enable_all_line_types_exec(struct bContext *C, struct wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_sce
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list