Mesh Solo Crashes Cloud Generator AddOn ( user persp (local) bug ) #40706

Closed
opened 2014-06-19 16:38:24 +02:00 by Atomic · 19 comments

System Information
OSX 10.9 16gb
Intel HD4000

Blender Version
Broken: Blender 2.71 RC2

Short description of error
When a mesh is soloed using the num pad slash "/" and the Cloud generator is run the result is an error in the cloud generator script.

Exact steps for others to reproduce the error
Open the default scene.
Select the cube.
Press the numpad "/" key to solo the cube.
Click the cloud generator button.

A context error occurs. This error condition should be handled better. Once the error occurs the AddOn becomes useless and you have to restart Blender to try again.

Edited by meta-androcto: To include several other addons affected by the same bug

**System Information** OSX 10.9 16gb Intel HD4000 **Blender Version** Broken: Blender 2.71 RC2 **Short description of error** When a mesh is soloed using the num pad slash "/" and the Cloud generator is run the result is an error in the cloud generator script. **Exact steps for others to reproduce the error** Open the default scene. Select the cube. Press the numpad "/" key to solo the cube. Click the cloud generator button. A context error occurs. This error condition should be handled better. Once the error occurs the AddOn becomes useless and you have to restart Blender to try again. Edited by meta-androcto: To include several other addons affected by the same bug
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @AtomP

Added subscriber: @AtomP

#38659 was marked as duplicate of this issue

#38659 was marked as duplicate of this issue

#40327 was marked as duplicate of this issue

#40327 was marked as duplicate of this issue
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Member

hi, I can confirm this bug,
I'm really not sure why this is happening.

Traceback (most recent call last):

File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\addons\object_cloud_gen.py", line 497, in execute
  bpy.ops.object.editmode_toggle()
File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\modules\bpy\ops.py", line 188, in __call__
  ret = op_call(self.idname_py(), None, kw)

RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect

location: :-1

I've tested also discombobulator addon with similar result:

Traceback (most recent call last):

File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\addons_contrib\mesh_discombobulator.py", line 561, in execute
  discombobulate(scn.minHeight, scn.maxHeight, scn.minTaper, scn.maxTaper, scn.subpolygon1, scn.subpolygon2, scn.subpolygon3, scn.subpolygon4, scn.mindoodads, scn.maxdoodads, scn.repeatprot, scn.sideProtMat, scn.topProtMat, isLast)
File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\addons_contrib\mesh_discombobulator.py", line 466, in discombobulate
  obverts = bpy.context.active_object.data.vertices

AttributeError: 'NoneType' object has no attribute 'data'

location: :-1

might be best to ask ideasman to look at.

hi, I can confirm this bug, I'm really not sure why this is happening. Traceback (most recent call last): ``` File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\addons\object_cloud_gen.py", line 497, in execute bpy.ops.object.editmode_toggle() File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\modules\bpy\ops.py", line 188, in __call__ ret = op_call(self.idname_py(), None, kw) ``` RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect location: <unknown location>:-1 I've tested also discombobulator addon with similar result: Traceback (most recent call last): ``` File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\addons_contrib\mesh_discombobulator.py", line 561, in execute discombobulate(scn.minHeight, scn.maxHeight, scn.minTaper, scn.maxTaper, scn.subpolygon1, scn.subpolygon2, scn.subpolygon3, scn.subpolygon4, scn.mindoodads, scn.maxdoodads, scn.repeatprot, scn.sideProtMat, scn.topProtMat, isLast) File "C:\Users\Dad\Downloads\blender-2.71-150614-win64\blender-2.71-29e8c46-win64\2.71\scripts\addons_contrib\mesh_discombobulator.py", line 466, in discombobulate obverts = bpy.context.active_object.data.vertices ``` AttributeError: 'NoneType' object has no attribute 'data' location: <unknown location>:-1 might be best to ask ideasman to look at.
Member

hi, testing further addons,
Object Mangle Tools: if run in User Persp (local) the addon runs, but when returning to camera perspective mode, there's a temp object visible. this does not happen when the addon is run in Camera View.
mangle_correct.jpg

mangle_with_temp_object.jpg

hi, testing further addons, Object Mangle Tools: if run in User Persp (local) the addon runs, but when returning to camera perspective mode, there's a temp object visible. this does not happen when the addon is run in Camera View. ![mangle_correct.jpg](https://archive.blender.org/developer/F94988/mangle_correct.jpg) ![mangle_with_temp_object.jpg](https://archive.blender.org/developer/F94990/mangle_with_temp_object.jpg)
Campbell Barton self-assigned this 2014-06-20 18:27:11 +02:00
Member

Added subscribers: @b1657022405, @mont29, @lopataasdf, @eclectiel

Added subscribers: @b1657022405, @mont29, @lopataasdf, @eclectiel
Member

◀ Merged tasks: #40327.

◀ Merged tasks: #40327.
Member

Merged in bsurfaces local view report, it throws the same error as Cloud Gen.
RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect

I've gone back to Blender 2.63 & the same error exists.
This makes me wonder if it's not a longer term bug that's only recently come to light.

