Skip to content

Commit

Permalink
blender-qmc v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
don1138 committed Aug 8, 2024
1 parent a27544e commit f74ba5a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 41 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### 1.7.0 <!-- 08/08/24 -->

- Add **Set Viewport Color** checkbox
- When selected, this changes the **Viewport Color** of the material.
- Rename **Selected Node** > **Selected Node Only**
- Rename **World Background** > **Set World Background**

### 1.6.0 <!-- 07/05/24 -->

- Add **COCO Segmentation** set of 183 colors
Expand Down
37 changes: 17 additions & 20 deletions blender-qmc-plus/blender-qmc-plus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"name" : "QMC+ (Quick Material Colors Plus)",
"description": "Sets the Base Color of a Material Shader",
"author" : "Don Schnitzius",
"version" : (1, 6, 0),
"version" : (1, 7, 0),
"blender" : (2, 80, 0),
"location" : "3D Viewport > Sidebar > MAT > Quick Material Colors",
"warning" : "",
Expand All @@ -42,18 +42,10 @@

# BOOLEAN FOR PANEL
class QMC_SETTINGS(bpy.types.PropertyGroup):
rename_material_more: bpy.props.BoolProperty(
name='',
default=False
)
active_node_more: bpy.props.BoolProperty(
name='',
default=False
)
world_color_more: bpy.props.BoolProperty(
name='',
default=False
)
active_node_more: bpy.props.BoolProperty(name='',default=False)
rename_material_more: bpy.props.BoolProperty(name='',default=False)
diffuse_more: bpy.props.BoolProperty(name='',default=False)
world_color_more: bpy.props.BoolProperty(name='',default=False)


# PARENT PANEL
Expand All @@ -63,27 +55,30 @@ class QMCPanel(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "MAT"
# bl_options = {'DEFAULT_CLOSED'}
bl_options = {'DEFAULT_CLOSED'}

def draw(self, context):
layout = self.layout
more_bool = context.scene.more_bool
active_bool = context.scene.active_bool
more_bool = context.scene.more_bool
diffuse_bool = context.scene.diffuse_bool
world_bool = context.scene.world_bool

srow = layout.row()
scol = srow.column(align=True)
scol.scale_y = 1.25
scol.prop(more_bool, "rename_material_more")
scol.prop(active_bool, "active_node_more")
scol.prop(more_bool, "rename_material_more")
scol.prop(diffuse_bool, "diffuse_more")
scol.prop(world_bool, "world_color_more")

scol = srow.column(align=True)
scol.scale_y = 1.25
scol.scale_x = 3.0
scol.label(text="Selected Node Only")
scol.label(text="Rename Material")
scol.label(text="Selected Node")
scol.label(text="World Background")
scol.label(text="Set Viewport Color")
scol.label(text="Set World Background")


# IMPORT PANELS
Expand Down Expand Up @@ -140,15 +135,17 @@ def register():
g.c_icons.load(os.path.splitext(entry)[0], os.path.join(icons_dir, entry), "IMAGE")
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.more_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.active_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.more_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.diffuse_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.world_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)


def unregister():
bpy.utils.previews.remove(g.c_icons)
del bpy.types.Scene.more_bool
del bpy.types.Scene.active_bool
del bpy.types.Scene.more_bool
del bpy.types.Scene.diffuse_bool
del bpy.types.Scene.world_bool
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def set_bsdf(name, hex, material, mat_name):


def set_dif_color(thing, hex):
thing.diffuse_color = hex_to_rgb(hex)
diffuse_bool = bpy.context.scene.diffuse_bool.diffuse_more
if diffuse_bool == True:
thing.diffuse_color = hex_to_rgb(hex)


def set_input_color(node, num, hex):
Expand Down
35 changes: 16 additions & 19 deletions blender-qmc/blender-qmc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"name" : "QMC (Quick Material Colors)",
"description": "Sets the Base Color of a Material Shader",
"author" : "Don Schnitzius",
"version" : (1, 6, 0),
"version" : (1, 7, 0),
"blender" : (2, 80, 0),
"location" : "3D Viewport > Sidebar > MAT > Quick Material Colors",
"warning" : "",
Expand All @@ -42,18 +42,10 @@

# BOOLEAN FOR PANEL
class QMC_SETTINGS(bpy.types.PropertyGroup):
rename_material_more: bpy.props.BoolProperty(
name='',
default=False
)
active_node_more: bpy.props.BoolProperty(
name='',
default=False
)
world_color_more: bpy.props.BoolProperty(
name='',
default=False
)
active_node_more: bpy.props.BoolProperty(name='',default=False)
rename_material_more: bpy.props.BoolProperty(name='',default=False)
diffuse_more: bpy.props.BoolProperty(name='',default=False)
world_color_more: bpy.props.BoolProperty(name='',default=False)


# PARENT PANEL
Expand All @@ -67,23 +59,26 @@ class QMCPanel(bpy.types.Panel):

def draw(self, context):
layout = self.layout
more_bool = context.scene.more_bool
active_bool = context.scene.active_bool
more_bool = context.scene.more_bool
diffuse_bool = context.scene.diffuse_bool
world_bool = context.scene.world_bool

srow = layout.row()
scol = srow.column(align=True)
scol.scale_y = 1.25
scol.prop(more_bool, "rename_material_more")
scol.prop(active_bool, "active_node_more")
scol.prop(more_bool, "rename_material_more")
scol.prop(diffuse_bool, "diffuse_more")
scol.prop(world_bool, "world_color_more")

scol = srow.column(align=True)
scol.scale_y = 1.25
scol.scale_x = 3.0
scol.label(text="Selected Node Only")
scol.label(text="Rename Material")
scol.label(text="Selected Node")
scol.label(text="World Background")
scol.label(text="Set Viewport Color")
scol.label(text="Set World Background")


# IMPORT PANELS
Expand Down Expand Up @@ -138,15 +133,17 @@ def register():
g.c_icons.load(os.path.splitext(entry)[0], os.path.join(icons_dir, entry), "IMAGE")
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.more_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.active_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.more_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.diffuse_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)
bpy.types.Scene.world_bool = bpy.props.PointerProperty(type=QMC_SETTINGS)


def unregister():
bpy.utils.previews.remove(g.c_icons)
del bpy.types.Scene.more_bool
del bpy.types.Scene.active_bool
del bpy.types.Scene.more_bool
del bpy.types.Scene.diffuse_bool
del bpy.types.Scene.world_bool
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
Expand Down
4 changes: 3 additions & 1 deletion blender-qmc/blender-qmc/color_sets/color_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def set_bsdf(name, hex, material, mat_name):


def set_dif_color(thing, hex):
thing.diffuse_color = hex_to_rgb(hex)
diffuse_bool = bpy.context.scene.diffuse_bool.diffuse_more
if diffuse_bool == True:
thing.diffuse_color = hex_to_rgb(hex)


def set_input_color(node, num, hex):
Expand Down

0 comments on commit f74ba5a

Please sign in to comment.