-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a button in a panel to set up render dimensions
This is useful when using a multi-camera setup with reference images that have varying dimensions.
- Loading branch information
1 parent
6c860b3
commit 773b7e6
Showing
7 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import bpy | ||
from bpy.types import Panel | ||
|
||
from . import addon as ops | ||
|
||
class FspyPanel(Panel): | ||
bl_label = "fSpy" | ||
bl_idname = "SCENE_PT_fSpy" | ||
bl_space_type = 'PROPERTIES' | ||
bl_region_type = 'WINDOW' | ||
bl_context = "data" | ||
|
||
@classmethod | ||
def poll(cls, context): | ||
obj = context.active_object | ||
return ( | ||
obj.type == 'CAMERA' | ||
and obj.data.fspy.use_fspy | ||
) | ||
|
||
def draw(self, context): | ||
cam = context.active_object.data | ||
layout = self.layout | ||
#layout.prop(cam.fspy, "reference_dimensions") | ||
layout.operator(ops.SetRenderDimensions.bl_idname) | ||
|
||
classes = ( | ||
FspyPanel, | ||
) | ||
register, unregister = bpy.utils.register_classes_factory(classes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import bpy | ||
from bpy.props import IntVectorProperty, PointerProperty, BoolProperty | ||
from bpy.types import Camera, PropertyGroup | ||
|
||
class FspyProperties(PropertyGroup): | ||
use_fspy: BoolProperty( | ||
name = "Use fSpy", | ||
description = "Turned true when the camera was imported using fSpy", | ||
default = False, | ||
) | ||
|
||
reference_dimensions: IntVectorProperty( | ||
name = "Reference Dimension", | ||
description = "Width and height in pixels of the reference image that was used in fSpy", | ||
size = 2, | ||
default = (0,0), | ||
min = 0, | ||
) | ||
|
||
classes = ( | ||
FspyProperties, | ||
) | ||
register_cls, unregister_cls = bpy.utils.register_classes_factory(classes) | ||
|
||
def register(): | ||
register_cls() | ||
Camera.fspy = PointerProperty(type=FspyProperties) | ||
|
||
def unregister(): | ||
del Camera.fspy | ||
unregister_cls() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.