Merged in bsurfaces local view report, it throws the same error as Cloud Gen. RuntimeError: Operator bpy.ops.object.editmode_toggle.poll() failed, context is incorrect I've gone back to Blender 2.63 & the same error exists. This makes me wonder if it's not a longer term bug that's only recently come to light.
Brendon Murphy changed title from Mesh Solo Crashes Cloud Generator AddOn to Mesh Solo Crashes Cloud Generator AddOn ( user persp (local) bug ) 2014-06-22 09:55:13 +02:00
Member

Added subscribers: @scheherazade, @CodeManX

Added subscribers: @scheherazade, @CodeManX
Member

◀ Merged tasks: #38659.

◀ Merged tasks: #38659.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

first investigation shows that indeed the context's active object is NULL in that case; investigating further...

first investigation shows that indeed the context's active object is NULL in that case; investigating further...
Member

my take on this:
addons might add (helper-)objects along the way of their execution.
if this happens in localview the new object will be 'correctly' linked to the scene etc. but it will not
be assigned the same localview-layer as we are currently in in the 3dview (and there doesnt seem to be a way to do this via python afterwards).
this in turn will result in a context that is not suited for possible calls to bpy.ops.XXX (context might be None for 'context.active_object', 'selected_editable_objects' etc.)

for example:
setting context.active_object in localview to an object that is existing, but not in the same localview-layer will:

  • return None for 'context.active_object' (in the context of the current, local 3DView)
  • return the correct object for 'context.active_object' (in any other context [e.g. non-local 3DView or TextEditor])

a lot of operators (bpy.ops) will poll for this and throw an error if there is no active object [just like the message we can see in the report]

for a very simple example have a look at attached 'T40706_simple_example.blend'T40706_simple_example.blend

So how could this be fixed? Some ideas:

(1) expose write-access from python to an object's 'layers_local_view' array
this way I assume we could change the addons to correctly add their objects to the localview-layer as well
(which will then most certainly return something good for 'context.active_object' as well, I guess)
will have a look if I get that working...

(2) change the addons to leave localview before execution (and return to local afterwards?)lame...(3) change the addons to override the context with the active_object in question
does this even work for all ops? quite tedious, and I couldnt get it to work all the way
see attached patch 'T40706_override_context_try.patch'T40706_override_context_try.patch

(4) 'fix' context to return an active_object etc. (even though this is not in the same localview-layer)
not sure about consequences this has...

Let me know what you think

my take on this: addons might add (helper-)objects along the way of their execution. if this happens in localview the new object will be 'correctly' linked to the scene etc. but it will not be assigned the same localview-layer as we are currently in in the 3dview (and there doesnt seem to be a way to do this via python afterwards). this in turn will result in a context that is not suited for possible calls to bpy.ops.XXX (context might be None for 'context.active_object', 'selected_editable_objects' etc.) for example: setting context.active_object in localview to an object that is existing, but _not_ in the same localview-layer will: - return None for 'context.active_object' (in the context of the current, local 3DView) - return the correct object for 'context.active_object' (in any other context [e.g. non-local 3DView or TextEditor]) a lot of operators (bpy.ops) will poll for this and throw an error if there is no active object [just like the message we can see in the report] for a very simple example have a look at attached 'T40706_simple_example.blend'[T40706_simple_example.blend](https://archive.blender.org/developer/F115747/T40706_simple_example.blend) So how could this be fixed? Some ideas: **(1) expose write-access from python to an object's 'layers_local_view' array** this way I assume we could change the addons to correctly add their objects to the localview-layer as well (which will then most certainly return something good for 'context.active_object' as well, I guess) will have a look if I get that working... **(2) change the addons to leave localview before execution (and return to local afterwards?)**lame...**(3) change the addons to override the context with the active_object in question** does this even work for all ops? quite tedious, and I couldnt get it to work all the way see attached patch 'T40706_override_context_try.patch'[T40706_override_context_try.patch](https://archive.blender.org/developer/F115748/T40706_override_context_try.patch) **(4) 'fix' context to return an active_object etc. (even though this is not in the same localview-layer)** not sure about consequences this has... Let me know what you think

Added subscriber: @AditiaA.Pratama

Added subscriber: @AditiaA.Pratama
Member

committed initial fix somewhat baindaid to prevent execution in local view mode with print warning & prevent ui draw with Cycles active in object_cloud_gen 4ac0fa2ac5
moving this to To Do as it affects other addons & is not entirely solved.

committed initial fix somewhat baindaid to prevent execution in local view mode with print warning & prevent ui draw with Cycles active in object_cloud_gen 4ac0fa2ac5 moving this to To Do as it affects other addons & is not entirely solved.
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

closing as archived, it's possible to add a poll to addons which don't work correctly in local view on a per addon basis.
As it's an issue we are aware of, it's hopeful to solve/improve with the new viewport in 2.8.

closing as archived, it's possible to add a poll to addons which don't work correctly in local view on a per addon basis. As it's an issue we are aware of, it's hopeful to solve/improve with the new viewport in 2.8.
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 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#40706
No description provided.