ANT Landscape report error traceback
Open, ConfirmedPublic

Description

System Information
Operating system and graphics card

Mac OS X High Sierra
Intel iris 1536 MB

Blender Version
2.79
Broken: (example: 2.69.7 4b206af, see splash screen)
Version: 2.79 Hash: 5bd8ac9
Worked: (optional)

Short description of error
Ant landscape report error
Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps
Click on the generator, the error will appear.
screenshot below

Details

Type
Bug

I have 10.13 also, but no error shows up.
I used 12.20 build

Vuk Gardašević (lijenstina) triaged this task as Confirmed priority.EditedMon, Dec 25, 11:11 PM

I can confirm the issue when adding ANT landscape when in Edit mode. The smooth operator expects it to be in object mode and the created mesh is not.

Okay, yes, if you add landscape from the menu as opposed to the button on the 'create' tab this happens.
Should be a warning or contextually removed from menu in edit mode.

So I guess solution is either

1
2
3diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py
4index 5d25cf24..82e179a0 100644
5--- a/ant_landscape/add_mesh_ant_landscape.py
6+++ b/ant_landscape/add_mesh_ant_landscape.py
7@@ -35,6 +35,7 @@ from .ant_functions import (
8​ sphere_gen,
9​ create_mesh_object,
10​ store_properties,
11+ shade_smooth,
12​ draw_ant_refresh,
13​ draw_ant_main,
14​ draw_ant_noise,
15@@ -722,7 +723,7 @@ class AntAddLandscape(bpy.types.Operator):
16​ new_ob.select = True
17
18​ if self.smooth_mesh:
19- bpy.ops.object.shade_smooth()
20+ shade_smooth()
21
22​ if not self.at_cursor:
23​ new_ob.object.location = (0.0, 0.0, 0.0)
24@@ -768,7 +769,7 @@ class AntAddLandscape(bpy.types.Operator):
25​ wobj.select = True
26
27​ if self.smooth_mesh:
28- bpy.ops.object.shade_smooth()
29+ shade_smooth()
30
31​ if not self.at_cursor:
32​ wobj.object.location = (0.0, 0.0, 0.0)
33diff --git a/ant_landscape/ant_functions.py b/ant_landscape/ant_functions.py
34index 3b515933..6e7863ee 100644
35--- a/ant_landscape/ant_functions.py
36+++ b/ant_landscape/ant_functions.py
37@@ -124,6 +124,12 @@ def sphere_gen(sub_d_x, sub_d_y, tri, meshsize, props, water_plane, water_level)
38
39​ return verts, faces
40
41+# shade smooth in edit or object mode
42+def shade_smooth():
43+ if bpy.ops.object.shade_smooth.poll():
44+ bpy.ops.object.shade_smooth()
45+ else:
46+ bpy.ops.mesh.faces_shade_smooth()
47
48​ # ------------------------------------------------------------
49​ # Do refresh - redraw
50@@ -250,7 +256,7 @@ class AntLandscapeRegenerate(bpy.types.Operator):
51​ new_ob.select = True
52
53​ if ob['smooth_mesh']:
54- bpy.ops.object.shade_smooth()
55+ shade_smooth()
56
57​ # Landscape Material
58​ if ob['land_material'] != "" and ob['land_material'] in bpy.data.materials:
59@@ -291,9 +297,8 @@ class AntLandscapeRegenerate(bpy.types.Operator):
60​ wobj = create_mesh_object(context, verts, [], faces, new_name+"_plane").object
61
62​ wobj.select = True
63-
64​ if ob['smooth_mesh']:
65- bpy.ops.object.shade_smooth()
66+ shade_smooth()
67
68​ # Water Material
69​ if ob['water_material'] != "" and ob['water_material'] in bpy.data.materials:
70@@ -1074,7 +1079,7 @@ class Eroder(bpy.types.Operator):
71​ ob.vertex_groups.active = vg
72
73​ if self.smooth:
74- bpy.ops.object.shade_smooth()
75+ shade_smooth()
76​ self.stats.time()
77​ self.stats.memory()
78​ if self.showmeshstats:

or
1
2
3diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py
4index 5d25cf24..6a36c42f 100644
5--- a/ant_landscape/add_mesh_ant_landscape.py
6+++ b/ant_landscape/add_mesh_ant_landscape.py
7@@ -586,6 +586,14 @@ class AntAddLandscape(bpy.types.Operator):
8​ description="Automatic refresh"
9​ )
10
11+ @classmethod
12+ def poll(self, context):
13+ ob = context.object
14+ if ob is not None:
15+ if ob.mode == 'EDIT':
16+ return False
17+ return True
18+
19​ def draw(self, context):
20​ draw_ant_refresh(self, context)
21​ draw_ant_main(self, context, generate=True)

From a first glance there doesnt seem to be a reason to actually prevent adding in editmode...

@Philipp Oeser (lichtwerk) The majority of the issues stem from adding the Landscape to the INFO_MT_mesh_add instead of the INFO_MT_add menu which was probably done because the operator_context of the first one is INVOKE_REGION_WIN. If invoke is skipped the operator will never proceed to complete.

However like you said, maybe this could be allowed to be in Edit mode (even though this complicated things a bit) as for instance the operators in the N properties region need some refactor.

This addon should not be operating in edit mode. it is out of the scope and reasonable use case for the creation of huge vert counts.

i am not sure if this is related, or should be submitted as an own issue:

System Information
Linux 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Blender Version
2.79

Short description of error
if i want to activate the A.N.T Landscape plugin in the preferences i get the error shown in the following figure.

@Monika Wenger (moniwe) It's unrelated , the error you are having is a packaging error on ubuntu, grab the official distribution from http://www.blender.org and it'll work.