Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons-contrib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons-contrib
Commits
ab0aba23
Commit
ab0aba23
authored
May 16, 2017
by
kostex
Browse files
Options
Downloads
Patches
Plain Diff
object_mesh_versions: changed cleanup mode behaviour
parent
5108c882
No related branches found
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
object_mesh_versions.py
+86
-57
86 additions, 57 deletions
object_mesh_versions.py
with
86 additions
and
57 deletions
object_mesh_versions.py
+
86
−
57
View file @
ab0aba23
...
@@ -16,18 +16,21 @@
...
@@ -16,18 +16,21 @@
#
#
# ##### END GPL LICENSE BLOCK #####
# ##### END GPL LICENSE BLOCK #####
import
bpy
import
time
from
datetime
import
datetime
from
bpy.types
import
Menu
,
Panel
from
bpy.props
import
StringProperty
,
BoolProperty
bl_info
=
{
bl_info
=
{
"
name
"
:
"
KTX Mesh Versions
"
,
"
name
"
:
"
KTX Mesh Versions
"
,
"
author
"
:
"
Roel Koster, @koelooptiemanna, irc:kostex
"
,
"
author
"
:
"
Roel Koster, @koelooptiemanna, irc:kostex
"
,
"
version
"
:
(
1
,
4
,
2
),
"
version
"
:
(
1
,
4
,
3
),
"
blender
"
:
(
2
,
7
,
0
),
"
blender
"
:
(
2
,
7
,
0
),
"
location
"
:
"
View3D > Properties
"
,
"
location
"
:
"
View3D > Properties
"
,
"
category
"
:
"
Object
"
}
"
category
"
:
"
Object
"
}
import
bpy
,
time
from
datetime
import
datetime
from
bpy.types
import
Menu
,
Panel
from
bpy.props
import
StringProperty
,
BoolProperty
class
KTX_MeshInit
(
bpy
.
types
.
Operator
):
class
KTX_MeshInit
(
bpy
.
types
.
Operator
):
bl_label
=
"
Initialise Mesh Versioning
"
bl_label
=
"
Initialise Mesh Versioning
"
...
@@ -39,6 +42,7 @@ class KTX_MeshInit(bpy.types.Operator):
...
@@ -39,6 +42,7 @@ class KTX_MeshInit(bpy.types.Operator):
context
.
object
.
data
.
ktx_mesh_id
=
context
.
object
.
ktx_object_id
=
unique_id
context
.
object
.
data
.
ktx_mesh_id
=
context
.
object
.
ktx_object_id
=
unique_id
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
class
KTX_MeshSelect
(
bpy
.
types
.
Operator
):
class
KTX_MeshSelect
(
bpy
.
types
.
Operator
):
bl_label
=
"
Select Mesh
"
bl_label
=
"
Select Mesh
"
bl_idname
=
"
ktx.meshversions_select
"
bl_idname
=
"
ktx.meshversions_select
"
...
@@ -55,6 +59,7 @@ class KTX_MeshSelect(bpy.types.Operator):
...
@@ -55,6 +59,7 @@ class KTX_MeshSelect(bpy.types.Operator):
bpy
.
ops
.
object
.
mode_set
(
mode
=
c_mode
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
c_mode
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
class
KTX_MeshRemove
(
bpy
.
types
.
Operator
):
class
KTX_MeshRemove
(
bpy
.
types
.
Operator
):
bl_label
=
"
Remove Mesh
"
bl_label
=
"
Remove Mesh
"
bl_idname
=
"
ktx.meshversions_remove
"
bl_idname
=
"
ktx.meshversions_remove
"
...
@@ -66,6 +71,19 @@ class KTX_MeshRemove(bpy.types.Operator):
...
@@ -66,6 +71,19 @@ class KTX_MeshRemove(bpy.types.Operator):
bpy
.
data
.
meshes
.
remove
(
bpy
.
data
.
meshes
[
self
.
m_index
])
bpy
.
data
.
meshes
.
remove
(
bpy
.
data
.
meshes
[
self
.
m_index
])
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
class
KTX_Cleanup
(
bpy
.
types
.
Operator
):
bl_label
=
"
Cleanup Mode
"
bl_idname
=
"
ktx.cleanup
"
bl_description
=
"
Cleanup Mode
"
def
execute
(
self
,
context
):
for
o
in
bpy
.
data
.
objects
:
o
.
select
=
False
context
.
scene
.
objects
.
active
=
None
return
{
'
FINISHED
'
}
class
KTX_MeshCreate
(
bpy
.
types
.
Operator
):
class
KTX_MeshCreate
(
bpy
.
types
.
Operator
):
bl_label
=
"
Create Mesh Version
"
bl_label
=
"
Create Mesh Version
"
bl_idname
=
"
ktx.meshversions_create
"
bl_idname
=
"
ktx.meshversions_create
"
...
@@ -86,6 +104,7 @@ class KTX_MeshCreate(bpy.types.Operator):
...
@@ -86,6 +104,7 @@ class KTX_MeshCreate(bpy.types.Operator):
bpy
.
ops
.
object
.
mode_set
(
mode
=
c_mode
)
bpy
.
ops
.
object
.
mode_set
(
mode
=
c_mode
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
class
KTX_Mesh_Versions
(
bpy
.
types
.
Panel
):
class
KTX_Mesh_Versions
(
bpy
.
types
.
Panel
):
bl_label
=
"
KTX Mesh Versions
"
bl_label
=
"
KTX Mesh Versions
"
bl_idname
=
"
ktx.meshversions
"
bl_idname
=
"
ktx.meshversions
"
...
@@ -96,9 +115,10 @@ class KTX_Mesh_Versions(bpy.types.Panel):
...
@@ -96,9 +115,10 @@ class KTX_Mesh_Versions(bpy.types.Panel):
scene
=
context
.
scene
scene
=
context
.
scene
obj
=
context
.
object
obj
=
context
.
object
layout
=
self
.
layout
layout
=
self
.
layout
if
obj
==
None
:
layout
.
label
(
'
No Object Selected
'
)
meshes_exist
=
bool
(
bpy
.
data
.
meshes
.
items
()
!=
[])
else
:
if
meshes_exist
:
if
obj
!=
None
:
if
obj
.
type
==
'
MESH
'
:
if
obj
.
type
==
'
MESH
'
:
if
obj
.
ktx_object_id
!=
''
and
(
obj
.
data
.
ktx_mesh_id
==
obj
.
ktx_object_id
):
if
obj
.
ktx_object_id
!=
''
and
(
obj
.
data
.
ktx_mesh_id
==
obj
.
ktx_object_id
):
icon
=
'
PINNED
'
if
scene
.
ktx_defpin
else
'
UNPINNED
'
icon
=
'
PINNED
'
if
scene
.
ktx_defpin
else
'
UNPINNED
'
...
@@ -119,10 +139,15 @@ class KTX_Mesh_Versions(bpy.types.Panel):
...
@@ -119,10 +139,15 @@ class KTX_Mesh_Versions(bpy.types.Panel):
icon
=
'
PINNED
'
if
m
.
use_fake_user
else
'
UNPINNED
'
icon
=
'
PINNED
'
if
m
.
use_fake_user
else
'
UNPINNED
'
row
.
prop
(
m
,
"
use_fake_user
"
,
text
=
""
,
icon
=
icon
)
row
.
prop
(
m
,
"
use_fake_user
"
,
text
=
""
,
icon
=
icon
)
box
.
label
()
box
.
label
()
row
=
layout
.
row
(
align
=
True
)
row
.
operator
(
"
ktx.cleanup
"
,
text
=
"
Cleanup Mode
"
)
else
:
else
:
layout
.
operator
(
"
ktx.meshversions_init
"
)
layout
.
operator
(
"
ktx.meshversions_init
"
)
else
:
else
:
if
bpy
.
data
.
meshes
.
items
()
!=
[]:
layout
.
label
(
"
Select a Mesh Object
"
)
layout
.
operator
(
"
ktx.cleanup
"
,
text
=
"
Cleanup Mode
"
)
else
:
layout
.
label
(
'
All Meshes (Cleanup/Pin):
'
)
layout
.
label
(
'
All Meshes (Cleanup/Pin):
'
)
box
=
layout
.
box
()
box
=
layout
.
box
()
box
.
scale_y
=
0.65
box
.
scale_y
=
0.65
...
@@ -135,6 +160,9 @@ class KTX_Mesh_Versions(bpy.types.Panel):
...
@@ -135,6 +160,9 @@ class KTX_Mesh_Versions(bpy.types.Panel):
icon
=
'
PINNED
'
if
m
.
use_fake_user
else
'
UNPINNED
'
icon
=
'
PINNED
'
if
m
.
use_fake_user
else
'
UNPINNED
'
row
.
prop
(
m
,
"
use_fake_user
"
,
text
=
""
,
icon
=
icon
)
row
.
prop
(
m
,
"
use_fake_user
"
,
text
=
""
,
icon
=
icon
)
box
.
label
()
box
.
label
()
else
:
layout
.
label
(
"
No Meshes Exist
"
)
def
register
():
def
register
():
bpy
.
types
.
Object
.
ktx_object_id
=
bpy
.
props
.
StringProperty
(
name
=
"
KTX Object ID
"
,
description
=
"
Unique ID to
'
link
'
one object to multiple meshes
"
)
bpy
.
types
.
Object
.
ktx_object_id
=
bpy
.
props
.
StringProperty
(
name
=
"
KTX Object ID
"
,
description
=
"
Unique ID to
'
link
'
one object to multiple meshes
"
)
...
@@ -149,5 +177,6 @@ def unregister():
...
@@ -149,5 +177,6 @@ def unregister():
del
bpy
.
types
.
Object
.
ktx_object_id
del
bpy
.
types
.
Object
.
ktx_object_id
del
bpy
.
types
.
Scene
.
ktx_defpin
del
bpy
.
types
.
Scene
.
ktx_defpin
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
register
()
register
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment