[Addon] KTX_MeshVersions (Create versions of current mesh on the fly) #51177

Closed
opened 2017-04-11 14:57:47 +02:00 by Roel Koster · 14 comments
Member

Hi There,

I've released a plugin a while ago on Github and made people aware of it on IRC, Twitter and BlenderArtists
https://blenderartists.org/forum/showthread.php?416861-Blender-Meshversions-addon

A quick tutorial has been made on Youtube:
https://www.youtube.com/watch?v=bcxVqEOMXgw&feature=youtu.be

I'm sorry but I can't provide you with a wiki page (yet)

Today I was approached by Brendon Murphy (meta-androcto) on IRC and he thought it was a shame that only few people are aware of this little addon,
so he suggested to me to do what I'm doing now ;-)

I've attached the python script.. It's really no rocket science and it works by copying mesh data and relinking it to the current object.
The elaborate naming of the mesh is to prevent it relinking to newly created objects with the same base name.

Of course you are free to do with it what you want, rename, alter or discard ;-)

KTX_MeshVersions.py

Hi There, I've released a plugin a while ago on Github and made people aware of it on IRC, Twitter and BlenderArtists https://blenderartists.org/forum/showthread.php?416861-Blender-Meshversions-addon A quick tutorial has been made on Youtube: https://www.youtube.com/watch?v=bcxVqEOMXgw&feature=youtu.be I'm sorry but I can't provide you with a wiki page (yet) Today I was approached by Brendon Murphy (meta-androcto) on IRC and he thought it was a shame that only few people are aware of this little addon, so he suggested to me to do what I'm doing now ;-) I've attached the python script.. It's really no rocket science and it works by copying mesh data and relinking it to the current object. The elaborate naming of the mesh is to prevent it relinking to newly created objects with the same base name. Of course you are free to do with it what you want, rename, alter or discard ;-) [KTX_MeshVersions.py](https://archive.blender.org/developer/F542537/KTX_MeshVersions.py)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @kostex

Added subscriber: @kostex
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Brendon Murphy self-assigned this 2017-04-11 15:11:46 +02:00
Member

hi, thanks for creating the task, after testing the addon a few times it works very well, I will test this out over the next few days.
So far it looks good to fill a gap in mesh modeling tools.

hi, thanks for creating the task, after testing the addon a few times it works very well, I will test this out over the next few days. So far it looks good to fill a gap in mesh modeling tools.
Member

@kostex
hi, testing some more, I think it's needed to have a function to delete unwanted mesh versions,
also tooltips are important for users to understand functions,
I think also edit mode needs some update function?
creating a subdivided version of the mesh seemed to not work when saving.
any ideas here?

@kostex hi, testing some more, I think it's needed to have a function to delete unwanted mesh versions, also tooltips are important for users to understand functions, I think also edit mode needs some update function? creating a subdivided version of the mesh seemed to not work when saving. any ideas here?
Author
Member

Hi,
deleting unwanted mesh versions is something I've investigated.. but it's Blender that is not allowing it..
It's the same behaviour as discarding textures/materials.. they only really get purged when saving/re-opening the file.
But maybe I'm wrong..

Tooltips is no problem, I'll look into that.
As soon as I want to implement more intelligent 'snapshots' of a mesh, a great deal of programming is needed. At this time it's just based around ONE blender python function bpy.context.object.data.copy()
My level of expertise stops around there ;-)

The edit mode needing update function I don't understand.. The mesh gets updated as soon as you change to another version does it not?

Hi, deleting unwanted mesh versions is something I've investigated.. but it's Blender that is not allowing it.. It's the same behaviour as discarding textures/materials.. they only really get purged when saving/re-opening the file. But maybe I'm wrong.. Tooltips is no problem, I'll look into that. As soon as I want to implement more intelligent 'snapshots' of a mesh, a great deal of programming is needed. At this time it's just based around ONE blender python function bpy.context.object.data.copy() My level of expertise stops around there ;-) The edit mode needing update function I don't understand.. The mesh gets updated as soon as you change to another version does it not?
Author
Member

The added tooltips.. and mesh remove!
KTX_MeshVersions.py

or get it at my github
https://github.com/kostex/blenderscripts/blob/master/KTX_MeshVersions.py

