ANT Landscape report error traceback #53624

Closed
opened 2017-12-24 00:50:19 +01:00 by T1m3p3n · 21 comments

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
recent.jpeg

**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 ![recent.jpeg](https://archive.blender.org/developer/F1507928/recent.jpeg)
Author

Added subscriber: @T1m3p3n

Added subscriber: @T1m3p3n

Added subscriber: @FloridaJo

Added subscriber: @FloridaJo

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

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

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

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.

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.

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.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

So I guess solution is either
P582: fix #53624 - fix adding in editmode



diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py
index 5d25cf24..82e179a0 100644
--- a/ant_landscape/add_mesh_ant_landscape.py
+++ b/ant_landscape/add_mesh_ant_landscape.py
@@ -35,6 +35,7 @@ from .ant_functions import (
         sphere_gen,
         create_mesh_object,
         store_properties,
+        shade_smooth,
         draw_ant_refresh,
         draw_ant_main,
         draw_ant_noise,
@@ -722,7 +723,7 @@ class AntAddLandscape(bpy.types.Operator):
         new_ob.select = True
 
         if self.smooth_mesh:
-            bpy.ops.object.shade_smooth()
+            shade_smooth()
 
         if not self.at_cursor:
             new_ob.object.location = (0.0, 0.0, 0.0)
@@ -768,7 +769,7 @@ class AntAddLandscape(bpy.types.Operator):
             wobj.select = True
 
             if self.smooth_mesh:
-                bpy.ops.object.shade_smooth()
+                shade_smooth()
 
             if not self.at_cursor:
                 wobj.object.location = (0.0, 0.0, 0.0)
diff --git a/ant_landscape/ant_functions.py b/ant_landscape/ant_functions.py
index 3b515933..6e7863ee 100644
--- a/ant_landscape/ant_functions.py
+++ b/ant_landscape/ant_functions.py
@@ -124,6 +124,12 @@ def sphere_gen(sub_d_x, sub_d_y, tri, meshsize, props, water_plane, water_level)
 
     return verts, faces
 
+# shade smooth in edit or object mode
+def shade_smooth():
+    if bpy.ops.object.shade_smooth.poll():
+        bpy.ops.object.shade_smooth()
+    else:
+        bpy.ops.mesh.faces_shade_smooth()
 
 # ------------------------------------------------------------
 # Do refresh - redraw
@@ -250,7 +256,7 @@ class AntLandscapeRegenerate(bpy.types.Operator):
             new_ob.select = True
 
             if ob['smooth_mesh']:
-                bpy.ops.object.shade_smooth()
+                shade_smooth()
 
             # Landscape Material
             if ob['land_material'] != "" and ob['land_material'] in bpy.data.materials:
@@ -291,9 +297,8 @@ class AntLandscapeRegenerate(bpy.types.Operator):
                     wobj = create_mesh_object(context, verts, - [ ], faces, new_name+"_plane").object
 
                 wobj.select = True
-
                 if ob['smooth_mesh']:
-                    bpy.ops.object.shade_smooth()
+                    shade_smooth()
 
                 # Water Material
                 if ob['water_material'] != "" and ob['water_material'] in bpy.data.materials:
@@ -1074,7 +1079,7 @@ class Eroder(bpy.types.Operator):
         ob.vertex_groups.active = vg
 
         if self.smooth:
-            bpy.ops.object.shade_smooth()
+            shade_smooth()
         self.stats.time()
         self.stats.memory()
         if self.showmeshstats:

or
P581: fix #53624 - prevent adding in editmode



diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py
index 5d25cf24..6a36c42f 100644
--- a/ant_landscape/add_mesh_ant_landscape.py
+++ b/ant_landscape/add_mesh_ant_landscape.py
@@ -586,6 +586,14 @@ class AntAddLandscape(bpy.types.Operator):
             description="Automatic refresh"
             )
 
+    @classmethod
+    def poll(self, context):
+        ob = context.object
+        if ob is not None:
+            if ob.mode == 'EDIT':
+                return False
+        return True
+
     def draw(self, context):
         draw_ant_refresh(self, context)
         draw_ant_main(self, context, generate=True)

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

So I guess solution is either [P582: fix #53624 - fix adding in editmode](https://archive.blender.org/developer/P582.txt) ``` diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py index 5d25cf24..82e179a0 100644 --- a/ant_landscape/add_mesh_ant_landscape.py +++ b/ant_landscape/add_mesh_ant_landscape.py @@ -35,6 +35,7 @@ from .ant_functions import ( sphere_gen, create_mesh_object, store_properties, + shade_smooth, draw_ant_refresh, draw_ant_main, draw_ant_noise, @@ -722,7 +723,7 @@ class AntAddLandscape(bpy.types.Operator): new_ob.select = True if self.smooth_mesh: - bpy.ops.object.shade_smooth() + shade_smooth() if not self.at_cursor: new_ob.object.location = (0.0, 0.0, 0.0) @@ -768,7 +769,7 @@ class AntAddLandscape(bpy.types.Operator): wobj.select = True if self.smooth_mesh: - bpy.ops.object.shade_smooth() + shade_smooth() if not self.at_cursor: wobj.object.location = (0.0, 0.0, 0.0) diff --git a/ant_landscape/ant_functions.py b/ant_landscape/ant_functions.py index 3b515933..6e7863ee 100644 --- a/ant_landscape/ant_functions.py +++ b/ant_landscape/ant_functions.py @@ -124,6 +124,12 @@ def sphere_gen(sub_d_x, sub_d_y, tri, meshsize, props, water_plane, water_level) return verts, faces +# shade smooth in edit or object mode +def shade_smooth(): + if bpy.ops.object.shade_smooth.poll(): + bpy.ops.object.shade_smooth() + else: + bpy.ops.mesh.faces_shade_smooth() # ------------------------------------------------------------ # Do refresh - redraw @@ -250,7 +256,7 @@ class AntLandscapeRegenerate(bpy.types.Operator): new_ob.select = True if ob['smooth_mesh']: - bpy.ops.object.shade_smooth() + shade_smooth() # Landscape Material if ob['land_material'] != "" and ob['land_material'] in bpy.data.materials: @@ -291,9 +297,8 @@ class AntLandscapeRegenerate(bpy.types.Operator): wobj = create_mesh_object(context, verts, - [ ], faces, new_name+"_plane").object wobj.select = True - if ob['smooth_mesh']: - bpy.ops.object.shade_smooth() + shade_smooth() # Water Material if ob['water_material'] != "" and ob['water_material'] in bpy.data.materials: @@ -1074,7 +1079,7 @@ class Eroder(bpy.types.Operator): ob.vertex_groups.active = vg if self.smooth: - bpy.ops.object.shade_smooth() + shade_smooth() self.stats.time() self.stats.memory() if self.showmeshstats: ``` or [P581: fix #53624 - prevent adding in editmode](https://archive.blender.org/developer/P581.txt) ``` diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py index 5d25cf24..6a36c42f 100644 --- a/ant_landscape/add_mesh_ant_landscape.py +++ b/ant_landscape/add_mesh_ant_landscape.py @@ -586,6 +586,14 @@ class AntAddLandscape(bpy.types.Operator): description="Automatic refresh" ) + @classmethod + def poll(self, context): + ob = context.object + if ob is not None: + if ob.mode == 'EDIT': + return False + return True + def draw(self, context): draw_ant_refresh(self, context) draw_ant_main(self, context, generate=True) ``` From a first glance there doesnt seem to be a reason to actually prevent adding in editmode...

@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.

@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.
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Member

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.

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.

Added subscriber: @moniwe

Added subscriber: @moniwe

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.

Bildschirmfoto_2018-01-20_22-46-19.png

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. ![Bildschirmfoto_2018-01-20_22-46-19.png](https://archive.blender.org/developer/F1914234/Bildschirmfoto_2018-01-20_22-46-19.png)
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

@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.

@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.

This issue was referenced by 87579bd164

This issue was referenced by 87579bd164c60ac7e6861be49bc7bcd4b84641ce
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @Akash-Desai

Added subscriber: @Akash-Desai

Screenshot from 2018-10-13 17-50-42.png its giving this error to me. any fixes please??

![Screenshot from 2018-10-13 17-50-42.png](https://archive.blender.org/developer/F5051559/Screenshot_from_2018-10-13_17-50-42.png) its giving this error to me. any fixes please??

Added subscriber: @StephenSwaney

Added subscriber: @StephenSwaney

In #53624#542204, @Akash-Desai wrote:
Screenshot from 2018-10-13 17-50-42.png its giving this error to me. any fixes please??

File a bug report. This is a separate problem. Make sure you are using an official blender release.

> In #53624#542204, @Akash-Desai wrote: > ![Screenshot from 2018-10-13 17-50-42.png](https://archive.blender.org/developer/F5051559/Screenshot_from_2018-10-13_17-50-42.png) its giving this error to me. any fixes please?? File a bug report. This is a separate problem. Make sure you are using an official blender release.
Sign in to join this conversation.
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#53624
No description provided.