The added tooltips.. and mesh remove! [KTX_MeshVersions.py](https://archive.blender.org/developer/F545348/KTX_MeshVersions.py) or get it at my github https://github.com/kostex/blenderscripts/blob/master/KTX_MeshVersions.py

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

For discarding meshes give a tooltip explaining purge all function in the Outliner.

Yeah that is a bit weak sauce, but not all users know about it.

For discarding meshes give a tooltip explaining `purge all` function in the Outliner. Yeah that is a bit weak sauce, but not all users know about it.
Author
Member

The addon uses bpy.data.meshes.remove(..mesh..) function and it is working without the need for purging? In the outliner the orphaned meshes disappear when removed with the addon.
I don't know when Blender team implemented this purging, maybe long time ago, but I was always under the impression that you cannot purge without save/reopen..
Anyhow.. so the outliner button purge all is not required I would think.
So the option "delete unwanted meshes" has been implemented now.. the code needs a better approach in disabling deletion of the last mesh..
At this time I'm just iterating the same loop twice to find out if there is only one 'linked/stored' mesh in the active object..

The addon uses bpy.data.meshes.remove(..mesh..) function and it is working without the need for purging? In the outliner the orphaned meshes disappear when removed with the addon. I don't know when Blender team implemented this purging, maybe long time ago, but I was always under the impression that you cannot purge without save/reopen.. Anyhow.. so the outliner button purge all is not required I would think. So the option "delete unwanted meshes" has been implemented now.. the code needs a better approach in disabling deletion of the last mesh.. At this time I'm just iterating the same loop twice to find out if there is only one 'linked/stored' mesh in the active object..
Author
Member

I've found out that due to automatic naming of objects in Blender it can get messy.. independent of the addon.
Example:
Open Blender
Create Plane (it will have the name Plane)
Blender attaches a mesh with the name Plane
Delete te Plane
Create a Plane
This time the object is still named Plane, but the mesh will be named Plane.001

The addon will not be able to handle this at this time.. you will get the previous left over Plane mesh selectable too.. hope it all makes sense.

I'm thinking of renaming the original object/mesh to the same naming convention as the consecutive mesh versions as soon as the addon is used..
Will investigate.

I've found out that due to automatic naming of objects in Blender it can get messy.. independent of the addon. Example: Open Blender Create Plane (it will have the name Plane) Blender attaches a mesh with the name Plane Delete te Plane Create a Plane This time the object is still named Plane, but the mesh will be named Plane.001 The addon will not be able to handle this at this time.. you will get the previous left over Plane mesh selectable too.. hope it all makes sense. I'm thinking of renaming the original object/mesh to the same naming convention as the consecutive mesh versions as soon as the addon is used.. Will investigate.
Author
Member

I've made some intensive changes.. The naming of the versions has changed.
There were way too many ways to get mixups when having multiple similar named objects in the scene.
Blender does that .001, .002 naming of meshes when there's already a similar named object.
i.e.
Start Fresh
Create plane
Object will be named: Plane
Mesh will be named: Plane
Delete Plane
Create Plane
Object will be named: Plane
Mesh will be named: Plane.001

Since the addon will search for meshes with the same name, mixups can occur.
This has been fixed now by initialising the addon.. that way, the object and mesh will be renamed to something relatively unique, but both have the same name.
New versions will just get the default blender behavior naming convention: .001 .002 etc
No more dates/microseconds etc.

Another option is added: when no mesh is selected but let's say a camera.. the addon will jump into cleanup mode.
I'm not perfectly happy with that approach.. but think of something more logical..
The cleanup mode lets users remove stray/orphaned meshes and or pin them (fake_user=true)

Next, when I find the time, I will try to change all to use UILists

KTX_MeshVersions.py

I've made some intensive changes.. The naming of the versions has changed. There were way too many ways to get mixups when having multiple similar named objects in the scene. Blender does that .001, .002 naming of meshes when there's already a similar named object. i.e. Start Fresh Create plane Object will be named: Plane Mesh will be named: Plane Delete Plane Create Plane Object will be named: Plane Mesh will be named: Plane.001 Since the addon will search for meshes with the same name, mixups can occur. This has been fixed now by initialising the addon.. that way, the object and mesh will be renamed to something relatively unique, but both have the same name. New versions will just get the default blender behavior naming convention: .001 .002 etc No more dates/microseconds etc. Another option is added: when no mesh is selected but let's say a camera.. the addon will jump into cleanup mode. I'm not perfectly happy with that approach.. but think of something more logical.. The cleanup mode lets users remove stray/orphaned meshes and or pin them (fake_user=true) Next, when I find the time, I will try to change all to use UILists [KTX_MeshVersions.py](https://archive.blender.org/developer/F546167/KTX_MeshVersions.py)
Member

Changed status from 'Open' to: 'Resolved'

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

committed to contrib, closed as resolved

committed to contrib, closed as resolved
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 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#51177
No description provided.